Subnet Masks & CIDR Cheat Sheet (Because I'm Not Doing Binary Math at 2 AM)
This is the first real post on here, so I’m keeping it dead simple just to make sure Hugo actually builds the page and doesn’t shit the bed on mobile.
I’ve been doing this shit for way too many years, and I still refuse to do binary math in my head at 2 AM on an outage bridge. Here’s a basic CIDR cheat sheet so you don’t have to either.
| CIDR | Subnet Mask | Total IPs | Usable Hosts | What It’s Actually For |
|---|---|---|---|---|
| /32 | 255.255.255.255 |
1 | 1 | Loopbacks, host routes, or telling a firewall “this exact box and nobody else” |
| /31 | 255.255.255.254 |
2 | 2 | Direct point-to-point router links (RFC 3021) |
| /30 | 255.255.255.252 |
4 | 2 | Point-to-point links when you’re stuck with ancient gear or stubborn coworkers |
| /29 | 255.255.255.248 |
8 | 6 | Small firewall transit segments where you need HSRP or VRRP VIPs |
| /28 | 255.255.255.240 |
16 | 14 | Out-of-band management or small DMZ blocks |
| /24 | 255.255.255.0 |
256 | 254 | Standard access VLANs before broadcast traffic gets annoying |
| /23 | 255.255.254.0 |
512 | 510 | High-density Wi-Fi subnets |
The Tiny Subnets Nobody Agrees On
- The
/30(4 IPs, 2 Usable): The old-school default for a point-to-point link. You get a network address, two usable IPs for the two interfaces, and a broadcast address. It works on literally everything, which is why people still use it, even though you’re throwing half the subnet in the trash just to connect two routers. - The
/31(2 IPs, 2 Usable): Think about it for two seconds. If two routers are plugged directly into each other on a point-to-point link, who the fuck else are you going to broadcast to? RFC 3021 lets you skip the network and broadcast addresses and use both IPs. Yes, Cisco IOS will bitch at you with%Warning: use /31 mask on non point-to-point interface cautiouslywhen you put it on an Ethernet interface. Ignore it. It works fine, and it stops you from wasting IP space for no reason. - The
/32(1 IP, 1 Usable): One single IP. Slap it on your router loopbacks (lo0) so your OSPF or BGP router IDs and SSH management IPs don’t die every time a physical interface flaps. Also useful in ACLs or static routes when you want to point traffic at one specific host without accidentally letting its whole subnet through.
If this is how you like your networking explained, both editions of Volume 1 are up on Amazon:
- NSFW Networking: Volume 1 (Original Edition)
- SFW Networking: Volume 1 (Safe For Work Edition) (no swearing, extra chapters, safe to leave on your desk at work)