breakfixlearn.com

NET-03Networking

IPv4 subnetting & VLSM

Use this when: you size a subnet, find the network, broadcast and host range, or plan addresses with VLSM.

NET-03 IPv4 subnetting & VLSM cheat sheet. Every table on it is repeated as text below.
Tap the sheet for the full-size image. The text version below is screen-reader friendly.

Text version

Everything on the sheet, as plain HTML: handy for screen readers, copy-paste and search.

Subnet chart

Usable hosts = 2host bits minus 2. Bit values across an octet: 128, 64, 32, 16, 8, 4, 2, 1. Matching mask octets: 128, 192, 224, 240, 248, 252, 254, 255.

CIDRMaskWildcardBlock sizeUsable hosts
/8255.0.0.00.255.255.25516.7 M16.7 M
/16255.255.0.00.0.255.25565,53665,534
/17255.255.128.00.0.127.25532,76832,766
/18255.255.192.00.0.63.25516,38416,382
/19255.255.224.00.0.31.2558,1928,190
/20255.255.240.00.0.15.2554,0964,094
/21255.255.248.00.0.7.2552,0482,046
/22255.255.252.00.0.3.2551,0241,022
/23255.255.254.00.0.1.255512510
/24255.255.255.00.0.0.255256254
/25255.255.255.1280.0.0.127128126
/26255.255.255.1920.0.0.636462
/27255.255.255.2240.0.0.313230
/28255.255.255.2400.0.0.151614
/29255.255.255.2480.0.0.786
/30255.255.255.2520.0.0.342
/31255.255.255.2540.0.0.122 (point-to-point, RFC 3021)
/32255.255.255.2550.0.0.011

Solve any IP in 4 steps

Example: 192.0.2.77/27.

StepDo thisResult
1Write the mask for /27255.255.255.224
2Block size = 256 minus 22432
3Network = the multiple of 32 at or below 77192.0.2.64
4Broadcast = next network minus 1192.0.2.95

Usable hosts are .65 to .94 (30 hosts). The gateway is usually the first address: .65.

VLSM: carve 192.0.2.0/24

Sort by size and allocate the largest subnet first.

SubnetNeedsNetworkUsable range
LAN A100 hosts.0/25.1 to .126
LAN B50 hosts.128/26.129 to .190
LAN C20 hosts.192/27.193 to .222
WAN 12 hosts.224/30.225 to .226
WAN 22 hosts.228/30.229 to .230

Special ranges

RangeMeaning
10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16Private (RFC 1918)
127.0.0.0/8Loopback: this host
169.254.0.0/16APIPA: DHCP failed
100.64.0.0/10Carrier-grade NAT
224.0.0.0/4Multicast
0.0.0.0/8, 255.255.255.255"This network" and limited broadcast
192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24Documentation only

Check and set addresses

CommandWhere
ipconfig or ip -4 addrWindows or Linux
show ip interface briefCisco
show ip route connectedCisco, connected subnets
route print -4 or ip routeWindows or Linux
ip address 192.0.2.65 255.255.255.224 cautionCisco interface config

Caution. Re-addressing the interface you are connected through cuts your SSH session. Use the console or a second path.

Remember

  • Mask octets: 128 192 224 240 248 252 254 255
  • Network and broadcast addresses are not usable hosts
  • A PC with 169.254.x.x never got a DHCP lease
  • Wildcard = 255.255.255.255 minus the mask (ACLs, OSPF)
  • /31 gives 2 usable addresses on point-to-point links (RFC 3021)
  • VLSM: sort by size, largest subnet first

Sources

Go deeper on the blog