Problem
You want to summarize your routing table before forwarding it to another router.
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 65500 Router1(config-router)#neighbor 192.168.1.5 remote-as 65520 Router1(config-router)#auto-summary Router1(config-router)#exit Router1(config)#end Router1#
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 the most useful prefix on which to summarize your networks. The second problem is that autosummarization only works on routes that are redistributed into BGP, and not on routes from BGP or routes 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 nonclassful 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.
In the network shown in Figure 9-3, 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
Figure 9-3. Route aggregation example
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 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 ? Router3#
Then, in downstream ASs 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 *> 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 *> 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 or not you use the summary-only keyword:
Router4#show ip bgp 172.20.0.0 % Network not in table Router4#
There is a problem with doing route summarization because it 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.
Eventually Router3 will 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 ASs, although it doesn't show their order. 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 *> 172.20.0.0/14 172.25.1.6 0 65530 {65501,65502} ? Router4#
And 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.
Ideally, 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). So 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, then we could easily wind up with a routing loop.
If you intend to summarize, make sure you can vouch for all the subnets you are summarizing. This is true regardless of the techniques you use.
See Also
Recipe 9.11; Recipe 9.14
Router Configuration and File Management
Router Management
User Access and Privilege Levels
TACACS+
IP Routing
RIP
EIGRP
OSPF
BGP
Frame Relay
Handling Queuing and Congestion
Tunnels and VPNs
Dial Backup
NTP and Time
DLSw
Router Interfaces and Media
Simple Network Management Protocol
Logging
Access-Lists
DHCP
NAT
First Hop Redundancy Protocols
IP Multicast
IP Mobility
IPv6
MPLS
Security
Appendix 1. External Software Packages
Appendix 2. IP Precedence, TOS, and DSCP Classifications
Index