IPv4 Addressing & Subnetting
Cheat sheet · https://pcornel.dk/topic.php?topic=7
Answer
An IPv4 address is 32 bits; the prefix length (or mask) says how many of them name the network. The rest number the hosts: a /24 has 256 addresses, 254 usable, with the first as the network address and the last as broadcast.
Remember
Usable hosts = 2^(32 − prefix) − 2. The block size in the interesting octet is 256 minus the mask value: /26 is 255.255.255.192, blocks of 64 — .0, .64, .128, .192. Two hosts talk directly only if both see the other inside their own subnet. Private ranges: 10/8, 172.16/12, 192.168/16.
First checks
show ip interface brief— addresses and state per interface.show ip interface <interface>— address with mask.show ip route connected— the subnets the device is directly on.show ip route <address>— which subnet an address falls in.- On a host:
ipconfig(Windows) orip addr(Linux) — address, mask, gateway.
Commands
show ip interface briefshow ip interface <interface>show ip route connectedshow ip route <address>show running-config interface <interface>ip addrip route
Verify in this order
address and prefix → network address and broadcast → host range → host and gateway in the same subnet → no overlap with another subnet → route to the subnet exists elsewhere
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=7