Skip to main content

Subnets: Key to Network Organization

Whether it is a to-do list or a big project, organization is key. We have busy lives. The task in itself can have several parts or may require some sort of collaboration with a partner or a team. A project may call to meet deadlines, which means keeping up with those crucial dates and having a system of order. Similarly, our networks are busy, transferring a great deal of data across links and nodes. The amount of traffic generated can lead to bottlenecks, packet loss, and delays. A network’s design can vary in complexity, depending on the environment or needs of a customer. Just as we find a manageable way to handle heavy workloads, our networks have a way of efficiently handling network traffic by creating "mini-networks" within our network. This process is called subnetting.

 

Why We Subnet

  • To reduce congestion. Just as traffic in cities cause slowdowns and delays, too much traffic can lead to bottlenecks, packet loss, and delays. Subnetting breaks the network into smaller, manageable networks. This means our data does not have to travel across the entire network, reducing delays.
  • To meet the needs of customers and differing environments. Designing them includes considering customers' needs. A business environment is different from a home or a small-office environment. A business environment can house several servers, wireless access points, smart devices, and workstations. These types of environments can also have several departments, such as HR, IT, and Marketing.  A small-office or home environment can have a smart TV, computers, smart phones, and a gaming console. Each type of environment require different resources, such as bandwidth and power. Creating subnets allow us to have some sort of organization to allocate resources efficiently.
  • To enhance security. More devices can mean more potential vulnerabilities with a greater scope of damage. For example, your home may have a main network WiFi or a guest network WiFi. You can choose to connect all your Internet-connected devices to the guest network, such as printers or smart TVs. If you are on the main network, you cannot reach that printer. Segmenting your network in this way limits access to devices and sensitive sections of your network. 

Subnetting Basics

IP Addressing

Subnetting occurs at the network layer of the TCP/IP model. IP - Internet Protocol - addressing functions at this layer as the primary means for systems to communicate with one another. If a device is connected to the Internet, it has an IP address. We are mostly familiar with four numbers separated by three decimals. This is an IPv4 address. Each of the four numbers, ranging from 0 to 255, is called an octet. An octet is an 8-bit group of 0s and 1s that make up an IP address. But here's the twist: while we see these numbers, the network interface card inside our device 'sees' them as a series of 0s and 1s—what we call binary code. IP addresses, at its heart, are made up of 32 of these 0s and 1s.

For example, take the following IP address:

192.45.10.215

 With a bit either being a 0 or 1, you can have several combinations once you put several bits together. Specifically, the number of combinations is equal to 2x, where x represents the position of the bit in the sequence, starting from 0. For example, the rightmost bit of the octet would be 20, since you can have one value. The left most value is 27, or 128. This bit arrangement, or binary value, of this IP address is:

11000000.00101101.00001010.11010111


Binary Table Conversion
  1 1 0 0 0 0 0 0
n 7 6 5 4 3 2 1 0
2n 128 64 32 16 8 4 2 1
 

 Network and Host IDs

Understanding bit values is important to subnetting. I still get a kick to this day when I see an old house number that reminds me of where I used to live. There are many houses that share the same house number, but what differentiates one from another? The street name. This is similar to creating subnets. 

A street can have several houses on it, and each house shares the same street address. Our networks, similarly, have several devices connected that all belong on that same "street", or IP address space. An IP address can be broken up into two parts: the network ID and the host ID. Think of the network ID as the street you live on, and the host ID as your house or individual houses on the street. The network ID of an IP address identifies the network a device is on. The host ID identifies the individual devices on that network. To identify these parts of an IP address, we use subnet masks.
 

 Subnet Masks and Classes

First, think of your entire address. There is a house number, street name, city, state, and zip code. As you go right to left, excluding the ZIP code, your location gets less general and easier to pinpoint. Subnet masks serve a similar purpose. A subnet mask looks like an IP address, but it serves to identify the network ID and the host ID. Just as we know that if we have the correct street name we can get to our destination, routers use subnet masks to determine the correct destination network and host. 

An IPv4 address is a 32-bit number, so the number of combinations, or IP addresses in the space, are equal to 232, or 4,294,967,296. With such a sheer amount of IP addresses and devices, there needed to be a way to divide these addresses into smaller groups, or classes. 

In 1981, IP addresses were first divided into 5 distinct classes based on subnet mask values and IP octets. This was called classful addressing. Each class had a defined range, which limited how many devices could be in that network. Classes D and E have reserved uses not designed for network communication.

Classful Addressing
Class IP Address Range Subnet Mask Number of IP Addresses Maximum Number of Hosts
A 0.0.0.0 - 127.255.255.255 255.0.0.0 (/8) 16,777,216 16,777,214
B 128.0.0.0 - 191.255.255.255 255.255.0.0 (/16) 65,536 65,534
C 192.0.0.0 - 223.255.255.255 255.255.255.0 (/24) 256 254
D 224.0.0.0 - 239.255.255.255 N/A N/A N/A
E 240.0.0.0 - 255.255.255.255 N/A N/A N/A


 However, classful subnetting comes with a major flaw. What if you don't need that many hosts in your network? Classful subnetting wastes a lot of IP addresses, the IP address space is fixed, and it does not offer much customization. However, this did provide a foundation for a more flexible solution - classless addressing.  In 1993, Classless Inter-Domain Routing (CIDR) was introduced. How does it work?

