Pcornel
Networking · IP Fundamentals › IPv4 › Addressing

Subnet mask

Cheat sheet · https://pcornel.dk/topic.php?topic=927

Back to the Topic

Answer

A subnet mask is the 32-bit dotted form of the prefix length — 1s for network bits, 0s for host bits — for example 255.255.255.192 for /26.

Remember

Mask octet values: 128 (/25), 192 (/26), 224 (/27), 240 (/28), 248 (/29), 252 (/30), 254 (/31), 255. A wildcard mask (ACLs, OSPF) is the inverse: 255.255.255.255 minus the mask. A wrong mask on one host makes it treat neighbours as remote or remote hosts as local.

First checks

  • show ip interface brief — addresses on each interface.
  • show ip interface <if> | include Internet address — address with prefix length.
  • show ip route connected — the subnets the router derives from its addresses.
  • show ip route <prefix> longer-prefixes — overlapping or more specific routes.
  • Subnet calculator (e.g. ipcalc <ip>/<len> on Linux) — network, broadcast and host range.

Commands

show ip interface brief
show ip interface Gi0/0/1
ip -4 addr show

Verify in this order

prefix length → dotted mask → same mask on all hosts and the gateway in the subnet → correct local/remote decisions

Where it usually breaks

physical/link dependency → local object state → peer/control state → policy → forwarding/adjacency → end-to-end result

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=927

Confirmation

Confirm action

Continue?