Subnetting with Block Sizes
Unit 4: IP Addressing and Subnetting. Lesson 13 of 49 in NetPlus Academy.
Subnetting splits one network into smaller ones. You can do every exam subnetting problem with one trick: the block size.
The method
- Find the interesting octet: the first mask octet that is not 255 or 0.
- Block size = 256 minus that mask octet. A mask of
.224gives 256 - 224 = 32. A mask of.240gives 16. - Subnets start at multiples of the block size in that octet: 0, 32, 64, 96, 128, 160, 192, 224 for a block of 32.
- The network address is the multiple at or below your host's value. The broadcast is one less than the next multiple. Usable hosts are everything in between.
Worked example
Host 192.168.1.100 with mask 255.255.255.224 (/27). Interesting octet is the fourth. Block size 32. Multiples: 0, 32, 64, 96, 128. The host sits between 96 and 128, so the network is 192.168.1.96, the broadcast is 192.168.1.127, and usable hosts run from .97 to .126.
Counting hosts
Usable hosts = 2 to the power of host bits, minus 2. A /27 has 5 host bits: 32 - 2 = 30 hosts. A /26 has 6: 64 - 2 = 62. A /30 has 2: 4 - 2 = 2, perfect for a point-to-point link. A /31 is used on point-to-point links with no broadcast, and a /32 identifies a single host.
Counting subnets
Subnets created = 2 to the power of borrowed bits. Splitting a /24 into /27 borrows 3 bits and gives 8 subnets of 30 hosts each.
When the interesting octet is the third
Mask 255.255.240.0 (/20): block size 16 in the third octet. Host 10.5.37.200 falls between 32 and 48, so the network is 10.5.32.0, the broadcast is 10.5.47.255, and hosts run from 10.5.32.1 to 10.5.47.254.
The CIDR to mask table
/25 .128 (block 128), /26 .192 (64), /27 .224 (32), /28 .240 (16), /29 .248 (8), /30 .252 (4). For the third octet, /17 through /23 use the same values in that octet.
Subnetting with Block Sizes, explained slowly
One trick for every subnetting question
You never need to convert a whole address to binary. You need one number: the block size. Everything else follows from it.
The method
- Find the interesting octet: the first mask octet that is not 255 and not 0.
- Block size = 256 minus that mask octet.
- Subnets start at multiples of the block size in that octet: 0, then the block size, then double it, and so on.
- The network address is the multiple at or below your host's value. The broadcast is one less than the next multiple. Usable hosts are everything between.
Keep this table beside you until it is automatic:
Prefix Last octet mask Block size Usable hosts /25 128 128 126 /26 192 64 62 /27 224 32 30 /28 240 16 14 /29 248 8 6 /30 252 4 2
Worked example 1: 192.168.1.100/27
Mask is 255.255.255.224. Interesting octet: the fourth, 224. Block size: 256 minus 224 = 32. Multiples of 32: 0, 32, 64, 96, 128, 160, 192, 224. The host value 100 sits between 96 and 128.
Network: 192.168.1.96 First host: 192.168.1.97 Last host: 192.168.1.126 Broadcast: 192.168.1.127 (one less than the next multiple, 128) Usable: 30
Worked example 2: 10.20.30.200/28
Mask 255.255.255.240. Block size 256 minus 240 = 16. Multiples: 0, 16, 32, ..., 192, 208, 224. The value 200 is between 192 and 208.
Network 10.20.30.192, hosts .193 to .206, broadcast 10.20.30.207, 14 usable.
Worked example 3: the interesting octet is the third
10.5.37.200/20. Mask 255.255.240.0. The interesting octet is now the third (240). Block size 16 in the third octet. Multiples: 0, 16, 32, 48. The third octet value 37 is between 32 and 48.
Network: 10.5.32.0 (third octet 32, fourth octet all zeros) Broadcast: 10.5.47.255 (third octet one less than 48, fourth octet all ones) Hosts: 10.5.32.1 to 10.5.47.254
The fourth octet does not matter for finding the network when the third octet is interesting; it just runs from 0 to 255 inside the block.
Counting hosts and subnets
- Usable hosts = 2 to the power of host bits, minus 2 (network and broadcast). A /27 leaves 5 host bits: 32 minus 2 = 30. A /26 leaves 6: 64 minus 2 = 62.
- Subnets created = 2 to the power of borrowed bits. Cut a /24 into /27s: you borrowed 3 bits, so 8 subnets, each with 30 hosts.
- /30 has 2 usable hosts: perfect for the two ends of a router link. /31 is allowed on point-to-point links with no broadcast, so both addresses are usable. /32 is a single host.
The question behind many troubleshooting questions
Two hosts can talk directly only if they are in the same block. A host's default gateway must be in its block too. Example: host 192.168.1.100/27 with gateway 192.168.1.129. The host's block is 96 to 127. The gateway is in the next block. The host will never reach it, even though everything else looks fine. Most "cannot reach the gateway" puzzles are a host or gateway outside the block.
What to memorize
- 256 minus the mask octet is the block. Networks at multiples of the block.
- Network is the multiple below you, broadcast is one before the next multiple.
- Hosts: 2 to the host bits, minus 2. Subnets: 2 to the borrowed bits.