IPv4 addressing · Fundamentals · Module 5
Summarization and finding addressing mistakes
Show topologyHide topology
Interfaces and addresses · Et = Ethernet. LAN C, LAN D and branch LAN 2 are planned and not cabled yet.
- 192.168.8.0/26 · LAN AR1 Et0/0 192.168.8.1H1 eth0 192.168.8.10
- 192.168.8.64/26 · LAN BR1 Et0/1 192.168.8.65R3 Et0/0 192.168.8.126
- 192.168.9.224/30R1 Et0/2 192.168.9.225R2 Et0/0 192.168.9.226
- 192.168.9.228/31R2 Et0/2 192.168.9.228R4 Et0/0 192.168.9.229
- 192.168.9.0/25 · branch LAN 1 · SW1R2 Et0/1 192.168.9.1no other device yet
- 192.168.9.192/27 · branch LAN 3 · SW2R4 Et0/1 192.168.9.193no other device yet
Device icons joined by plain cables, each cable labeled with its subnet. Down the middle, top to bottom: R3, a router; R1, the HQ router; R2, the branch router; R4, a branch router; and the switch SW2. R3 is cabled to R1 (192.168.8.64/26), R1 to R2 (192.168.9.224/30), R2 to R4 (192.168.9.228/31) and R4 to SW2 (192.168.9.192/27). At the upper left, the host H1, a laptop, is cabled down from its base to R1 (192.168.8.0/26). Left of R2, the switch SW1 is cabled across to it (192.168.9.0/25).
What summarization is
One route for many networks
R4 sends everything for HQ and for branch LAN 1 to R2. Does it need a separate route for each of those networks?
Not if one route covers them all. R4’s own subnets, branch LAN 3 and its link to R2, are connected. To reach any other network, a router needs a route in its routing table that covers it, one whose block holds all of that network’s addresses.
With one route per network, R4 would need a line for HQ’s LAN A, one for LAN B, one for branch LAN 1, one for the link from R1 to R2, and one more for every LAN built later.
Summarization replaces such a list with one route that covers every network in it and has a shorter prefix length than any of them, and that one route is a summary route.
RFC 4632, which describes classless addressing (CIDR), says when this works. When the networks together fill one block whose size is a power of two, one prefix may stand for all of them.
One route, 192.168.8.0/23, does the work of that whole list (Figure 5.1).
R1, the HQ router, at the top; under it R2, the branch router, joined to it by a cable labeled 192.168.9.224/30; under R2, R4, a branch router, joined to R2 by a cable labeled 192.168.9.228/31, each label right of its cable. Left of the lower cable a separate highlighted arrow points from R4 up toward R2, labeled “one route: 192.168.8.0/23”. Left of R4, under R2, a list headed “without a summary:”: 192.168.8.0/26, 192.168.8.64/26, 192.168.9.0/25 and an ellipsis.
But R4’s own two subnets lie inside 192.168.8.0/23 too. Which route does it use for them? Its connected routes, because when several routes match an address, the router uses the one with the longest prefix, the one that matches the most leading bits of the address.
A summary covers every address in its block, built or not, so R4’s summary also covers HQ’s planned LAN C and LAN D and the branch’s planned LAN 2.
The address in a summary marks only where its block starts; the prefix length says how far the block reaches. 192.168.8.0/23 starts at the address of 192.168.8.0/24, and its /23 reaches on through 192.168.9.0/24.
Key idea
One summary route can stand for many networks when they fill one block.
How it works
Finding the summary
The bits the networks share
HQ is 192.168.8.0/24 and the branch is 192.168.9.0/24. How do you find the one prefix that covers both, and nothing more?
Every address in a block starts with the same bits, as many as the prefix length. The smallest summary’s prefix length is the number of leading bits that all its networks share.
To find it, write the octet where the networks differ in binary and count the bits that match from the left, up to the first that differs, adding eight for each whole octet before it. Setting every bit after them to zero gives the address where the summary’s block starts.
So compare 8 and 9, the third octets, bit by bit (Figure 5.2). The first two octets, 192.168, match.
Step 1 of 7
HQ is 192.168.8.0/24 and the branch 192.168.9.0/24. Their first two octets match, and the third is 8 in one and 9 in the other.
Step 2 of 7
Write both third octets in binary, as eight bits: 8 is 00001000 and 9 is 00001001. Then compare them bit by bit, from the left.
How many leading bits of the third octet do 8 and 9 share?
- 7 (Correct): 8 is 00001000 and 9 is 00001001: the first 7 bits are the same, and the last one differs.
- All eight: The last bit differs: 0 in 8, 1 in 9. Two numbers next to each other always differ in their last bit.
- 23: That is the summary’s whole prefix: the 16 bits of the first two octets plus the bits shared in the third. The question asks only about the third octet.
Step 3 of 7
The first 7 bits match. The last bit differs: 0 in 8, 1 in 9. The summary keeps only the bits that both share.
Step 4 of 7
Count from the left: the 16 bits of the first two octets, plus 7. The summary’s prefix is /23. With the bit after them set to zero, it starts at 8, here the first network: 192.168.8.0/23.
Step 5 of 7
As a mask, the first 23 bits are ones: 255.255.254.0. Its third octet, 254, is 7 ones and a zero.
Step 6 of 7
The /23 block holds 512 addresses: the two /24 blocks and nothing more. This summary is exact.
Step 7 of 7
R4 needs one route for HQ and branch LAN 1: 192.168.8.0/23, toward R2.
At the top, “third octet”. Under it two rows of eight bit cells: the row for 8 reads 00001000, the row for 9 reads 00001001. From step 3, a line under the first 7 cells of both rows, labeled “7 bits match”, and a short line under the last cell, labeled “differs”. From step 4, the line “16 + 7 bits: 192.168.8.0/23”; from step 5, “mask 255.255.254.0”. Under them two bars side by side, HQ’s 192.168.8.0/24 and the branch’s 192.168.9.0/24, each with “HQ” or “branch” under it; from step 6 an outline around both, labeled “192.168.8.0/23 · 512 addresses”. At step 7, a card at the foot: “R4 · one route: 192.168.8.0/23”.
Count the shared bits before the next step shows them.
A summary is exact only when its networks fill its block, as HQ and the branch fill the /23. LAN A and LAN C, for example, share only the bits of 192.168.8. Their smallest summary is HQ’s whole 192.168.8.0/24, which also covers LAN B and LAN D.
Now find one yourself, for two networks that split one block in half.
The first steps are done; choose the last one.
Key idea
Find the octet where the networks differ, count the bits they share from the left, and set the bits after them to zero: that is where the summary starts.
Watch it on R4
R4 holds this summary. Which route does it use for an address in HQ, and does a test through it get answers?
Ask R4 which route it uses for 192.168.8.70, an address in HQ’s LAN B:
R4 uses its summary for this HQ address and sends packets for it to R2.
R4#show ip route 192.168.8.701Routing entry for 192.168.8.0/23, supernet2 Known via "static", distance 1, metric 0 Routing Descriptor Blocks:3 * 192.168.9.228 Route metric is 0, traffic share count is 1
- The route R4 uses for this address:
192.168.8.0/23, the summary. IOS marks itsupernet: its prefix, /23, is shorter than /24, so the one route covers two /24 blocks, 192.168.8.0/24 and 192.168.9.0/24. RFC 1519 calls a route for such a block of networks a “supernet” route. Known via "static": the route was typed by hand.- The next hop, 192.168.9.228: R2’s end of their link.
On R4, a test of R3’s address in HQ, 192.168.8.126:
192.168.8.126 is in LAN B, inside the summary’s block, so these tests leave R4 by the summary too.
R4#ping 192.168.8.126Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.8.126, timeout is 2 seconds:1!!!!!2Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/2 ms
- Five exclamation marks: five replies.
Success rate is 100 percent, five of five.