Subnetting and CIDR
Split a network into subnets and calculate sizes by hand.
An IPv4 address has 32 bits. The prefix length after the slash says how many leading bits identify the network. The remaining bits identify hosts.
Number of addresses in a block = 2^(32 - prefix). Usable hosts = that number minus 2 (the network address and the broadcast address).
| CIDR | Mask | Addresses | Usable hosts |
|---|---|---|---|
| /24 | 255.255.255.0 | 256 | 254 |
| /25 | 255.255.255.128 | 128 | 126 |
| /26 | 255.255.255.192 | 64 | 62 |
| /27 | 255.255.255.224 | 32 | 30 |
| /28 | 255.255.255.240 | 16 | 14 |
| /30 | 255.255.255.252 | 4 | 2 |
Example: split 192.168.10.0/24 into four equal subnets
Four subnets need 2 extra bits, so each is a /26 with 64 addresses:
- 192.168.10.0/26 (hosts .1 to .62, broadcast .63)
- 192.168.10.64/26 (hosts .65 to .126, broadcast .127)
- 192.168.10.128/26 (hosts .129 to .190, broadcast .191)
- 192.168.10.192/26 (hosts .193 to .254, broadcast .255)
Private ranges
Three blocks are reserved for private networks and are not routed on the internet: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16.
CarefulPlan address ranges so they do not overlap between sites, VPNs or cloud networks. Overlapping ranges are one of the most common causes of "the VPN connects but nothing works".
Test yourself
Answer all the questions, then check them. Finish with every answer right to mark the lesson as done.