To calculate how many subnets you create, you can use the formula 2^n where n is the number of bits borrowed from the host part. To calculate how many usable hosts a subnet will have, you use the formula 2^n – 2 where n is the number of bits left for the host part. For example, if we borrow 1 bit we will have 2^1 = 2 subnets and each subnet will have 2^7 – 2 = 126 usable IP addresses.
Subnetting helps you create a single network for all your hosts. Let’s consider for example you have an enterprise network and you need 1750 usable IP addresses. A C class block will not be enough. In the past, you would go for a class B block. But that’s just another waste of space, and it’s a big one. A class B block has 65,534 usable IP addresses. So, let’s think about how to move those bits out.
We recall you need 1750 usable IP addresses for your hosts in the network. A C block has only 256, but a B block is just too big. We definitely cannot move the bits from the last octet of the subnet mask because the maximum number of hosts in a network with the 255.255.255.0 subnet mask is 254. Let’s try moving the bits in the second last octet. If we move the last bit, we get 11111110. We have 9 zeros for the host part. Let’s see how many hosts we will get: 2^9 – 2 = 510. That’s not enough. Let’s play with another bit: 11111100. That gives us 1022 available IP addresses. Still not enough. We change 1 more bit: 11111000. Now we have 2 ^ 11 – 2 = 2046 hosts, just enough to accommodate our whole network. 11111000 in decimal is 248, so the subnet mask we will use when we will assign the IP addresses to our hosts will be 255.255.248.0. That’s equivalent to what’s called a /21 block in CIDR format.
You can also subnet a subnet. Let’s say, for example, we need a /25 block and 2 /26 blocks. We can split a class C block into 2 subnets, creating a /25 block by using the first bit of the host portion as a network bit. We get the netmask 255.255.255.128 for that subnet. For example, 192.168.1.0/25 is our first block. Its range is from 192.168.1.0 to 192.168.1.127. Then, from the same C block, we need two more spaces to accommodate 50 hosts each. To accommodate 50 hosts, we need a /26 block (allows up to 62 hosts). So we take the next bit from the host portion and use it as a network bit. We get the 255.255.255.192 netmask, which creates two /26 blocks. The first one is 192.168.1.128/26 ( 192.168.1.128 – 192.168.1.191) and 192.1681.192/26 ( 192.168.1.192 – 192.168.1.255).
Understanding how subnetting works is very important, not only for the CCNA exam, but also for hands-on activities in real life.
In your preparation for Cisco’s CCNA exam, you must be able to divide the network as required by the number of hosts. You must also be able to calculate how many hosts are in a subnet and to determine which one are the valid addresses. The following table shows the subnetting for a C class address:
Prefix | Subnet mask | Available hosts | Total number of IP addresses | Number of subnets |
/24 | 255.255.255.0 | 254 | 256 | 2 |
/25 | 255.255.255.128 | 126 | 128 | 4 |
/26 | 255.255.255.192 | 62 | 64 | 8 |
/27 | 255.255.255.224 | 30 | 32 | 16 |
/28 | 255.255.255.240 | 14 | 16 | 32 |
/29 | 255.255.255.248 | 6 | 8 | 64 |
/30 | 255.255.255.252 | 2 | 4 | 128 |
/31 | 255.255.255.254 | 0 | 2 | 256 |
/32 | 255.255.255.255 | 0 | 0 |
By default /32 is referred as to the host itself.
We hope you found this lesson useful and as a great starting point for your life in subnetting. Remember, practice makes things perfect. Practice as much as you can what you’ve learned in this topic because you will find questions about subnetting in your CCNA exam.