Subnetting is an absolutely critical component for CCNA success. In this article, we are first going to review how subnetting works, ensure you master the “longhand” method and understand the mathematics behind this networking principle. Once this is done, we are going to look at some shortcuts that can be used in the exam to ensure that we can solve the many subnetting challenges quickly and accurately.
Subnetting is an absolutely critical component for CCNA success. The skill must be demonstrated in the CCENT (ICND1) and CCNA (ICND2) exams. Should you take the composite CCNA exam option, you need to be even better and faster at subnetting in order to achieve success.
In this article, we are first going to review how subnetting works and ensure you master the “longhand” method and understand the mathematics behind this networking principle. Then we will look at some shortcuts that can be used in the exam to ensure that we can solve the many subnetting challenges quickly and accurately. I believe it is critical that students understand the how’s and why’s behind this topic. It is unacceptable, in my opinion, to master subnetting if you only know the shortcuts. We need to fully understand why we are doing something in the network, and how it truly works before we can start seeking exam shortcuts.
This article assumes you have a basic working knowledge of IP addressing and subnet masks. Also, this article assumes you can manually convert a binary octet to decimal, and vice versa.
Why do we even need this concept of subnetting? Well, we need to break up our networks into smaller networks all of the time. Breaking the network up allows the network to be more efficient and more secure and more easily managed.
When you look at a Class B private address like 172.16.0.0/16 (255.255.0.0), you can calculate the number of hosts that can live in this network. You take the number of bits used for host addressing (16), and you raise 2 to this power and then subtract 2. So the formula is 2^h-2 where h is the number of host bits. We need a calculator for this one because the number is so big! It turns out that 65,534 can live in this network. That’s great, that’s amazing, and…it also turns out that this is impossible! In a typical TCP/IP network of today, you are going to have big problems if you start placing 500 or more systems in the same network (subnet), never mind 65,000 or more!
Number of Subnets and Number of Hosts
So if we want to use the 172.16.0.0 private address space, we need to “subnetwork” this address space in order create more network addresses that can each accommodate an appropriate number of host systems. When we subnetwork, we play a balancing act. As we “borrow” bits for subnetting from the host bits, we can create more subnets, but we do so at the cost of being able to support fewer and fewer host systems per network. The formula for how many hosts you can have always remains the same— it is 2^h-2. The formula for how many networks we can create is very similar. It is 2^n where n is the number of bits we borrow from the host bits.
Let us study an example. If we have 172.16.0.0/16 and we decide to borrow 8 bits for subnetting, we can create 2^8 or 256 different subnetworks. How many hosts can each of these subnetworks accommodate? Well, there are now 8 bits left for host addressing. 2^8-2 gives us 254 hosts per subnetwork.
A Sample Subnetting Scenario
Let us stick with the example where we begin with the private IP address space of a Class B address of 172.16.0.0. We examine our networking needs and realize that we need to accommodate 100 different subnetworks in our organization. From the previous information in this article, we know that in order to create 100 subnets, we need to borrow 7 bits (2^7 = 128). This is perfect; we have the number of subnetworks that we need, plus a few extra that we can call upon when the network inevitably grows.
What will the subnet mask be in this scenario? This mask will be the one that is used by all of the hosts in all of the different subnetworks. It is critical that we calculate this number correctly, of course.
Notice that our Class B address originally had 16 bits that made up the network ID portion. In this sample scenario we are going to borrow 7 bits. Now we have a network ID that is made up of 23 (16+7). We can write out the 23 bits of the subnet mask now:
So converting to our convenient dotted decimal notation, we can see our mask:
A cooler way to write the mask is just /23 after the IP address. This is called prefix notation.
So what would the first subnetwork network ID be? Well, we know it will start 172.16, but what will the value be in that third octet where we have some bits (7) representing the subnet and one bit representing the host portion.
To answer this in the longhand method, we write out the mask and the address from that octet in binary and do some analysis.
Notice the first subnetwork will be 172.16.0.0. We can use all zeros in the first 7 bit positions of the third octet, and we have a zero in the last bit position which is used to identify hosts.
What would the first host address be in this network? Let’s write those last two octets out longhand:
The first host address on the 172.16.0.0 network would be:
What would the broadcast address be for that network? To get this you fill all the host bits with a 1:
How about the last usable host address on this subnetwork? Easy. We will turn all the host bits to 1, except for the last one.
What is the next subnetwork in this scheme? Well, let us turn one of those subnetwork bits on. We will start with the least significant (rightmost):
Ahh, so the next network is 172.16.2.0/23.
It is wonderful to see how all of this works longhand, but in the lab exam environment, we are VERY pressed for time. We need powerful shortcuts. Here we will walk through my preferred shortcuts against the backdrop of sample exam questions.
There are many different shortcut approaches that are all valid. This is the one that I prefer, but you might be taught another by some other Cisco trainer. Go with whatever works for you in the exam!
Sample Question 1:
What is the last usable address in the subnet of a host with the address 192.168.1.136 and a subnet mask of 255.255.255.240?
Step 1 Upon arriving at my first subnetting question in the exam environment, I build a Powers of Two reference chart on the scratch paper Cisco provides.
2^7=128 | 2^6=64 | 2^5=32 | 2^4=16 | 2^3=8 | 2^2-=4 | 2 ^1=2 | 2^0=1
Step 2 How many bits of subnetting are used in the fourth octet here? My Powers of Two chart tells me. 1 bit = 128; 2 bits = 192; 3 bits = 224; 4 bits = 240. Yes, the forth octet of the subnet mask looks like this in binary—11110000.
Step 3 Now the magic of the shortcut—we go four bits deep (from left to right) in the Powers of Two chart. This tells us the value that the subnets increment on. In our example it is 16:
So our subnets are:
Step 4 This host, with the address of 192.168.1.136 must live on the 192.168.1.128 subnet. The broadcast address for this subnet is one less than the next subnet of 144, so that is 143. The last usable address is 142. We have arrived at our answer—192.168.1.142.
Sample Question 2
Your IT Junior Administrator has provided you with the address and mask of 192.168.20.102 and 255.255.255.224. You Junior Admin has asked you to tell him how many hosts can be created on your subnet?
Step 1 Here I begin by referencing the Powers of Two chart I created on my scratch paper. Adding 128 + 64 + 32, I get the 224 value used in the fourth octet of the subnet mask. Therefore, I can see that there are 3 bits used for subnetting in that octet. This leaves 5 bits for host addressing.
2^7=128 | 2^6=64 | 2^5=32 | 2^4=16 | 2^3=8 | 2^2-=4 | 2 ^1=2 | 2^0=1
Step 2 As we discussed earlier, the equation for the number of hosts per subnet is 2^h – 2 where h is the number of host bits. From the chart I see that 2^5 = 32. 32-2 = 30 hosts per subnet.
Initially, the subnetting related questions strike fear in the hearts of CCNA candidates. Sure enough, with study and practice, and the many shortcut methods that exist, these questions become the favorites in the Certification Exam environment. They can be solved easily and quickly, and candidates know they solved them correctly. Thanks to the power of mathematics, there are certainly no “grey” areas in questions like these.