Subnetting from CIDR Notation

This blog post will help you understand subnetting using CIDR notation assuming you already have an idea about IP Address, Network ID and broadcast ID in networking. There are many approaches for understanding this but hopefully this approach might help you.
I have an IP Address with a CIDR notation /20. Using this I need to figure out what the Network ID and the broadcast ID is and by doing that we understand what the CIDR notation of /20 means.
Example 1:
IP Address: 192.168.60.55/20
The CIDR notation indicates how many bits are turned on with my subnet. The below table format helps to explain the example better.
I am making a simple looking chart to get better understanding of this. When we talk about subnet masking we generally see 255.255.255.xxx and something on that lines. Let’s go ahead and start doing them in 8-bit rotations keeping all the 1’s turned ON for 20 bits and 0’s turned ON for the remaining 12 bits
Let’s go ahead and start doing them in 8-bit rotations keeping all the 1’s turned ON for 20 bits and 0’s turned ON for the remaining 12 bits.
This would mean that equivalent of turning them all ON and adding them together will be = 255
So the subnet for this particular IP range will be
255.255.(128+64+32+16).0 = 255.255.240.0
IP Address: 192.168.60.55/20 Subnet: 255.255.240.0
We will just go further and understand how to determine the Network ID, Broadcast ID. At this position, The 3rd Octet is our focus. Since we already know the 1st and 2nd octets are already turned ON we know the values 1st, 2nd of the possible Network ID & Broadcast ID for the IP range. For the 4th Octet since all the bits are turned off it will be 0 otherwise it will be 255.
So here we just need to find the 3rd column values. To find out the 3rd column values we need to translate the value 60 into a binary value and map it into our existing Binary notation using x’s. We will be converting 60 into binary notation that is (00111100)
Using the above values, we are going to build a logic table on binary numbers which results in the below
11111111.11111111.00110000.00000000 –> 3rd octet in Network id become 48
So now we need to figure out what would be the next possible network ID in the list and whatever the next one is, the number right before would be the Broadcast ID for the IP range. This can be determined by the last bit that is turned on in the 3rd octet.
So, the 3rd octet in my Broadcast ID would be 48 + 16 -1 = 63 as shown below. When deciding on the usable IP range we can’t start with 0 and end with 255 so the IP range would be 192.168.48.1 – 192.168.63.254
Network ID: | 192 | 168 | 48 | 0 |
Broadcast ID: | 192 | 168 | 63 | 255 |
Usable IPs: | 192.168.48.1 – 192.168.63.254 |
Example 2: IP Address: 172.10.85.60/22
So the subnet for this particular IP range will be 255.255.(128+64+32+16+8+4).0 = 255.255.252.0
IP Address: 172.10.85.60/22 Subnet: 255.255.252.0
To find the Network id:
Using the above values, we are going to build a logic table on binary numbers which results in the below
11111111.11111111.01010100.00000000 –> 3rd octet in Network id become 84
So now we need to figure out what would be the next possible network ID in the list and whatever the next one is, the number right before would be the Broadcast ID for the IP range. This can be determined by the last bit that is turned on in the 3rd octet.
So, the 3rd octet in my Broadcast ID would be 84 + 4 -1 = 87 as shown below. When deciding on the usable IP range we can’t start with 0 and end with 255 so the IP range would be
192.168.87.1 – 192.168.87.254
Hope this helps.