I am going to go through how to subnet a class A IP address network for CIDR. This is not going to be a tutorial for complete beginners but instead towards network technicians that are either studying or work with IT Networks and Communication.
Usually I write articles in Swedish but I thought that this would fit best in english because I think that more english-speaking people are trying to find solutions on this topic. This article is also written in memory for myself so I don't have to search through so many websites when I have this problem in the future.
The goal with this tutorial
Take one IP address network and create more smaller networks from that. This is good when we for example want to summarize addresses.
Take this IP network address: 18.104.22.168/11
We want 4 networks with prefix /14
and the results will be something like this:
Address. Prefix Subnetmask....... Range............Broadcast
22.214.171.124 /14 255.252.0.0 126.96.36.199 - 188.8.131.52 184.108.40.206
220.127.116.11 /14 255.252.0.0 18.104.22.168 - 22.214.171.124 126.96.36.199
188.8.131.52 /14 255.252.0.0 184.108.40.206 - 220.127.116.11 18.104.22.168
22.214.171.124 /14 255.252.0.0 126.96.36.199 - 188.8.131.52 184.108.40.206
Please not that this is not optimized for real networks. This is just an example and you have to adapt it to your situation and planning. But I think you can make it work.
We have IP network address 220.127.116.11/11 and we want to create several subnetworks with prefix /14.
Let's calculate the subnetmask and binary for prefix 11 and 14:
Prefix /11: 255.224.0.0 => 11111111.11100000.00000000.00000000 (eleven 1s)
Prefix /14: 255.252.0.0 => 11111111.11111100. 00000000.00000000 (fourteen 1s)
The fourteen bits are the network bits and they are marked with red
The three bits marked with orange color are subnet bits.
The zeroes are host bits and they are marked with blue color.
Total number of hosts
To calculate the total number of hosts for each subnet we need to cound how many zeroes we have: 2 + 8 + 8 = 18
Then we can use a formula for the total number and the usable total number of hosts IP addresses.
Total number of hosts: 2^18 = 262144
Usable total number of hosts: 2^18 - 2 = 262142
We subtract two because we remove the network address and broadcast address for the assignable range of host IP addresses.
Calculate the subnet IP ranges
First we search for our increment, a value that helps us to verify the calculation later on. You find the increment by looking at the right most binary 1 in the subnetmask. Then you convert that binary 1 to its decimal equivalent.
28.32 = 00011100.00100000
255.252 = 11111111.11111100
00000100 = 4
The increment is marked with green color. The increment is used to easier check that the ranges are correct. Every new subnet has incremented the octet by 4 when we calculate the range.
Remember this rule: We only change the zeroes and the subnet bits when calculating the ranges.
We start with subnet zero and I only show the second octet (18.104.22.168) because it's most important. The bits are marked with their respective colors to make it easier for you to follow. I only show the network address and the broadcast address for each subnet. The usable host IP addresses are contained within.
Subnet bits are orange
Host bits are blue
Network bits are red
Can you see the pattern? Please note that the network and broadcast addresses are incremented by 4 for each new subnet. 36-32 = 4
#0 00100000 - 00100011 (32-35)Here is an example of subnet #2:
#1 00100100 - 00100111 (36-39)
#2 00101000 - 00101011 (40-43) <-- See example below
#3 00101100 - 00101111 (44-47)
#4 00110000 - 00110011 (48-51)
... etc ...
Network..First IP....Last IP.......Broadcast
22.214.171.124 126.96.36.199 - 188.8.131.52 184.108.40.206
Decimal.........BinaryAnd now we're done! At least we now have a table with numbers that we can expand further and assist us in our network design and planning phase.
220.127.116.11.... = 00011100.00101000.00000000.00000000
18.104.22.168.... = 00011100.00101000.00000000.00000001
22.214.171.124 = 00011100.00101011.11111111.11111110
126.96.36.199 = 00011100.00101011.11111111.11111111
Extra assignment ahead
Try to come up with an IP address that summarizes subnets #1 to #3?
Summarization is used mostly in routers to reduce the size if the routing tables and to reduce flapping routes; routes that changes, get added or get removed. If you summarize these routes, they will not be noticed futher down. This is especially useful in OSPF networks between areas to reduce memory and CPU processing. The core routers have summarized routes to surrounding areas.
Read here if you want the solution
How did I come up with that? First I compared subnet #1, #2 and #3 to see what bits that were in common. The first four bits (0010) in the second octet were the same in all three subnets.
Then I calculate the new subnetmask prefix value for that octect, which is obviously 4, and then adding 8 from the first octet. 8+4 = 12. That's because I only want to use the subnetmask that includes these four bits that were same.
At last I just take the value of the octet from subnet number #1 and we have the final IP network address.
Have a nice day!