IP Addresses & Routing

Route Summarization and Supernetting

Combine many routes into one shorter prefix, check alignment with simple arithmetic and avoid black holes and overreach.

Key takeaways

  • A summary is a shorter prefix that covers several longer ones, so other routers store and process fewer entries.
  • Blocks combine exactly when their number is a power of two and the first one starts on a multiple of the combined size.
  • A summary that covers more than you own can attract traffic you cannot deliver.
  • Hierarchical address planning makes summarization easy, while scattered allocation makes it nearly impossible.

Route summarization replaces several specific routes with one broader route that covers them. Instead of advertising 192.168.0.0/24, 192.168.1.0/24, 192.168.2.0/24 and 192.168.3.0/24, a router can advertise 192.168.0.0/22 and say, in effect, "send all of that to me".

Supernetting is the same arithmetic seen from the addressing side: joining contiguous blocks into a larger one with a shorter prefix. Both depend on one condition, that the blocks line up on a binary boundary.

Why bother

Every route costs memory and processing. More important, every change to a specific route has to be told to everyone who knows it. If a single flapping access link in a branch office causes updates across the whole company, that is noise you could have contained.

A summary hides detail. Routers far away need only to know the general direction. Routers nearby keep the specifics. On the public internet this idea, enabled by CIDR, helps keep the global routing table from growing even faster than it does.

One summary stands in for four branch routes
Summary 10.1.0.0/22 All the rest of the network needs to know. 10.1.3.0/24 Wireless guests 10.1.2.0/24 Servers 10.1.0.0/24 Staff floor 10.1.1.0/24 Voice Summary 10.1.0.0/22 All the rest of the network needs to know. 10.1.0.0/24 Staff floor 10.1.1.0/24 Voice 10.1.2.0/24 Servers 10.1.3.0/24 Wireless guests

Finding a summary by looking at bits

Take the four third-octet values 0, 1, 2 and 3 from 10.1.0.0/24 through 10.1.3.0/24:

0 = 000000 00
1 = 000000 01
2 = 000000 10
3 = 000000 11
    ------        first six bits identical

The addresses share the first two octets (16 bits) plus six bits of the third, for 22 shared bits. The summary is 10.1.0.0/22. The two bits that differ take all four possible combinations, so the summary covers these four networks and nothing else.

The quick arithmetic test

You can skip the binary with two checks:

  1. Is the count a power of two? 2, 4, 8, 16 and so on.
  2. Is the first block's number divisible by that count?

If both pass and the blocks are contiguous, they form one summary. Shorten the prefix by one for each doubling: 2 blocks shorten it by 1, 4 by 2, 8 by 3, 16 by 4.

Example: 10.1.16.0/24 through 10.1.31.0/24. That is 16 blocks, and 16 is divisible by 16. The summary is 10.1.16.0/20.

Counterexample: 192.168.1.0/24 through 192.168.4.0/24. Four blocks, but 1 is not divisible by 4. They do not form a single /22. The tightest exact answer is three routes:

Route Covers third octet
192.168.1.0/24 1
192.168.2.0/23 2 and 3
192.168.4.0/24 4

A 192.168.0.0/21 would cover all four, along with 0, 5, 6 and 7, which may belong to someone else.

Can these blocks become one summary?
Do the blocks have gaps between them? YES Summarize each contiguous run separately. 1 NO Is the number of blocks not a power of two? YES Split into groups whose sizes are powers of two. 2 NO Is the first block misaligned for the group size? YES Use smaller summaries starting on valid boundaries. 3 NO One exact summary Shorten the prefix by one bit per doubling. Do the blocks have gaps between them? 1 IF YES Summarize each contiguous run separately. NO Is the number of blocks not a power of two? 2 IF YES Split into groups whose sizes are powers of two. NO Is the first block misaligned for the group size? 3 IF YES Use smaller summaries starting on valid boundaries. NO One exact summary Shorten the prefix by one bit per doubling.

Finding the summary for any set

Sometimes you want the smallest single prefix that covers a list, even if it includes extra space. Take the lowest and highest addresses in the list and count how many leading bits they share.

For 10.4.5.0/24 and 10.4.14.0/24, the lowest address is 10.4.5.0 and the highest is 10.4.14.255. In the third octet:

 5 = 0000 0101
14 = 0000 1110
     ^^^^        four shared bits

Sixteen bits from the first two octets plus four shared bits make /20. The covering prefix is 10.4.0.0/20, which spans third octets 0 to 15. It includes your two networks and fourteen others.

Whether that is acceptable depends on who owns the other fourteen. Inside one site where they are all yours, it is often fine. Toward another organization or the public internet, announcing space you do not hold is an error that filtering should catch and that can disrupt others.

Blocks of mixed sizes

The inputs do not need to be equal. 172.16.8.0/23, 172.16.10.0/24 and 172.16.11.0/24 cover third-octet values 8 through 11, which is four consecutive /24 blocks starting at a multiple of four. The summary is 172.16.8.0/22.

For long lists, work in passes: remove entries already contained in others, merge pairs that share a parent, and repeat until nothing merges. The range to CIDR tool and the CIDR set algebra tool can check your result.

Longest prefix match makes exceptions possible

A router with overlapping routes uses the most specific one. This lets you advertise a summary and still steer part of it elsewhere. If the rest of the network learns 10.1.0.0/22 toward site A and 10.1.2.0/24 toward site B, traffic for 10.1.2.x goes to B and everything else in the range goes to A.

