Aggregation and Deaggregation
Aggregation of prefix information reduces the number of entries BGP has to carry and store. There are two common ways prefixes can be aggregated in BGP:
Using the network command to enter an aggregate address and a static route to Null0
Using the aggregate-address command to create an aggregate
Because the first method is straightforward, this section focuses on the second methodusing the aggregate-address command. Here is the full command with its various options:
aggregate-address address mask [as-set] [summary-only] [suppress-map map1] [advertise-map map2] [attribute-map map3]
The creation of an aggregate in the BGP RIB is dependent on the existence of at least one component route in the local BGP RIB. Without any options specified, BGP attributes of the individual components are not included in the aggregate. The aggregate prefix has the following default attributes:
AS_PATHi (blank AS_PATH; origin code IGP)
ATOMIC_AGGREGATETagged to the aggregate
By default, both the aggregate and its components are advertised. When summary-only is enabled for the aggregate, only the aggregate is advertised, and all the specific component routes are suppressed. The aggregate still maintains the default attributes just listed. If only a subset of the components are to be suppressed, you can define the subset with suppress-map. If a subset of suppressed routes needs to be made available, you can unsuppress those routes on a per-neighbor basis using the neighbor unsuppress-map command.
The option as-set allows AS path loop detection for the aggregate. Additionally, some of the attributes of components are included additively with the aggregate, even if they conflict. For example, if one component prefix has community set to 100:200 and another has it set to no-export, the community of the aggregate is 100:200 and no-export. The aggregate is not advertised to an eBGP peer.
The option attribute-map (a form of route map for setting BGP attributes) is used to clean up the aggregate's attributes. Using the previous community example, if an attribute map resets the community to 100:300, the previous two community values are replaced with 100:300, and the aggregate is advertised to an eBGP peer with 100:300. If only a subset of components are to be used to form the aggregate's attributes, these components can also be defined by an advertise-map. Note that the aggregate's AS_SET is inherited only from the components that are defined in the map.
A common route aggregation practice is to group as large an address space as possible into as few prefix entries as possible. This is desirable in reducing the number of prefixes carried by the Internet, but it's detrimental to adjacent networks that have multiple connections to the aggregating network. One result of aggregation is that routing accuracy of neighbors is lost. In this situation, more-specific routes can be generated to better identify a prefix's address subsets across multiple connections. Deaggregation is a BGP feature that reconstructs components from a received aggregate prefix.
Deaggregation is accomplished by using the conditional injection feature. Conditional injection is the creation of more-specific components when an aggregate exists. These components are injected into the local BGP RIB to provide more-specific routing information in the local AS than the aggregate. These components can be installed in the IP RIB and advertised to other BGP peers within the AS.
Conditional route injection is configured as follows:
bgp inject-map map1 exist-map map2 [copy-attributes]
BGP tracks the prefix (the aggregate) in the exist-map to determine whether to install a prefix or prefixes as specified in the inject-map. The exist-map must have at least two match clauses:
match ip address prefix-list specifies the aggregate based on which to inject more specifics. Only one exact match is allowed.
match ip route-source specifies the neighbor that sent the aggregate. The component inherits the attributes from the aggregate if the option copy-attributes is specified; otherwise, they are treated as locally generated routes for some of the attributes. The NEXT_HOP is always the eBGP peer that originated the aggregate. Additional matches can be made for AS_PATH and community.
Within the inject map, use set ip address prefix-list to define the prefixes to be injected into the local BGP RIB. The injected prefixes can be displayed with the show ip bgp injected-path command.
Figure 4-4 shows a sample topology that takes advantage of conditional injection to achieve deaggregation. Both AS 300 and AS 400 are customers of AS 200 and receive address blocks assigned by AS 200. The prefix block is 172.16.1.0/24 for AS 300 and 172.16.2.0/24 for AS 400. When announcing to AS 100, border routers of AS 200 summarize their address space to a single aggregate, 172.16.0.0/16.
Because AS 100 follows a best-exit policy (sometimes called cold-potato routing), it attempts to optimize its exit points. With a single aggregate, however, traffic destined for AS 300 might be exiting the AS via R3. If more-specific prefixes are available, you can control the traffic flows with better granularity.
Figure 4-4 Example of Conditional Injection
With traffic statistics analysis, AS 100 determines that the best exit for 172.16.1.0/24 is via R2. It is also found that the best exit to 172.16.2.0/24 is via R3. In an effort to optimize the exit points, conditional injection is deployed on R2 and R3. The network address for each link is specified in Figure 4-4, with each router's number as the host address.
Example 4-24 shows a sample BGP configuration on R2. The route map AS200-aggregate matches the incoming aggregate from R4. If the match is positive, create 172.16.1.0/24 in the local BGP RIB. To prevent the injected routes from leaking back out, a community of no-export is set for the injected route. Also, a community of 100:200 is tagged for the route to indicate that it is a locally injected specific from AS 200.
Example 4-24 Sample BGP Configuration on R2
router bgp 100 bgp inject-map AS200-specific exist-map AS200-aggregate neighbor 192.168.12.1 remote-as 100 neighbor 192.168.12.1 send-community neighbor 192.168.23.3 remote-as 100 neighbor 192.168.23.3 send-community neighbor 192.168.24.4 remote-as 200 ! ip bgp-community new-format ip prefix-list AS200-R4 seq 5 permit 192.168.24.4/32 ip prefix-list Aggregate seq 5 permit 172.16.0.0/16 ip prefix-list Specific seq 5 permit 172.16.1.0/24 ! route-map AS200-specific permit 10 set ip address prefix-list Specific set community 100:200 no-export ! route-map AS200-aggregate permit 10 match ip address prefix-list Aggregate match ip route-source AS200-R4
Example 4-25 shows a similar configuration on R3. Another way to inject the specific components is to inject both specifics into routers R2 and R3 simultaneously. A preference can be set for one of the two.
Example 4-25 Sample BGP Configuration on R3
router bgp 100 bgp inject-map AS200-specific exist-map AS200-aggregate neighbor 192.168.13.1 remote-as 100 neighbor 192.168.13.1 send-community neighbor 192.168.23.2 remote-as 100 neighbor 192.168.23.2 send-community neighbor 192.168.35.5 remote-as 200 ! ip bgp-community new-format ip prefix-list AS200-R5 seq 5 permit 192.168.35.5/32 ip prefix-list Aggregate seq 5 permit 172.16.0.0/16 ip prefix-list Specific seq 5 permit 172.16.2.0/24 ! route-map AS200-specific permit 10 set ip address prefix-list Specific set community 100:200 no-export ! route-map AS200-aggregate permit 10 match ip address prefix-list Aggregate match ip route-source AS200-R5
Example 4-26 shows the BGP RIB on R1. Note that the BGP next hops are border routers that announce the aggregate and not the routers that inject the specifics. With the more-specific information, R1 directs traffic to R4 for 172.16.1.0 and to R5 for 172.16.2.0. The aggregate is used for all other traffic to 172.16.0.0.
Example 4-26 BGP RIB on R1
R1#show ip bgp BGP table version is 38, local router ID is 192.168.14.1 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path * i172.16.0.0 192.168.35.5 100 0 200 400 i *>i 192.168.24.4 100 0 200 300 i *>i172.16.1.0/24 192.168.24.4 100 0 ? *>i172.16.2.0/24 192.168.35.5 100 0 ?
Example 4-27 shows the BGP RIB on R2. Note that communities of 100:200 and no-export are attached to the injected prefixes.
Example 4-27 BGP RIB on R2
R2#show ip bgp BGP table version is 34, local router ID is 192.168.24.2 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path * i172.16.0.0 192.168.35.5 100 0 200 400 i *> 192.168.24.4 0 200 300 i *> 172.16.1.0/24 192.168.24.4 0 ? * i 192.168.35.5 0 ? *>i172.16.2.0/24 192.168.35.5 100 0 ? R2#show ip bgp 172.16.1.0 BGP routing table entry for 172.16.1.0/24, version 34 Paths: (2 available, best #1, table Default-IP-Routing-Table, not advertised to EBGP peer) Advertised to non peer-group peers: 192.168.12.1 192.168.23.3 Local, (aggregated by 200 192.168.46.4), (injected path from 172.16.0.0/16) 192.168.24.4 from 192.168.24.4 (192.168.46.4) Origin incomplete, localpref 100, valid, external, best Community: 100:200 no-export Local, (aggregated by 200 192.168.57.5), (injected path from 172.16.0.0/16) 192.168.35.5 (metric 20) from 192.168.23.3 (192.168.35.3) Origin incomplete, localpref 100, valid, internal Community: 100:200 no-export R2#show ip bgp 172.16.2.0 BGP routing table entry for 172.16.2.0/24, version 32 Paths: (1 available, best #1, table Default-IP-Routing-Table, not advertised to EBGP peer) Not advertised to any peer Local, (aggregated by 200 192.168.57.5) 192.168.35.5 (metric 20) from 192.168.23.3 (192.168.35.3) Origin incomplete, localpref 100, valid, internal, best Community: 100:200 no-export
When the link between R2 and R4 is down, the aggregate from R4 is removed. Under this condition, R2 stops the injection of the prefix 172.16.1.0/24. This is shown in the BGP RIB on R1 in Example 4-28. When the link between R3 and R5 is down as well, both 172.16.0.0 and 172.16.2.0 are also removed from AS 100 (not shown).
Example 4-28 BGP RIB on R1 When the Link Between R2 and R4 Is Down
R1#show ip bgp BGP table version is 56, local router ID is 192.168.14.1 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *>i172.16.0.0 192.168.35.5 100 0 200 400 i *>i172.16.2.0/24 192.168.35.5 100 0 200 400 i