CIDR

Let's put subnet masks and IP addresses altogether. For example, let's take the earlier IP address 192.45.10.215. Based on the first octet, this is a class C address. 


IP Address and Subnet Mask
192 45 10 215
11000000 00101101 00001010 11010111
11111111 11111111 11111111 00000000
 
 The table shows 3 rows:
  • First row - IP address 
  • Second row - IP address (binary)
  • Third row - Subnet mask (binary)
How do you read a subnet mask? First, notice that the subnet mask has a chain of 1s before a chain of 0s. The series of 1s mark the network ID; the 0s mark the host ID. Second, compare the series of 1s with the IP address in binary. Wherever the 1s in the subnet mask match the spot with the bit in the IP address, that is your network ID. In this example, there are 24 1s, or network bits. The network ID would be 192.45.10.0.  The host bits would be the remaining bits from the IP address. Since all the 0s were in the last octet, the last octet, 215, represents the host ID. 

That is pretty standard. What if we up the ante - 27 1s? The same holds true: compare the series of 1s with the IP address in binary. Wherever the 1s in the subnet mask match the spot with the bit in the IP address, that is your network ID. 

IP Address and Subnet Mask
192 45 10 215
11000000 00101101 00001010 11010111
11111111 11111111 11111111 11100000
 
However, those 3 extra bits change the network and host ID.  Let's look at the last octet. When we compare the series of 1s in the subnet mask with the IP address above it, the first two 1s are the same, but the third bit in the subnet mask is matched with a 0 in the IP address. Ignoring that bit, we take the binary value of the first two bits in the octet of the IP. The leftmost value is equal to 27, or 128. The next bit value is equal to 26, or 64. Add them together, and 128+64=192. Keeping the original network ID intact, the last octet changes to 192. Therefore the network ID of this subnet is 192.45.10.192. To find the host ID, subtract 215 and 192. The host ID is 23. When expressing the subnet in CIDR notation, you can put your IP address followed by a forward slash and the number of bits in the subnet mask. In this case, the CIDR notation would be 192.45.10.215/27. 

Last Octet
215
11010111
11100000

What's Next?

I have heard many different views towards subnetting. Before coming into the field and taking courses, I watched videos and subnetting was still a hard concept to grasp. I eventually learned from an IT Concepts course at my university. After much practice, it made so much sense and I love doing it. I challenged myself to create random IP addresses and subnet masks; in doing so, I even learned how to mix and match subnet masks, which will be discussed in the next post. I would love to share what has helped me. Everyone has their own way; many can do it in their heads, while others stick to pen and paper. I prefer pencil and paper, but you get the gist. Subnetting can be complex, but I see why it is so important in securing our network, easing congestion, and organizing our work and home environments. Even our networks need some TLC. 

Comments

Popular posts from this blog

Is MCP the TCP/IP for AI?

  The Internet runs on TCP/IP. We might as well include AI in the mix, but how about AI? TCP/IP allows devices, services, applications, and data to communicate with other devices, services, applications, and data. How does AI talk? This is why I love networking, and the thought of how AI communicates makes me hopeful that the field will survive extensive job replacements. Unless self-healing networks actually come.  I have been reading more into MCP. What exactly is it? Is it necessary for AI models and agents to communicate? Did you know AI agents have their own social media?? Biggest of all, is there any correlation between MCP and TCP/IP for model communication? Can MCP take notes from TCP/IP, or will it rewrite networking? This post explores Model Context Protocol through parallels with TCP/IP to understand how AI communication can become more structured, standardized, and consistent. What is MCP? To understand MCP, a good place to start is APIs. To understand APIs,...

IP in Practice: Public and Private IP Addresses

Do you speak another language? Personally, I love learning new languages, but one of the hardest parts is translation. When it comes to networking, it is something similar. Devices within our home and office networks do not directly go to the internet. There needs to be a "translator". What does this have to do with public and private IPv4 addresses? In this post, we will explore: IPv4 Addresses Private Ranges  The difference and teamwork between NAT and PAT Helpful troubleshooting commands such as ipconfig or ping A demo that puts it altogether.  (Link to topology here .) By the end of this post, you will see how public and private IP addresses work together in action.  IPv4 Address Private Ranges RFC1918 Private IP Address Ranges Class IANA Blocks Range Total Addresses A 10.0.0.0/8 10.0.0.0 - 10.255.255.255 16.7 million (16,777,216) ...

A Nesting Doll of Networks: Types of Networks

  PAN, WAN, MAN, LAN, CAN - what is up with all these rhyming words? As fun it us to relive kindergarten, these are acronyms for the types of networks that exist today. Think of them as digital nesting dolls: PANs can be found in LANs, LANs make up our WANs, and there is more in between. Let's take a closer look at these networking nesting dolls. Personal Area Networks (PANs) Have you ever grown frustrated at how your Bluetooth headphones seem to take forever to pair to your phone? Do you use a wired mouse or a wireless mouse with your desktop? Do you "tap to pay"? These are examples of personal area networks.  A personal area network connects devices close in range, from a few centimeters to a few meters. These types of networks can be wired or wireless.  A wired PAN may be a computer connected to a printer by a USB cable or Ethernet cable.  A wireless PAN may use communication methods, such as Bluetooth, infrared, or radio waves. Think of your wireless Bluetooth ea...