CompTIA Network+ guideNetworking concepts
CompTIA Network+ Subnetting: A Step-by-Step Method With Worked Examples
A block-size method for CompTIA Network+ N10-009 subnetting, worked on four examples: a /22 host range, a /27 network and broadcast, splitting a /24 into six subnets, and summarizing four /24s into one route.
Short answer
For a prefix with a partially filled mask octet, subtract that octet from 256 to get the block size. At /8, /16, or /24, keep the whole network octets and vary only the host octets. Networks start at multiples of the block size in that octet, the broadcast is one less than the next network, and the usable hosts sit between them: 2^h − 2 of them for h host bits. For example, 172.16.45.130/27 has a block size of 32, so its network is 172.16.45.128, its broadcast is 172.16.45.159, and its 30 usable hosts run from .129 to .158.
What N10-009 objective 1.7 asks you to do with IPv4
CompTIA Network+ N10-009 objective 1.7 is a "Given a scenario" objective: use appropriate IPv4 network addressing. Its headings cover public vs private addresses (APIPA, RFC 1918, loopback), subnetting with VLSM and CIDR, and the address classes A through E. Subnetting is the part that needs speed, and it shows up again in routing, VLAN design and troubleshooting.
If you studied for CompTIA A+, you already know the private ranges, APIPA and a single /24 network. Passy's A+ networking guide covers those basics. This page starts where that one stops, with CIDR math.
Three reference ranges to keep straight:
- Private (RFC 1918): 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16.
- Link-local, which APIPA uses (RFC 3927): 169.254.0.0/16. Routers must not forward these addresses.
- Loopback (RFC 6890): 127.0.0.0/8.
All examples on this page use private ranges.
Prefix, mask and block size in one table
The prefix length is the number of network bits. The host bits are what is left of the 32. For the conventional multiaccess IPv4 subnets below, usable hosts are 2 to that power minus 2 for network and broadcast. A /31 point-to-point link and a /32 host route are exceptions to that subtraction.
| Prefix | Mask | Block size (octet) | Addresses | Usable hosts |
|---|---|---|---|---|
| /20 | 255.255.240.0 | 16 (third) | 4,096 | 4,094 |
| /21 | 255.255.248.0 | 8 (third) | 2,048 | 2,046 |
| /22 | 255.255.252.0 | 4 (third) | 1,024 | 1,022 |
| /23 | 255.255.254.0 | 2 (third) | 512 | 510 |
| /24 | 255.255.255.0 | 1 (third) | 256 | 254 |
| /25 | 255.255.255.128 | 128 (fourth) | 128 | 126 |
| /26 | 255.255.255.192 | 64 (fourth) | 64 | 62 |
| /27 | 255.255.255.224 | 32 (fourth) | 32 | 30 |
| /28 | 255.255.255.240 | 16 (fourth) | 16 | 14 |
| /29 | 255.255.255.248 | 8 (fourth) | 8 | 6 |
| /30 | 255.255.255.252 | 4 (fourth) | 4 | 2 |
You do not need to memorize the whole table. The mask values 128, 192, 224, 240, 248, 252, 254 and 255 repeat in every octet, and the block size is always 256 minus that value.
The block-size method in four steps
- Find the interesting octet. For a non-octet-boundary prefix, it is the octet where the mask is neither 255 nor 0. For /8, /16, or /24, there is no partial octet: keep the whole network octets and set the remaining host octets to 0 for the network or 255 for the broadcast.
- Get the block size. Subtract that octet's mask value from 256.
- Find the network. Take the largest multiple of the block size that is not more than the address's value in that octet. Octets to the right become 0.
- Find the broadcast and hosts. The broadcast is one less than the next network, so octets to the right become 255. Usable hosts are everything between the two.
Example A: the host range of 10.20.0.0/22
- A /22 mask is 255.255.252.0, so the interesting octet is the third.
- Block size: 256 − 252 = 4. Networks start at 10.20.0.0, 10.20.4.0, 10.20.8.0 and so on.
- This network runs from 10.20.0.0 to 10.20.3.255, the address just before 10.20.4.0.
- Usable hosts: 10.20.0.1 to 10.20.3.254. With 32 − 22 = 10 host bits, that is 2^10 − 2 = 1,022.
One trap is hiding here. In a /22, addresses such as 10.20.1.0 and 10.20.2.255 look like network or broadcast addresses, but they are ordinary usable hosts. Only the first and last addresses of the whole block are reserved.
Example B: network and broadcast for 172.16.45.130/27
- A /27 mask is 255.255.255.224, so the interesting octet is the fourth.
- Block size: 256 − 224 = 32. The networks in that octet start at 0, 32, 64, 96, 128 and 160.
- 130 falls between 128 and 159, so the network is 172.16.45.128.
- The broadcast is 172.16.45.159, one less than the next network at .160.
- Usable hosts run from .129 to .158: 2^5 − 2 = 30.
Going the other way: from a host count to a prefix
Questions also start from a number of devices. Find the smallest number of host bits h where 2^h − 2 covers every device, and remember that the gateway needs an address too. Then the prefix is 32 − h.
| Devices plus gateway | Smallest h that fits | Prefix | Usable hosts |
|---|---|---|---|
| 25 | 5 | /27 | 30 |
| 100 | 7 | /25 | 126 |
| 300 | 9 | /23 | 510 |
For 100 devices, h = 6 gives only 62, so you need h = 7. The free mixed set includes an item that asks for the smallest subnet for a group of devices, so once the table makes sense, size a subnet from a device count on a Network+ item and read why each wrong prefix fails.
Example C: split 192.168.50.0/24 into six subnets
You need at least six subnets, so borrow n bits from the host portion where 2^n is 6 or more. Two bits give 4, which is too few. Three bits give 8. A /24 plus 3 bits is a /27: eight subnets of 32 addresses, 30 usable in each.
| Subnet | Network | Usable hosts | Broadcast |
|---|---|---|---|
| 1 | 192.168.50.0 | .1 to .30 | .31 |
| 2 | 192.168.50.32 | .33 to .62 | .63 |
| 3 | 192.168.50.64 | .65 to .94 | .95 |
| 4 | 192.168.50.96 | .97 to .126 | .127 |
| 5 | 192.168.50.128 | .129 to .158 | .159 |
| 6 | 192.168.50.160 | .161 to .190 | .191 |
| 7 | 192.168.50.192 | .193 to .222 | .223 |
| 8 | 192.168.50.224 | .225 to .254 | .255 |
Six are used and two are spare. If one of those segments needed 40 hosts, a /27 could not hold it, and you would give that segment a larger block while keeping the others small. That is VLSM: allocate the largest required blocks first, preserve network boundaries, and verify that no blocks overlap.
Example D: summarize 10.1.4.0/24 through 10.1.7.0/24
A router can advertise one summary route instead of four. Write the third octet of each network in binary:
| Network | Third octet in binary |
|---|---|
| 10.1.4.0 | 00000100 |
| 10.1.5.0 | 00000101 |
| 10.1.6.0 | 00000110 |
| 10.1.7.0 | 00000111 |
The first six bits, 000001, are the same in all four. The first two octets add 16 bits, so the summary prefix is 16 + 6 = 22: 10.1.4.0/22, covering 10.1.4.0 to 10.1.7.255. A quick check with the block method agrees: a /22 has a block size of 4 in the third octet, and 4 is a multiple of 4.
Alignment matters. Four networks from 10.1.5.0 to 10.1.8.0 cannot be summarized as one /22, because 5 is not a multiple of 4. They need three routes: 10.1.5.0/24, 10.1.6.0/23 and 10.1.8.0/24. When a summary and a more specific route overlap, forwarding uses the longest match (RFC 4632), which the routing guide works through.
Classful addressing, as exam vocabulary
Objective 1.7 still lists classes A to E, though classless addressing (CIDR) replaced them in practice. The classes come from the first bits of the address (RFC 791, RFC 1112):
| Class | Leading bits | First octet | Classful default mask | Use |
|---|---|---|---|---|
| A | 0 | 0 to 127 | /8 | Unicast |
| B | 10 | 128 to 191 | /16 | Unicast |
| C | 110 | 192 to 223 | /24 | Unicast |
| D | 1110 | 224 to 239 | None | Multicast |
| E | 1111 | 240 to 255 | None | Reserved |
The 127.0.0.0/8 block sits inside the class A range but is reserved for loopback. If a question asks for the class of 172.16.45.130, the answer is B, from the first octet, even though the address is used here with a /27.
Spot the invalid host
Cover the right-hand column and decide whether each address can be assigned to a host on the network shown.
| Address | Network | Can a host use it? |
|---|---|---|
| 172.16.45.128 | 172.16.45.128/27 | No. It is the network address. |
| 172.16.45.159 | 172.16.45.128/27 | No. It is the broadcast address. |
| 172.16.45.160 | 172.16.45.128/27 | No. It is outside this subnet, the first address of the next one. |
| 172.16.45.140 | 172.16.45.128/27 | Yes |
| 10.20.2.255 | 10.20.0.0/22 | Yes. It is inside the block and is not its broadcast. |
| 10.20.4.0 | 10.20.0.0/22 | No. It is the next network. |
| 192.168.50.95 | 192.168.50.64/27 | No. It is the broadcast address. |
The same check catches a misconfigured gateway. A host set to 10.8.5.200 with mask 255.255.255.128 is in a /25, so its block size is 128 and its subnet runs from 10.8.5.128 to 10.8.5.255. A gateway of 10.8.5.1 is outside that range, so the host cannot reach it, even though both addresses start with 10.8.5. Either the mask or the gateway is wrong, and the network design says which.
Objective 5.3 lists an incorrect subnet mask and an incorrect default gateway among the network service issues you troubleshoot, so this check carries straight into domain 5. The free mixed set includes an item where a mask puts the gateway outside the host's subnet, so find the mask error behind an unreachable gateway once the drill feels easy.
For more wrong-mask and duplicate-address diagnoses, see the service and performance issues guide. For the IPv6 side of addressing, see the IPv6 guide.
Trust the source
Official sources
Exam policies can change. Use these primary sources for the most current details.
- CompTIA Network+ N10-009 Exam Objectives, Version 4.0CompTIA↗
- RFC 1918: Address Allocation for Private InternetsIETF↗
- RFC 3927: Dynamic Configuration of IPv4 Link-Local AddressesIETF↗
- RFC 6890: Special-Purpose IP Address RegistriesIETF↗
- RFC 791: Internet ProtocolIETF↗
- RFC 1112: Host Extensions for IP MulticastingIETF↗
- RFC 4632: Classless Inter-domain Routing (CIDR)IETF↗