IP Addressing, Subnetting, and Routing Basics
This domain covers IPv4 addressing, subnet arithmetic, and how a host or router decides where to send a packet. Most questions are calculation-based, so practise the arithmetic until it is automatic.
Ranges you must know
- Private (RFC 1918): 10.0.0.0/8, 172.16.0.0/12 (172.16 through 172.31), 192.168.0.0/16.
- Loopback: 127.0.0.0/8. Link-local (APIPA): 169.254.0.0/16.
- Multicast: 224.0.0.0/4. Limited broadcast: 255.255.255.255.
- Historical class defaults are /8, /16, /24; CIDR makes the mask explicit instead.
Subnet math
Usable hosts = 2^h − 2, where h is the number of host bits. Block size in the interesting octet = 256 − the mask value in that octet. A /26 mask is 255.255.255.192, block size 64, giving subnets at .0, .64, .128, .192 with 62 usable hosts each.
Routing basics
A host compares the destination with its own mask. If the destination is local, it ARPs for the host; otherwise it sends to the default gateway. Routers pick the longest prefix match first, then the lowest administrative distance (connected 0, static 1, EIGRP 90, OSPF 110, RIP 120), then the lowest metric.
Worked example
What subnet contains 172.16.5.130/26? The mask is 255.255.255.192 and the block size is 64, so boundaries in the fourth octet are 0, 64, 128, 192. Address 130 falls in the 128 block: network 172.16.5.128, first host .129, last host .190, broadcast .191, 62 usable addresses.
Traps
Forgetting the −2 for network and broadcast. Assuming every network is /24. Forgetting that 172.16.0.0/12 stops at 172.31.255.255, so 172.32.x.x is public. Treating the broadcast address as usable. Mixing up the order of the routing tie-breakers: longest prefix always wins before administrative distance is considered.