When I was first introduced to subnetting, it was difficult to understand the math and the process behind it. I watched videos but it did not click. I focused more on how to calculate it than on the reasoning behind it. Why do we subnet? I remember seeing forward slashes followed by numbers, classes, letters, network and broadcast addresses - important terms that was overshadowed by just trying to grasp why certain numbers were used.
Years later, I hear the word "subnetting" in one of my courses, and it reminded me of my struggles. Yet, I was excited. It was a time for redemption. Example after example, I started to get them right but also got to understand how to create a subnet with sufficient space for devices. Because of this, I have grown to love subnetting.
For me, it took time - a break that lasted about two years followed by a curriculum that focused on the topic for a few weeks. If you find yourself struggling with subnetting, do not worry. It takes time. If something takes time, it is worthy understanding. I have benefitted from many resources and much help. If I could share a few tips that helped me, hopefully, it can make your subnetting journey easier and fun.
Tip #1 - Understand binary
One of the first lessons in my IT Concepts course was converting numbers to binary. It was very helpful when we had to convert octets within IP addresses to binary values. I started with creating a little table for the powers of 2 and its corresponding value.
I still write down the base-2 values for reference, but with practice, I remembered some values. For example, 240 is 11110000.
Binary Table Conversion | ||||||||
---|---|---|---|---|---|---|---|---|
1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | |
n | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
2n | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Understanding binary is also important with subnet masks. For example, a 255 in an octet represents 11111111. With four octets, 255.255.255.255 is equal to 4 sets of 11111111. Being able to quickly convert subnet masks to CIDR notation makes a difference, since the number after the slash is the number of 1-bits in a subnet mask.
Subnet Mask | |||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
255 | 255 | 255 | 192 | ||||||||||||||||||||||||||||
1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255 | 128 + 64 = 192 |
Tip #2 - Identify components
When I was introduced to subnetting, I learned 7 important components:
- Network ID The network ID identifies the network. Just as houses on the same street will have different house number but the same street name, devices on the network will share the same network ID if they are on the same network.
- Host ID The host ID identifies the individual device on the network. No two devices can share the same IP address on the same network, just as you cannot have two of the same house number on the same street. In hindsight, this mostly offers a space amongst the devices in a network.
- Number of IP Addresses This number tells the maximum number of devices that can be within a subnet.
- Number of Hosts Hosts are any devices connected on the network. This includes PCs, laptops, servers, smart devices, access points, and routers. Usually, a network has an IP addresses reserved for the default gateway and the broadcast address. This removes two from the total number of IP addresses.
- First Host IP Address There is a range of possible IP addresses that can be used in a subnet. The first host IP address is the first IP address after the network ID.
- Last Host IP Address The last host IP address is the last IP address that can be assigned to a device. This is usually before the broadcast address
- Broadcast Address The broadcast address is the IP address used to send a packet to every device in that subnet.
Identifying these pieces of information give you a scope of how many devices you will be supporting. There will be an example to put these components in practice after these tips.
Tip #3 - Quick Calculations
To find the number of IP addresses that can be within a subnet, subtract the CIDR value from the total number of bits in an IP address - 32 bits.
Number of IP Addresses = 232-CIDR value
To find the number of hosts that can be supported within a subnet, subtract 2 from the number of IP addresses, where one is for the broadcast
Number of hosts = Number of IP Addresses - 2
= (232-CIDR value) - 2
You also need the range of possible host IP addresses. To find the first host IP address, add 1 to the last octet of the network ID. Then, to find the IP range, take the total number of IP addresses. If the total number of IP addresses is greater than 256, divide it by 256. Subtract 1. Take that value and add it to the last octet before the next 0 in the network ID.
Example Time!
Let's put this altogether. Here is an IP address and subnet mask:
172.16.10.23/23
. Network ID & Host ID
To find the network ID, you may decide to look at the subnet, or CIDR notation. The
/23
tells you there are 23 1-bits. If the CIDR value is a multiple of 8, it makes it much easier to identify what network an IP address resides in. It's not in this case, but we can take 16 bits. Since 8 × 2 = 16, the first two octets will make up the network ID. Also, we will not leave the third octet because it is not /24, accounting for three full octets. Compare the remaining seven bits to the binary value of 10. They match where they need to be, and the network ID is 172.16.10.0. If you want to find the host ID, simply subtract the values that do not match to its respective octet. In this example, it would be 23 and 0, so 23 - 0 = 23. The host ID is 23.
IP Address | |||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
172 | 16 | 10 | 23 | ||||||||||||||||||||||||||||
1 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 1 |
128 + 32 + 8 + 4 = 172 | 16 | 8 + 2 = 10 | 16 + 4 + 2 + 1 = 23 | ||||||||||||||||||||||||||||
Subnet Mask | |||||||||||||||||||||||||||||||
255 | 255 | 254 | 192 | ||||||||||||||||||||||||||||
1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255 | 255 - 1 = 254 | 0 |
Number of IP Addresses
To find the number of IP addresses within a network ID space, subtract the CIDR value from 32.
Number of IP Addresses = 232-CIDR value
= 232-23
= 29
= 512
Number of Hosts
To find the number of hosts, take your maximum number of IP addresses and subtract 2.
Number of hosts = Number of IP Addresses - 2
= 256 - 2
= 254
With 256 total IP addresses, you can put 254 host devices. The remaining two addresses are used as network addresses and broadcast addresses.
IP Range
To find the first host IP address, add 1 to the last octet of the network ID. In this example, the first host IP address would be 172.16.10.1.
To find the last host IP address,
- Take the total number of IP addresses. If the total number is greater than 256, divide it by 256. Take the value and subtract 1.
Number of IP Addresses = 512
512 ÷ 256 = 2
2 - 1 = 1
- Take that value and add it to the last octet before any zeros in the network ID.
Network ID: 172.16.10.0
Last Host IP: 172.16.11.x
- The IP range does not include the broadcast address. Usually, the last octet in the host address range is 254. So, the last host IP address is 172.16.11.254.
Broadcast Address
To find the broadcast address, just add 1 to the last octet of the last host IP address.
Last Host IP: 172.16.11.254
Broadcast Address: 172.16.11.255
The broadcast address is 172.16.11.255.
IP Address/CIDR Notation | 172.16.10.23/23 |
Network ID | 172.16.10.0 |
Host ID | 23 |
Number of IP Addresses | 512 |
Number of Hosts | 510 |
First Host IP Address | 172.16.10.1 |
Last Host IP Address | 172.16.11.254 |
Helpful Resources
These are just some of the techniques that have helped me, but nothing is better than the classics. Here are a few other links to resources that can help with subnetting.
- IP Subnet Calculator
- Subnet Calculator
- Practice Subnetting IPv4
- Subnetting Questions
- Practical Networking - YouTube Playlist
What's Next?
There is a satisfying feeling when you work on something new - especially when it clicks! I guess for me personally that is why I love subnetting so much. After that hiatus, I finally understood this important concept. It led me to create my own subnets through Packet Tracer. It sparked an interest in variable length subnet masking, or VLSM. I am thinking of saving VLSM for a future post, but it is like doing these steps within another subnet.
This has all been for IPv4 addresses. With more technology being developed and mostly our IPv4 address space has become exhausted, there has been more implementations and focus with IPv6. I have much to learn towards it and that is a project in its own. I am looking forward to it though!
How do you feel about subnetting? What has helped you? What aspects of it do you find challenging? I am curious what you think of it. Honestly, subnetting does feel like a lot. Writing this post, I felt that way. Even though I still write the base-2 values, I began to feel more comfortable with binary values. Not to mention, there is so much help and practice out there ready at the helm.
Subnetting is truly more than the numbers; it is an efficient means to break up networks to reduce congestion, enhance security, and meet our needs. Take it in stride! Take the time to understand it fully. I hope these tips have offered some help as you continue along your subnetting journey. We are just getting started!
Comments
Post a Comment