The addressing toolkit: CIDR notation & the mask, subnet math (hosts, block size, network/broadcast), the prefix table to memorize, RFC 1918 & special ranges, VLSM, route summarization/aggregation, wildcard masks, and network-planning principles.
Reading a prefix, subnetting a block on a whiteboard, and summarizing routes are table-stakes networking skills — and constant interview fodder. This is the addressing and planning toolkit: CIDR notation, the subnet math, the special ranges, VLSM, and aggregation, with the shortcuts that make it fast.
An IPv4 address is 32 bits split into a network part and a host part.
The prefix length /N says how many leading bits are network. Everything else —
host counts, the broadcast address, summarization — falls out of that one split.
CIDR (Classless Inter-Domain Routing) dropped the old A/B/C classes: a prefix is just an address + a length. The
mask is the prefix in dotted form — /24 = 255.255.255.0 (24 one-bits).
Bits set = network; bits clear = host.
2^(32−N) − 2 — subtract 2 for the
network (all host bits 0) and broadcast (all host bits 1) addresses.2^(32−N) = 256 −
mask-octet in the "interesting" octet — the fast mental trick..1), not a rule.| Prefix | Mask | Block size | Usable hosts | Typical use |
|---|---|---|---|---|
| /24 | 255.255.255.0 | 256 | 254 | A LAN / VLAN |
| /25 | 255.255.255.128 | 128 | 126 | Split a /24 in two |
| /26 | 255.255.255.192 | 64 | 62 | Small subnet |
| /27 | 255.255.255.224 | 32 | 30 | Small subnet |
| /28 | 255.255.255.240 | 16 | 14 | Tiny subnet |
| /29 | 255.255.255.248 | 8 | 6 | ~4 hosts + gw |
| /30 | 255.255.255.252 | 4 | 2 | Point-to-point link |
| /31 | 255.255.255.254 | 2 | 2* | P2P link (RFC 3021, no net/bcast) |
| /32 | 255.255.255.255 | 1 | 1 | Loopback / host route |
*/31 is special: RFC 3021 lets a point-to-point link use both addresses (no network/broadcast waste). /32 is a single host — loopbacks, host routes, anycast VIPs.
| Range | Meaning |
|---|---|
10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 | RFC 1918 private (not routed on the Internet). |
100.64.0.0/10 | CGNAT shared space (RFC 6598). |
127.0.0.0/8 | Loopback. |
169.254.0.0/16 | Link-local / APIPA (auto when DHCP fails). |
224.0.0.0/4 | Multicast. |
192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24 | Documentation (TEST-NET) — safe for examples. |
0.0.0.0/0 | Default route (matches everything, shortest prefix). |
Variable-Length Subnet Masking = carve one block into subnets of different sizes to fit each need instead of wasting a /24 on a 2-host link. Allocate largest-first, on power-of-two boundaries.
Given 10.1.0.0/24, need: 100 hosts, 50 hosts, 10 hosts, 2 P2P links
10.1.0.0/25 (.0–.127) → 126 hosts [the 100-host LAN]
10.1.0.128/26 (.128–.191) → 62 hosts [the 50-host LAN]
10.1.0.192/28 (.192–.207) → 14 hosts [the 10-host LAN]
10.1.0.208/30 (.208–.211) → 2 hosts [P2P #1]
10.1.0.212/30 (.212–.215) → 2 hosts [P2P #2] ...room left to grow
The inverse: combine contiguous subnets into one shorter prefix to shrink routing tables. Find the common leading bits; that's the summary length.
10.1.0.0/24 + 10.1.1.0/24 + 10.1.2.0/24 + 10.1.3.0/24
first 22 bits are identical → summary = 10.1.0.0/22 (covers .0–.3)
0.0.0.255 = a /24)..1)./64 per LAN (always), /56 or
/48 per site; think in prefixes, not host counts. See
IPv6.