Visual lab

Learn subnetting visually

11 short lessons, from binary to IPv6. Change the inputs and watch every value update.

Lesson 9 of 11Advanced

Summaries and route lookup

Three ideas, one theme
Summarization (also called aggregation or supernetting) merges routes into one shorter prefix. Longest prefix match is how a router picks between overlapping routes. Wildcard masks are how ACLs and OSPF describe a range of addresses.

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.

How many /24s
NetworkThird octet in binary
172.16.16.0/2400010000
172.16.17.0/2400010001
172.16.18.0/2400010010
172.16.19.0/2400010011
16 bits from the first two octets + 6 shared bits in the third = /22
172.16.16.0/22
Exact summary
The summary covers these 4 networks and nothing else. Exact summaries need a power-of-two count that starts on a multiple of that count (here 16 is a multiple of 4).

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.

10.1.0.0/24
Lives elsewhere
10.1.1.0/24
Behind Router A
10.1.2.0/24
Behind Router A
10.1.3.0/24
Behind Router A

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.

Fixes: advertise 10.1.1.0/24 and 10.1.2.0/23 instead, or make sure the real owner of 10.1.0.0/24 advertises a more specific route. Longest prefix match then sends that traffic to the right place.

Longest prefix match

A router may have several routes that contain the destination. The one with the longest prefix, the most specific, wins.

DestinationNext hopResult
0.0.0.0/0ISP (default)Matches
10.0.0.0/8R1Matches
10.1.0.0/16R2Matches
10.1.2.0/24R3Matches
10.1.2.128/25R4Wins /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.

Constant255255255255
− Mask25525500
= Wildcard00255255
network 10.1.0.0 0.0.255.255 area 0
OSPF: enable on every interface in 10.1.0.0/16
access-list 10 permit 192.168.1.0 0.0.0.255
ACL: match 192.168.1.0/24
access-list 10 permit 10.0.0.5 0.0.0.0
Wildcard 0.0.0.0 matches one host (same as "host 10.0.0.5")
access-list 10 deny 0.0.0.0 255.255.255.255
Wildcard 255.255.255.255 matches anything (same as "any")

Lock it in

Drill the “Summarization” skill until it is automatic, or try the real tool.

Lesson 9 of 11
Next: /31, /32 and special cases