Free subnetting practice
Unlimited random IPv4 problems for CompTIA Network+ and A+: find the network address, broadcast address, first and last host, usable hosts, subnet mask or CIDR prefix. Every answer comes with a step-by-step solution.
Score: 0/0Streak: 0Best streak: 0
How to subnet with the block-size method
- Convert the prefix to a mask. A /26 is 255.255.255.192.
- Find the interesting octet, the one where the mask is not 255 or 0. Here it is the fourth octet, 192.
- Block size = 256 minus that mask value. 256 - 192 = 64, so subnets start at 0, 64, 128 and 192.
- Find the block your address falls in. For 192.168.10.77, the block is 64 to 127.
- The first address is the network address and the last is the broadcast address. Everything between them is usable.
Worked example: 192.168.10.77/26
- Subnet mask
- 255.255.255.192
- Network address
- 192.168.10.64
- First usable host
- 192.168.10.65
- Last usable host
- 192.168.10.126
- Broadcast address
- 192.168.10.127
- Usable hosts
- 62
CIDR cheat sheet: /16 to /30
| Prefix | Subnet mask | Addresses | Usable hosts |
|---|---|---|---|
| /30 | 255.255.255.252 | 4 | 2 |
| /29 | 255.255.255.248 | 8 | 6 |
| /28 | 255.255.255.240 | 16 | 14 |
| /27 | 255.255.255.224 | 32 | 30 |
| /26 | 255.255.255.192 | 64 | 62 |
| /25 | 255.255.255.128 | 128 | 126 |
| /24 | 255.255.255.0 | 256 | 254 |
| /23 | 255.255.254.0 | 512 | 510 |
| /22 | 255.255.252.0 | 1,024 | 1,022 |
| /21 | 255.255.248.0 | 2,048 | 2,046 |
| /20 | 255.255.240.0 | 4,096 | 4,094 |
| /19 | 255.255.224.0 | 8,192 | 8,190 |
| /18 | 255.255.192.0 | 16,384 | 16,382 |
| /17 | 255.255.128.0 | 32,768 | 32,766 |
| /16 | 255.255.0.0 | 65,536 | 65,534 |
Private ranges (RFC 1918): 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. See RFC 1918 and RFC 4632 (CIDR).
Subnetting questions
- How do you calculate the number of usable hosts in a subnet?
- Subtract the prefix length from 32 to get the number of host bits, raise 2 to that power, then subtract 2 for the network address and the broadcast address. For a /26 there are 6 host bits, so 2^6 - 2 = 62 usable hosts.
- Is subnetting on the CompTIA Network+ exam?
- Yes. Network+ N10-009 objective 1.7 covers IPv4 addressing, including subnetting, variable length subnet masks (VLSM) and CIDR. A+ Core 1 (220-1201) also covers IPv4 addressing, subnet masks and gateways in objective 2.6.
- Do I need to convert to binary to subnet?
- Not every time. The block-size method on this page works in decimal: subtract the interesting octet of the mask from 256 to get the block size, then find which multiple of the block size your address falls in. Binary is still useful to understand why it works, and the worked solutions show the mask in binary.
- Why do we subtract 2 from the number of addresses?
- The first address in a subnet identifies the network itself and the last is the broadcast address, so neither can be assigned to a host. Two exceptions exist: /31 subnets are allowed on point-to-point links (RFC 3021) and /32 identifies a single host. This tool uses prefixes from /8 to /30, where the minus-2 rule always applies.
- Is this subnetting practice tool free?
- Yes. It is free with no signup, and problems are generated in your browser so you can practice as long as you like.