That is useful during a migration, and risky when it accumulates. A pile of exceptions erodes the benefit of summarizing and surprises whoever troubleshoots next. How routers decide where to send a packet describes the full selection process.

The black hole and the loop

A summary promises reachability for every address in it, including addresses with no subnet behind them. Suppose a branch advertises 10.1.0.0/22 but 10.1.3.0/24 does not exist, and the branch router has a default route back to headquarters. A packet for 10.1.3.9 arrives at the branch, matches nothing specific, follows the default back to headquarters, matches the summary and returns. It bounces until its hop limit runs out, as TTL and hop limits explains.

The standard defense is a discard route on the summarizing router: a static route for the summary pointing to a null interface. Specific subnets are longer prefixes and still win. Anything unused matches the discard route and is dropped at once. Many routing protocols add this automatically when you configure a summary. Verify it in the routing table.

On a Cisco-style command line, a manual version looks like this:

ip route 10.1.0.0 255.255.252.0 Null0

Summarizing IPv6 routes

The same logic applies to IPv6, with hex digits making alignment easier to see. The sixteen networks 2001:db8:40:10::/64 through 2001:db8:40:1f::/64 share everything but the last digit, so they summarize to 2001:db8:40:10::/60.

Four networks ending :20::, :21::, :22:: and :23:: summarize to 2001:db8:40:20::/62. The four starting at :21:: do not, for the same alignment reason as in IPv4: one is not divisible by four.

Because IPv6 sites usually receive a large block at once, summarizing a whole site is often free. A site holding a /48 is one route to the rest of the organization no matter how many /64 networks it creates inside. IPv6 subnetting shows how to lay those digits out.

A discard route is just as useful here. Most of a /48 is empty, and traffic for unused parts should be dropped at the site router instead of being sent back upstream.

Reading summaries in a routing table

When you look at a router, a summary appears like any other route: a prefix and a next hop. To see what it means for a particular address, ask for the best route to that address, not for the list. On Linux, ip route get 10.1.3.9 shows which entry wins. If the answer is the broad route when you expected a specific one, the specific route is missing, either because the subnet is down or because it was never advertised.

Where to configure it

Protocols summarize at particular points. In OSPF, summaries are configured on routers that border areas or that import external routes, not at arbitrary places inside an area. Distance vector protocols can generally summarize per interface. In BGP, an aggregate is configured on the router and can optionally suppress the more specific routes. The commands vary by vendor, so work from your platform's documentation.

Static routing can use summaries too. One static route for 10.1.0.0/22 on the headquarters router is easier to maintain than four.

A worked migration

Say a company has headquarters and one branch. The branch uses 10.1.0.0/24 to 10.1.3.0/24, and headquarters holds four static routes. You want to replace them with one.

  1. Confirm no other site uses anything in 10.1.0.0/22.
  2. On the branch router, add the discard route for the summary and check that the four specific subnets still appear as connected routes.
  3. On the headquarters router, add the route for 10.1.0.0/22 toward the branch. The old, longer routes still take priority, so nothing changes yet.
  4. Test the summary entry is present, then remove the four old routes one at a time, testing after each.
  5. Update documentation and any firewall rules that listed the four networks separately.
Replacing four routes with one, safely
1 Verify ownership Nothing else lives inside the summary range. 2 Add discard route Unused addresses are dropped at the branch. 3 Add the summary Existing specific routes still win for now. 4 Remove old routes One at a time, testing each step. Verify ownership Nothing else lives inside the summary range. 1 Add discard route Unused addresses are dropped at the branch. 2 Add the summary Existing specific routes still win for now. 3 Remove old routes One at a time, testing each step. 4

The order matters because longest prefix match lets old and new coexist. At no point is a destination left without a route.

Trade-offs

Summaries are not free.

  • Less detail, less precision. If one subnet behind a summary fails, remote routers keep sending traffic toward it.
  • Suboptimal paths. A site with two entrances may receive traffic through the farther one if only the summary is advertised.
  • Attracting unintended traffic. An overly broad summary can pull in addresses used elsewhere.
  • Harder debugging. The route you see far away does not show which specific networks exist.

On the public internet, networks sometimes deliberately announce more specific routes alongside an aggregate to steer inbound traffic. That adds to everyone's table, which is a standing tension in BGP operations.

Plan addresses so summaries happen

The best time to enable summarization is when you assign addresses. Give each site or region an aligned block, larger than it needs today, and carve its subnets inside. For example:

Region Block Room for
North 10.16.0.0/12 16 sites with a /16 each
South 10.32.0.0/12 16 sites with a /16 each
West 10.48.0.0/12 16 sites with a /16 each

Each region can be described to the others with one route. The same idea applies to IPv6, where the large address space makes generous hierarchical blocks even easier.

Check your work

Before deploying a summary, answer four questions. What is its first and last address? Which of the covered subnets exist? Does any address inside it live somewhere else without a more specific route? Is there a discard route for the unused parts? If you can answer all four, the summary is unlikely to surprise you.

Written for 4Internet with AI writing tools and not reviewed line by line by a person. Check anything you rely on with the maker, provider or standard concerned. Report an error.

Keep reading

All 45 articles in IP Addresses & Routing →

Latest news on this topic