Free practice
Subnetting Practice
Subnetting is a core CCNA skill, and speed with it pays off across the exam. Start by seeing what a mask actually does to the bits, then drill the arithmetic, then practise the design judgement it feeds. Switch to IPv6 mode to see how the same idea works on 128 bits of hex.
A subnet mask is a line drawn through 32 bits
Every IPv4 address is 32 bits long. The mask draws one line through those bits and splits them into two parts.
Network bits: left of the line
They say which subnet the address is in. Every device in the same subnet shares exactly the same network bits.
Host bits: right of the line
They say which device inside that subnet. Every device gets a different pattern of host bits.
Drag the line to the right and there are more network bits and fewer host bits, so the subnet gets smaller. Drag it to the left and the subnet gets bigger. That is all subnetting is.
mask 255.255.255.192 · wildcard 0.0.0.63
Click any bit to flip it. The ringed octet is the interesting octet, where the line falls.
- Network address
- 192.168.10.64
- Broadcast address
- 192.168.10.127
- Usable hosts
- 62
- Block size
- 64
all host bits set to 0
all host bits set to 1
2^6 - 2
in the 4th octet
The same subnet, counted the fast way
The 4th octet runs 0 to 255. A /26 cuts it into blocks of 64. Your address is 77, so it sits in the block 64 to 127.
Usable range: 192.168.10.65 to 192.168.10.126
One more network bit cuts the subnet in half
Read down: every row adds one network bit, so each block is split in two. The bright block is where your address lives.
Why usable hosts is total minus two
Network bits are the street, host bits are the house number. The first address is the street itself, not a home. The last address is the loudspeaker that reaches every house. That is why usable hosts is 64 - 2 = 62.
Cheat table: /16 to /30
| Prefix | Mask | Host bits | Block size | Octet | Usable hosts |
|---|---|---|---|---|---|
| 255.255.0.0 | 16 | 256 | 3rd | 65,534 | |
| 255.255.128.0 | 15 | 128 | 3rd | 32,766 | |
| 255.255.192.0 | 14 | 64 | 3rd | 16,382 | |
| 255.255.224.0 | 13 | 32 | 3rd | 8,190 | |
| 255.255.240.0 | 12 | 16 | 3rd | 4,094 | |
| 255.255.248.0 | 11 | 8 | 3rd | 2,046 | |
| 255.255.252.0 | 10 | 4 | 3rd | 1,022 | |
| 255.255.254.0 | 9 | 2 | 3rd | 510 | |
| 255.255.255.0 | 8 | 256 | 4th | 254 | |
| 255.255.255.128 | 7 | 128 | 4th | 126 | |
| 255.255.255.192 | 6 | 64 | 4th | 62 | |
| 255.255.255.224 | 5 | 32 | 4th | 30 | |
| 255.255.255.240 | 4 | 16 | 4th | 14 | |
| 255.255.255.248 | 3 | 8 | 4th | 6 | |
| 255.255.255.252 | 2 | 4 | 4th | 2 |
Click a row, or press its prefix, to load it above.
How to subnet quickly
Seeing the bits once is what makes the shortcut make sense. Under exam time pressure you then skip the binary. The shortcut is to find the octet the mask ends in, work out the block size, and count. A /26 is 255.255.255.192, and 256 minus 192 is 64, so the subnets start at 0, 64, 128 and 192. Any host address tells you its subnet immediately: round down to the nearest multiple of the block size. The broadcast address is one below the start of the next subnet, and the usable range sits between the two. Every question in the drill above shows this working once you answer it.
Common questions
- How many usable hosts does a /26 have?
- 62. A /26 leaves 6 host bits, and 2^6 - 2 = 62. The two subtracted addresses are the network address and the broadcast address, which cannot be assigned to a host.
- Why do /31 and /32 not follow the 2^n - 2 rule?
- A /31 is the point-to-point case described in RFC 3021: on a link with only two devices there is no need for a network or broadcast address, so both addresses are usable. A /32 is a single host route, so it has exactly one address. These two are where most subnet calculators, and most exam candidates, go wrong.
- What is the block size or interesting octet method?
- Instead of working in binary, you find the octet the mask ends in and count in steps of 256 minus that octet's mask value. For a /26 the mask is 255.255.255.192, so the block size is 64 and subnets start at 0, 64, 128 and 192. It is far faster than converting to binary under exam time pressure.
- What is the difference between a subnet mask and a wildcard mask?
- They are inverses of each other. The subnet mask goes on an interface, while the wildcard mask is what IOS expects in ACL entries and OSPF network statements. A /24 is 255.255.255.0 as a subnet mask and 0.0.0.255 as a wildcard, and swapping the two is one of the most common configuration errors.
- Why does VLSM allocation order matter if the maths still adds up?
- Allocating the largest requirement first keeps the unused space in one contiguous block. Allocating small subnets first leaves gaps that are individually too small to hold anything you later need, so the block fragments and you run out of usable space long before you run out of addresses.
- What is the difference between IPv4 and IPv6 addressing?
- An IPv4 address is 32 bits written as four decimal octets, like 192.168.1.10. An IPv6 address is 128 bits written as eight groups of four hex digits, like 2001:db8:acad:1::10. Both split the address into a network part and a host part with a prefix length, but IPv6 has no dotted subnet mask, no broadcast address, and a standard LAN size of /64.
- How do you shorten an IPv6 address?
- Two rules. First, drop the leading zeros in each group, so 0db8 becomes db8 and 0000 becomes 0. Second, replace the longest run of two or more all-zero groups with a double colon, once only. 2001:0db8:0000:0000:0000:0000:0000:0001 becomes 2001:db8::1. Trailing zeros are never dropped, so ab00 stays ab00.
- How does IPv6 subnetting work?
- Take the common CCNA example: a site gets a /48 from its provider (many get a /56 instead) and every LAN is a /64. With a /48 that leaves 16 bits, one group of four hex digits, for the subnet ID. That gives 65,536 subnets, and you number them by counting in hex in that one group: 2001:db8:acad:0::/64, 2001:db8:acad:1::/64, and so on. There is no host count to work out and no VLSM to plan, because one /64 holds 2^64 addresses.
- Why does IPv6 not subtract two for usable hosts?
- IPv6 has no broadcast address, so the all-ones address is not reserved for it. Multicast groups such as ff02::1 do the jobs broadcast used to do. With 2^64 addresses in a single LAN, a couple of reserved addresses would not matter anyway.
Take it to a real device
Getting the maths right is half of it. The other half is what a router does when you get it wrong, which is rarely an error message. The VLSM overlapping subnets lab puts a real overlap on a simulated router and asks you to find it, and the subnetting question bank covers the theory side.