Learn subnetting visually
11 short lessons, from binary to IPv6. Change the inputs and watch every value update.
Summaries and route lookup
Summarize contiguous networks
A router can advertise one summary route instead of many. Line the networks up in binary and keep the bits they share.
| Network | Third octet in binary |
|---|---|
| 172.16.16.0/24 | 00010000 |
| 172.16.17.0/24 | 00010001 |
| 172.16.18.0/24 | 00010010 |
| 172.16.19.0/24 | 00010011 |
When a summary is too big
Router A owns 10.1.1.0, 10.1.2.0 and 10.1.3.0. The smallest single summary is larger than that.
The summary is 10.1.0.0/22, which also includes 10.1.0.0/24. If Router A advertises it, other routers send traffic for 10.1.0.0/24 to Router A. Router A has no specific route for it, so the traffic is dropped or loops: a black hole.
Longest prefix match
A router may have several routes that contain the destination. The one with the longest prefix, the most specific, wins.
| Destination | Next hop | Result |
|---|---|---|
| 0.0.0.0/0 | ISP (default) | Matches |
| 10.0.0.0/8 | R1 | Matches |
| 10.1.0.0/16 | R2 | Matches |
| 10.1.2.0/24 | R3 | Matches |
| 10.1.2.128/25 | R4 | Wins /25 |
10.1.2.200 matches 5 routes. The longest is 10.1.2.128/25, so the packet goes to R4.
Wildcard masks
ACLs and OSPF use the inverse of the subnet mask. A 0 bit means must match, a 1 bit means any value.
| Constant | 255 | 255 | 255 | 255 |
|---|---|---|---|---|
| − Mask | 255 | 255 | 0 | 0 |
| = Wildcard | 0 | 0 | 255 | 255 |
network 10.1.0.0 0.0.255.255 area 0access-list 10 permit 192.168.1.0 0.0.0.255access-list 10 permit 10.0.0.5 0.0.0.0access-list 10 deny 0.0.0.0 255.255.255.255Lock it in
Drill the “Summarization” skill until it is automatic, or try the real tool.