A repeatable IPv4 workflow
- Write the required host count and reserve the network and broadcast addresses for an ordinary LAN.
- Round that total up to a power of two.
- Subtract its binary exponent from 32 to get the prefix.
- Align the network to the block boundary.
- Check the first host, last host and broadcast before assigning anything.
Example: an office with 45 hosts
45 + 2 = 47, so select a 64-address block: /26. In 10.42.30.0/24, the four candidate boundaries are .0, .64, .128 and .192. Choosing 10.42.30.128/26 gives hosts .129–.190 and broadcast .191. There are 17 spare ordinary host addresses.
Example: find the containing subnet
For 10.42.31.173/27, the final mask octet is 224 and the block increment is 32. The address 173 is between 160 and 191. The network is 10.42.31.160/27, broadcast .191, and host range .161–.190.
Example: unequal allocations
Inside 10.42.32.0/24, allocate 100 hosts as .0/25, then 50 hosts as .128/26, then 20 hosts as .192/27. The final .224/27 remains free. Allocating largest first keeps each next block aligned.
Quick rules
| Task | Rule |
|---|---|
| IPv4 block size | 2^(32 − prefix) |
| Ordinary LAN hosts | Block size − 2 |
| Equal child count | 2^(child prefix − parent prefix) |
| Wildcard | 255 minus each mask octet |
| IPv6 block size | 2^(128 − prefix); no broadcast |
Exceptions to remember
/31 point-to-point links use both addresses; /32 is a host route. Cloud networks may reserve extra addresses. IPv6 uses different address semantics, so do not subtract two from every IPv6 subnet. A route summary must align and must not accidentally cover a gap.
Technical references
Reviewed 9 September 2026. Found an issue? Send a correction with a reproducible example.