Cheat sheet: IPv4 subnetting
A prefix-length table, the private ranges and the four steps to work out any subnet by hand.
Prints on one or two pages, without the site menus.
The table you need
| Prefix | Subnet mask | Addresses | Usable hosts | Block size (in the changing octet) |
|---|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,216 | 16,777,214 | 1 in the 1st octet |
| /16 | 255.255.0.0 | 65,536 | 65,534 | 1 in the 2nd octet |
| /20 | 255.255.240.0 | 4,096 | 4,094 | 16 |
| /22 | 255.255.252.0 | 1,024 | 1,022 | 4 |
| /23 | 255.255.254.0 | 512 | 510 | 2 |
| /24 | 255.255.255.0 | 256 | 254 | 1 in the 3rd octet |
| /25 | 255.255.255.128 | 128 | 126 | 128 |
| /26 | 255.255.255.192 | 64 | 62 | 64 |
| /27 | 255.255.255.224 | 32 | 30 | 32 |
| /28 | 255.255.255.240 | 16 | 14 | 16 |
| /29 | 255.255.255.248 | 8 | 6 | 8 |
| /30 | 255.255.255.252 | 4 | 2 | 4 |
| /31 | 255.255.255.254 | 2 | 2 (point-to-point, RFC 3021) | 2 |
| /32 | 255.255.255.255 | 1 | 1 (a single host) | 1 |
Usable hosts = 2^(32 - prefix) - 2. You lose the network address (all host bits 0) and the broadcast address (all host bits 1).
Four steps for any subnet
Example: which network is 192.168.10.77/26 on?
- Find the interesting octet. A /26 changes in the 4th octet.
- Find the block size. 256 - 192 = 64.
- List the network starts. 0, 64, 128, 192.
- Pick the block that contains the address. 77 sits in 64 to 127.
So: network 192.168.10.64, first host .65, last host .126, broadcast .127.
Private ranges (RFC 1918)
| Range | Prefix | Typical use |
|---|---|---|
| 10.0.0.0 to 10.255.255.255 | 10.0.0.0/8 | Large organisations |
| 172.16.0.0 to 172.31.255.255 | 172.16.0.0/12 | Medium networks |
| 192.168.0.0 to 192.168.255.255 | 192.168.0.0/16 | Homes and small offices |
Other special addresses
| Address | Meaning |
|---|---|
| 127.0.0.0/8 | Loopback (this device) |
| 169.254.0.0/16 | Link-local: a device that failed to get an address from DHCP |
| 100.64.0.0/10 | Carrier-grade NAT (shared address space) |
| 224.0.0.0/4 | Multicast |
| 0.0.0.0/0 | The default route: “everything else” |
Sizing a network (VLSM)
Find the smallest block that holds hosts + 2:
| Hosts needed | Use |
|---|---|
| up to 2 | /30 |
| up to 6 | /29 |
| up to 14 | /28 |
| up to 30 | /27 |
| up to 62 | /26 |
| up to 126 | /25 |
| up to 254 | /24 |
When splitting one block into different sizes, allocate the biggest subnet first, then the next, so nothing overlaps.
Practise with the free subnet calculator and drills.