Here are 14 CCNA subnetting exercises – Questions and Answers with explanations – plus subnetting “tricks” and helpful subnetting tables. This post represents Part 2 of 2 of my subnetting study notes for the CCNA exam. Part 1, Classless IPv4 addressing and subnetting, introduced the topic of subnetting and the FLSM (fixed-length subnet mask) subnetting method. This lesson, CCNA subnetting exercises, Part 2 of my subnetting study notes, is devoted exclusively to subnetting exercises. We practice how to subnet using both the FLSM and the VLSM (variable-length subnet mask) subnetting methods. This post constitutes Issue 11 of my CCNA 200-301 study notes.
You may also be interested in CCNA math portal.
Subnetting mission: Possible
Your mission: You are assigned the 192.168.1.0/24 network and must divide it into five subnets to provide IP addresses for 194 hosts in an enterprise network. You have one minute to complete this mission. See Subnetting Exercise 14 for the details.
Subnetting Exercise 1
Classless IPv4 addressing and subnetting
Subnetting Exercise 2
Divide the following 192.168.255.0/24 network into five subnets of equal size. Identify the five subnets.
We are not given the number of hosts in each subnet. So let’s make subnets as large as they can be.
First we need to figure out how many bits we have to borrow from the host portion.
The formula for the number of subnets is 2X where X is the number of bits borrowed from the host.
If we borrow one host bit, it now becomes a /25 network and we can make two subnets. But we need five subnets, so borrowing one bit is not enough.
If we borrow two host bits we would have four subnets. Still not enough.
If we borrow three host bits we would have eight subnets. This is our answer: we need a /27 network.
So our first subnet would be 192.168.255.0/27. To find the broadcast address of this subnet, we convert all host bits to ones. The following table represents the bits in the last octet.
We get 31 (16 +8 +4 +2 +1). So the broadcast address for the subnet is 192.168.255.31. The IP address range for this subnet block is 192.168.255.0 – 192.168.255.31.
So the next subnet block is 192.168.255.32, which is the network address of Subnet 2.
We can continue calculating the subnet addresses in this way, or we can use the subnetting trick we learned in Subnetting Part 1. Let’s use the subnetting trick. Looking at the last octet of the /27 prefix length IP address, what is the value of the last bit of the network portion? It is 32.
Now we should be able to calculate the other subnets.
Subnet 1 network address is 192.168.255.0/27 >add 32
Subnet 2 network address is 192.168.255.32/27 >add 32
Subnet 3: 192.168.255.64/27 >add 32
Subnet 4: 192.168.255.96/27 >add 32
Subnet 5: 192.168.255.128/27
Subnetting Exercise 3
What subnet does host 192.168.5.57/27 belong to? Here is the IP address in binary and dotted decimal showing the borrowed bits (purple).
So host 192.168.5.57/27 belongs to the subnet 192.168.5.32/27.
Subnetting Exercise 4
What subnet does host 192.168.29.219/29 belong to?
You got this one!
(Solution: subnet ID is 192.168.29.216/29)
Subnetting tool 1
We can use the aforementioned formula to calculate the number of subnets or, for speed, we can use the following table. Each additional host bit we borrow doubles the number of subnets.
Subnets/Hosts Class C
Prefix length | Number of subnets | Number of hosts |
/24 | 1 | 254 |
/25 | 2 | 126 |
/26 | 4 | 62 |
/27 | 8 | 30 |
/28 | 16 | 14 |
/29 | 32 | 6 |
/30 | 64 | 2 |
/31 | 128 | 0 (2) |
/32 | 256 | 0 (1) |
Subnetting Exercise 5
Let’s work through subnetting examples involving Class B networks.
Note: the process of subnetting Class A, Class B, and Class C networks is exactly the same.
You have been given the 172.16.0.0/16 network. You are asked to create 80 subnets for your company’s various LANs. What prefix length should you use?
If we borrow six bits from the host portion, we would have 26 or 64 subnets. Not enough.
Borrowing seven bits, we have 128 subnets. The prefix length is /23. The submask for this prefix length is 255.255.254.0 (to calculate it we convert network bits to ones and host bits to zeros).
Subnetting Exercise 6
You have been given the 172.22.0.0/16 network. You are required to divide the network into 500 separate subnets. What prefix length should you use?
The answer is /25. If we borrow nine bits from the host portion, we would have 29 = 512 subnets.
Subnetting Exercise 7
You have been given the 172.18.0.0/16 network. Your company requires 250 subnets with the same number of hosts per subnet. What prefix length should you use?
This time we have to consider both the number of subnets and number of hosts.
If we borrow eight bits from the host portion, we would have 28 = 256 subnets. So the prefix length should be /24.
The number of usable host addresses in such a /24 network: 28 – 2 = 254 hosts per subnet.
Subnetting Exercise 8
What subnet does host 172.25.217.192/21 belong to?
You got this one!
(Solution: subnet ID is 172.25.216.0/21)
Subnetting tool 2
Here is a chart showing the number of available subnets and the number of available host addresses for each prefix length when subnetting a Class B network. Knowing the patterns will help you with your calculations.
Subnets/Hosts Class B
Prefix length | Number of subnets | Number of hosts |
/17 | 2 | 32766 |
/18 | 4 | 16382 |
/19 | 8 | 8190 |
/20 | 16 | 4094 |
/21 | 32 | 2046 |
/22 | 64 | 1022 |
/23 | 128 | 510 |
/24 | 256 | 254 |
/25 | 512 | 126 |
/26 | 1024 | 62 |
/27 | 2048 | 30 |
/28 | 4096 | 14 |
/29 | 8192 | 6 |
/30 | 16384 | 2 |
/31 | 32768 | 0 (2) |
/32 | 65536 | 0 (1) |
Subnetting Exercise 9
What subnet does host 172.21.111.201/20 belong to?
First, write out the address in binary. Then change all the host bits to zeros. Convert the address back to dotted decimal.
Subnet ID: 172.21.96.0/20.
Subnetting Exercise 10
What is the broadcast address of the network 192.168.91.78/26?
To solve this problem we follow the same steps as for the previous question, except instead of changing all host bits to zeros, we change them to ones.
You got this one!
(Solution: broadcast address is 192.168.91.127/26)
Subnetting Exercise 11
You divide the network 172.16.0.0/16 into 4 subnets of equal size. Identify the network and broadcast addresses of the second subnet.
To solve this problem, first we determine the prefix length we need.
To divide the network into four subnets of equal size, we have to borrow two bits from the host portion because 2 to the power of 2 is 4. When we borrow two bits, that makes a /18 prefix length.
To calculate the network address of the second subnet we change the last (borrowed) bit to one and write out the address in dotted decimal again.
The network address of the second subnet is 172.16.64.0/18.
To find the broadcast address, change all of the host bits to ones.
So the broadcast address of the second subnet is 172.16.127.255.
Note, the four subnets of 172.16.0.0/18 are as follows.
The network address of the first subnet is 172.16.0.0/18.
We calculated the network address of the second subnet to be 172.16.64.0/18.
For the third subnet, we convert the first borrowed bit to one we get 172.16.128.0/18.
For the fourth subnet address, we convert both borrowed bits to ones, we get
172.16.192.0/18.
Another approach to determine the network address of the second subnet, first we find the broadcast address of the first subnet by converting all host bits to ones. The address block after that is the network address of the second subnet.
Subnetting Exercise 12
Let’s subnet a couple of Class A networks.
You have been given the 10.0.0.0/8 network. Your mission is to create 2000 subnets which will be distributed to various enterprises.
What prefix length must you use? How many usable host addresses will be in each subnet?
How many host bits do we need to borrow to create 2000 subnets? 2 to the power of what = 2000? Each bit we borrow from the host portion doubles the number of subnets we can make.
Borrowed bits | Subnets |
1 | 2 |
2 | 4 |
3 | 8 |
4 | 16 |
5 | 32 |
6 | 64 |
7 | 128 |
8 | 256 |
9 | 512 |
10 | 1024 |
11 | 2048 |
211 = 2048. So we need to borrow 11 bits. So will use a /19 prefix length.
We have 13 host bits remaining, so 213 – 2 = 8190 hosts (usable addresses) per subnet will be available.
Subnetting Exercise 13
PC1 has an IP address of 10.217.182.233/11. Identify the following for PC1’s subnet:
1) Network address
2) Broadcast address
3) First usable address
4) Last usable address
5) Number of host (usable) addresses
Let’s walk through the answers.
Note, it is a /11 prefix so there are 3 borrowed host bits.
To find the network address, change all of the host bits to zeros. Then change them back to dotted decimal.
So, there’s the network address, 10.192.0.0.
Add 1 to the network address, and you get the first usable address, which is 10.192.0.1.
Change all of the host bits to 1 to get the broadcast address, 10.223.255.255.
Subtract one from the broadcast address and you get the last usable address, 10.223.255.254.
To determine the number of host addresses, count the number of host bits: 32 – 11 = 21.
221 – 2 or 2,097,152 – 2 = 2,097,150 the number of usable host addresses.
Subnetting Exercise 14
Until now, we have practiced subnetting using FLSM (Fixed-Length Subnet Mask). This means that all the subnets use the same prefix length, for example, subnetting a Class C network into 4 subnets using /26 (see Subnetting Exercise 1).
VLSM (Variable-Length Subnet Mask) is the process of creating subnets of different sizes, to make the use of network addresses more efficient.
VLSM is more complicated than FLSM, but it is easy if you follow the following steps: start with the largest subnet and assign it at the beginning of the address space, and then proceed to the second largest subnet, and then the third largest subnet … repeat until you have assigned all necessary subnets.
You are assigned the 192.168.1.0/24 network, a small enterprise network. You must divide the network into five subnets to provide IP addresses for all hosts in the enterprise network.
There are two LANs in Tokyo and two LANs in Toronto.
Tokyo LAN A has 110 hosts and Tokyo LAN B has 8 hosts.
Toronto LAN A has 29 hosts and Toronto LAN B has 45 hosts.
All the hosts in the enterprise network need an IP address. There is also a point-to-point connection (between the two routers) that needs two IP addresses.
We need to divide the network into 5 subnets.
If we use FLSM and borrow three host bits (i.e., a /27 prefix length), that would give us eight subnets and leave us with five host bits, hence 25 – 2 = 30 usable host addresses.
Eight subnets are satisfactory (we need five) but 30 host addresses would not be enough addresses for Tokyo LAN A or Toronto LAN B.
However, if we use VLSM we can assign different subnet sizes to each LAN, which will allow us to make sure each LAN has enough addresses available.
So what are the steps to subnet using VLSM?
Step 1: assign the largest subnet at the start of the address space.
Step 2: assign the second-largest subnet after it.
Step 3: repeat the process until all subnets have been assigned, from largest to smallest.
If you look at our network, that means we will assign subnets in this order: First, Tokyo LAN A, which requires 110 hosts. Then Toronto LAN B, which requires 45 hosts. Then Toronto LAN A, which requires 29 hosts. Then Tokyo LAN B, which requires 8 hosts. And finally the point-to-point connection between the two routers, which requires 2 addresses.
For each subnet, figure out these values: network address, broadcast address, first usable address, last usable address, and total number of usable host addresses.
Step 1: assign the largest subnet at the start of the address space.
Let’s do Tokyo LAN A which requires 110 hosts.
A /25 prefix length would leave 7 host bits, and so 126 usable host addresses (2^7 – 2).
We need 110 hosts for Tokyo LAN A, so /25 is the correct prefix length.
That means the network address is 192.168.1.0/25.
The first usable address is the network address plus one, and the last usable address is the broadcast address minus one.
To determine the broadcast address for the Tokyo LAN A subnet, convert all of the host bits to 1. We get 192.168.1.127.
We now have the answers for our first subnet, 192.168.1.0/25 for Tokyo LAN A.
That /25 subnet uses up half of the address space of the 192.168.1.0/24 network, but this is not a problem. Using VLSM we can assign smaller subnets to these other LANs, and you will see that there is enough address space left.
So here are the answers for Tokyo LAN A.
Network address: 192.168.1.0/25
Broadcast address: 192.168.1.127/25
First usable address: 192.168.1.1/25
Last usable address: 192.168.1.126/25
Total number of usable host addresses: 126
Step 2: assign the second-largest subnet after it.
Next we should assign Toronto LAN B which requires 45 hosts.
So, 192.168.1.127 is the broadcast address of Tokyo LAN A. If we add one to that, we will get the network address of the next subnet, which will be used for Toronto LAN B.
Therefore, 192.168.1.128 is the network address of Toronto LAN B.
To accommodate the 45 hosts we will use a /26 prefix length. That leaves 6 host bits, which allows for 62 host addresses (2^6 – 2).
So, the complete network address is 192.168.1.128/26.
To get the broadcast address, change all of the host bits to ones. We get 192.168.1.191.
For Tokyo LAN A and Toronto LAN B we’ve used address space from 192.168.1.0 through 191.
So here are the answers for Toronto LAN B.
Network address: 192.168.1.128/26
Broadcast address: 192.168.1.191/26
First usable address: 192.168.1.129/26
Last usable address: 192.168.1.190/26
Total number of usable host addresses: 62
Step 3: assign the third-largest subnet after it.
Next we should assign Toronto LAN A which requires 29 hosts.
192.168.1.191 is the broadcast address of Toronto LAN B, so 192.168.1.192 is the network address of Toronto LAN A.
Toronto LAN A requires 29 hosts, so we should use a /27 prefix length, which leaves 5 host bits, and therefore 30 host addresses (2^5 – 2).
So, 192.168.1.192/27 is the complete network address of Toronto LAN A, and 192.168.1.223 is the broadcast address.
With this information we can determine the first and last usable addresses.
So here are the answers for Toronto LAN A.
Network address: 192.168.1.192/27
Broadcast address: 192.168.1.223/27
First usable address: 192.168.1.193/27
Last usable address: 192.168.1.222/27
Total number of usable host addresses: 30
Step 4: assign the fourth-largest subnet after it.
Next we should assign Tokyo LAN B which requires 8 hosts.
We have used all the way to 192.168.1.223 , which is the broadcast address for Toronto LAN A.
The next address after Toronto LAN A’s broadcast address is Tokyo LAN B’s network address, and it is 192.168.1.224.
Once again, we need to find the prefix length to use for this subnet.
Because Tokyo LAN B requires 8 hosts, we must use a /28 prefix length, which allows 14 host addresses.
So the network address for Tokyo LAN B is 192.168.1.224/28.
Change the host bits to ones, and the broadcast address is 192.168.1.239.
So here are the answers for Tokyo LAN B.
Network address: 192.168.1.224/28
Broadcast address: 192.168.1.239/28
First unable address: 192.168.1.255/28
Last usable address: 192.168.1.238/28
Total number of usable host addresses: 14
Final step.
Now there is only one subnet left that we must assign, and that is the point-to-point connection between the two routers. Point-to-point connections only require 2 addresses.
192.168.1.239 is the broadcast address of Tokyo LAN B, therefore 192.168.1.240 is the network address of the point-to-point connection.
What prefix length should we use?
It is possible to use a /31 prefix length for a subnet requiring only two hosts. However, for the CCNA test, if you are asked what prefix length to use for a subnet that requires two hosts, do not use a /31. Instead, use a /30 prefix length.
A /30 prefix length allows for 2 hosts. Two to the power of two is four, minus two leaves two usable host addresses – one for the Tokyo router and one for the Toronto router.
192.168.1.240/30 is the network address, and 192.168.1.243 is the broadcast address.
So here are the answers for the point-to-point connection.
Network address: 192.168.1.240/30
Broadcast address: 192.168.1.243/30
First usable address: 192.168.1.241/30
Last usable address: 192.168.1.242/30
Total number of usable host addresses: 2
We successfully subnetted this network using VLSM, and there is still a little bit of address space left. Notice that each subnet uses a different prefix length. If we tried to use the same prefix length for each subnet, there would not be enough address space.
Resources for practicing subnetting
Subnetting in 60 seconds or less (method) – Practical Networking (Ed Harmoush)
IPv4 subnetting – random question generator v1.6
Practice Subnetting IPv4 (Practical Networking)
Subnetting (VLSM) | Day 15 Lab (Jeremy’s IT Lab) – Walk-through
Key references
Note: The resources cited below (in the “Key references” section of this document) are the main source of knowledge for these study notes/this lesson, unless stated otherwise.
Free CCNA | Subnetting (Part 2) | Day 14 | CCNA 200-301 Complete Course
Free CCNA | Subnetting (Part 3 – VLSM) | Day 15 | CCNA 200-301 Complete Course
Free CCNA | Subnetting (VLSM) | Day 15 Lab | CCNA 200-301 Complete Course
Related content
Classless IPv4 addressing and subnetting
Compliance frameworks and industry standards
How data flow through the Internet
How to break into information security
IT career paths – everything you need to know
Job roles in IT and cybersecurity
Network security risk mitigation best practices
The GRC approach to managing cybersecurity
The penetration testing process
The Security Operations Center (SOC) career path
Back to DTI Courses