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)
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
Post a Comment