Previous section   Next section

Recipe 9.12 Summarizing Outbound Routing Information

9.12.1 Problem

You want to summarize your routing table before forwarding it to another router.

9.12.2 Solution

BGP includes an automatic summarization feature that is on by default:

Router1#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router1(config)#router bgp 65501
Router1(config-router)#neighbor 172.21.2.1 remote-as 65530
Router1(config-router)#auto-summary
Router1(config-router)#end
Router1#

9.12.3 Discussion

By default, BGP will try to summarize routes. This is not always desirable, though, which is why we have explicitly disabled this feature in many of the examples in this chapter. In fact, many engineers prefer to manually summarize their routing tables because they want to control what gets summarized and what doesn't.

The first problem with auto-summarization is that it is strictly classful. Your AS may not control all of the subnets in a classful network, and even if you do, this may not be a useful prefix to summarize your networks. The second problem is that it only works on routes that are redistributed into BGP, and not on those received from other BGP routers or injected via the network command. Please refer to Recipe 9.14 for more information on redistributing routes into BGP.

Suppose you wanted to summarize several routes to a single non-classful route, or to summarize routes from several downstream BGP networks. You might be tempted to handle this by redistributing a static route for the summary and suppressing the individual routes with a filter. The problem with doing this is that the static route never goes away, even if all of the routes that you are trying to summarize become unreachable.

Cisco gets around this problem by implementing a special aggregate-address command that allows you to do the summarization without needing to manually create some routes and suppress others. Figure 9-3 shows a network using route aggregation.

Figure 9-3. Route aggregation
figs/ccb_0903.gif

Suppose the engineer responsible for AS 65530 wants to summarize the routes he receives from AS 65501 before passing this information along to another AS such as AS 65520. Router1 in AS 65501 advertises the prefixes 172.20.0.0/16 and 172.21.0.0/16, which it learned from Router2 in AS 65502, and adds to it the prefixes 172.22.0.0/16 and 172.23.0.0/16. All of these networks are covered by the aggregate address, 172.20.0.0/14:

Router3(config)#router bgp 65530
Router3(config-router)#aggregate-address 172.20.0.0 255.252.0.0 summary-only

The summary-only keyword here means that BGP will suppress the individual subnets. On the router doing the route aggregation you can see which routes will be suppressed:

Router3#show ip bgp
BGP table version is 29, local router ID is 172.20.100.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
   
   Network          Next Hop            Metric LocPrf Weight Path
<routes deleted for brevity>
s> 172.20.0.0      172.21.2.2               0             0 65501 65502 ?
*> 172.20.0.0/14   0.0.0.0                            32768 i
s> 172.21.0.0      172.21.2.2               0             0 65501 65502 ?
s> 172.22.0.0      172.21.2.2               0             0 65501 ?
s> 172.23.0.0      172.21.2.2               0             0 65501 ?

Then, in downstream ASes, such as AS 65520, there is no indication of the summarized networks:

Router4#show ip bgp
BGP table version is 284, local router ID is 172.27.9.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
   
   Network          Next Hop        Metric LocPrf Weight Path
<routes deleted for brevity>
*> 172.20.0.0/14   172.25.1.6                         0 65530 i
Router4#

If you omit the summary-only keyword, BGP will advertise the summary address as well as the summarized subnets:

Router4#show ip bgp
BGP table version is 284, local router ID is 172.27.9.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
   
   Network          Next Hop        Metric LocPrf Weight Path
<routes deleted for brevity>
*> 172.20.0.0      172.25.1.6                         0 65530 65501 65502 ?
*> 172.20.0.0/14   172.25.1.6                         0 65530 i
*> 172.21.0.0      172.25.1.6                         0 65530 65501 65502 ?
*> 172.22.0.0      172.25.1.6                         0 65530 65501 ?
*> 172.23.0.0      172.25.1.6                         0 65530 65501 ?
Router4#

As long as the router doing the aggregation continues to see any routes that are within the summarized range, it will advertise the summary route. However, if all of the component routes disappear, it will stop advertising the summary. This is true whether you use the summary-only keyword or not:

Router4#show ip bgp 172.20.0.0
% Network not in table

Route summarization inherently discards information. To see why this can cause problems, suppose there was a link between Router1 and Router4. Router4 will advertise the summary route, which does not have Router1's ASN in the AS Path. So Router1 will accept this as a new, distinct route that passes through Router4. If Router1 then loses its route to one of the summarized addresses, say 172.23.0.0/16, it will try to use the summary route, and send packets for this prefix to Router4. Router4 will forward the packets to Router3. If Router3 still has the suppressed route in its BGP table, it will simply forward the packet back to Router1, completing a routing loop.

Router3 will eventually purge the unreachable prefix from its routing table, but in more complex networks, it could take a while for this to happen.

To get around this problem, BGP includes the concept of an AS Set that can be used with route aggregation. An AS Set is a grouping of ASNs in an AS Path. It indicates that the route passed through one or more of the listed ASes. Because the AS Path now contains every ASN, you can again eliminate loops.

You can enable AS Sets with the as-set keyword in the aggregate-address command:

Router3(config)#router bgp 65530
Router3(config-router)#aggregate-address 172.20.0.0 255.255.252.0 as-set summary-only

Then, on a downstream router, the show ip bgp output includes the AS Set and represents it in curly braces:

Router4#show ip bgp
BGP table version is 36, local router ID is 172.25.26.5
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
   
   Network          Next Hop       Metric LocPrf Weight Path
<routes deleted for brevity>
*> 172.20.0.0/14   172.25.1.6                       0 65530 {65501,65502} ?
Router4#

You can see more detail by specifying the route prefix with the show ip bgp command. Note that this output even tells you the BGP router ID of the router that did the aggregation, as well as the ASN that this router resides in:

Router4#show ip bgp 172.20.0.0
BGP routing table entry for 172.20.0.0/14, version 36
Paths: (1 available, best #1, table Default-IP-Routing-Table)
  Not advertised to any peer
  65530 {65501,65502}, (aggregated by 65530 172.20.100.1)
    172.25.1.6 from 172.25.1.6 (172.27.9.1)
      Origin incomplete, localpref 100, valid, external, best
Router4#

You need to be careful with route summarization, particularly when you don't control all of the subnets in the range that you intend to summarize. In our example, suppose we advertised the summary for 172.20.0.0/14 but we didn't know how to route some part of this range, such as 172.21.15.0/24.

In an ideal world, this wouldn't actually matter because the real owner of 172.21.15.0/24 and its subnets would advertise a more precise route than our summary. But this is not a completely ideal world, and sometimes people might filter out the longer masks as a matter of course to reduce their routing tables (as we did in Recipe 9.11). It is entirely possible that our router will be called upon to route packets for a device in 172.21.15.0/24. If our response to this is simply to toss the packet back to our default gateway, we could easily wind up with a routing loop.

If you intend to summarize, make sure that you can vouch for all of the subnets that you are summarizing. This is true regardless of what techniques you use.

9.12.4 See Also

Recipe 9.11; Recipe 9.14


  Previous section   Next section
Top