Afin de réduire le nombre de prefix annoncé et ainsi d’optimiser les échanges entre AS, il est possible d’agréger un ensemble de sous-réseau.
la première solution consiste à créer une route vers null 0 :
R2#conf t
R2(config)#ip route 2.2.0.0 255.255.252.0 null 0
R2(config)#router bgp 200
R2(config-router)#network 2.2.0.0 mask 255.255.252.0
Cette solution annoncera le prefix de façon inconditionnelle , même si le routage est impossible (interface down ou autre ..) !
aggregate-address
Un solution plus adéquate consiste à utiliser « aggegate-address » dans la configution du router BGP
R2#show ip bgp Network Next Hop Metric LocPrf Weight Path *> 1.0.0.0 10.1.12.1 0 0 100 i *> 2.2.0.0/24 0.0.0.0 0 32768 i *> 2.2.1.0/24 0.0.0.0 0 32768 i *> 2.2.2.0/24 0.0.0.0 0 32768 i *> 2.2.3.0/24 0.0.0.0 0 32768 i
R2#conf t
R2(config)#router bgp 200
R2(config-router)#aggregate-address 2.2.0.0 255.255.252.0
L’agrégation sera annoncé dés la présence d’au moins un sous-réseau
R2#show ip bgp Network Next Hop Metric LocPrf Weight Path *> 1.0.0.0 10.1.12.1 0 0 100 i *> 2.2.0.0/24 0.0.0.0 0 32768 i *> 2.2.0.0/22 0.0.0.0 32768 i *> 2.2.1.0/24 0.0.0.0 0 32768 i *> 2.2.2.0/24 0.0.0.0 0 32768 i *> 2.2.3.0/24 0.0.0.0 0 32768 i
summary-only
Les sous réseaux ne seront plus annoncé de façon individuelle
Seul le prefix agrégé est annoncé
R2#conf t
R2(config)#router bgp 200
R2(config-router)#aggregate-address 2.2.0.0 255.255.252.0 summary-only
R2#show ip bgp Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 1.0.0.0 10.1.12.1 0 0 100 i s> 2.2.0.0/24 0.0.0.0 0 32768 i *> 2.2.0.0/22 0.0.0.0 32768 i s> 2.2.1.0/24 0.0.0.0 0 32768 i s> 2.2.2.0/24 0.0.0.0 0 32768 i s> 2.2.3.0/24 0.0.0.0 0 32768 i
Attributs « aggregator » et « atomic-aggregate »
2 attributs importants sont visibles dans l’annonce agrégée
- « aggregator » qui indique l’AS et l’ID du router qui à effectué l’agrégation
- « atomic-aggregate » qui est positionné par défaut si « as-set » n’est pas mentionné
R2#show ip bgp 2.2.0.0/22 BGP routing table entry for 2.2.0.0/22, version 27 Paths: (1 available, best #1, table Default-IP-Routing-Table) Flag: 0x820 Advertised to update-groups: 1 Local, (aggregated by 200 2.2.3.2) 0.0.0.0 from 0.0.0.0 (2.2.3.2) Origin IGP, localpref 100, weight 32768, valid, aggregated, local, atomic-aggregate, best
« atomic-aggregate » à pour effet de cacher ou supprimer des éléments importants sur l’origine des routes agrégées,
Il est donc vivement conseillé, afin d’éviter du « routing loop », de supprimer « atomic-aggregate » par l’option « as-set »
R2#conf t
R2(config)#router bgp 200
R2(config-router)#aggregate-address 2.2.0.0 255.255.252.0 summary-only as-set
R2#show ip bgp 2.2.0.0/22 BGP routing table entry for 2.2.0.0/22, version 35 Paths: (1 available, best #1, table Default-IP-Routing-Table) Advertised to update-groups: 1 Local, (aggregated by 200 2.2.3.2) 0.0.0.0 from 0.0.0.0 (2.2.3.2) Origin IGP, localpref 100, weight 32768, valid, aggregated, local, best
Filtres & Agrégations
Il parfois nécessaire de mettre en place un filtrage lors de l’agrégation de route
- Lorsque un des sous-réseaux agrégé ne fait pas parti de l’AS
- Les informations de ça provenance font parti des attributs de l’agrégation (avec l’option « as-set »)
R2#show ip bgp Network Next Hop Metric LocPrf Weight Path s> 2.2.0.0/24 0.0.0.0 0 32768 i *> 2.2.0.0/22 0.0.0.0 50 100 32768 300 i s> 2.2.1.0/24 0.0.0.0 0 32768 i s> 2.2.2.0/24 0.0.0.0 0 32768 i s> 2.2.3.0/24 10.1.1.3 0 0 300 i
R2#show ip bgp 2.2.0.0/22 BGP routing table entry for 2.2.0.0/22, version 19 Paths: (1 available, best #1, table Default-IP-Routing-Table) Flag: 0x820 Advertised to update-groups: 1 300, (aggregated by 200 2.2.2.1) 0.0.0.0 from 0.0.0.0 (2.2.2.1) Origin IGP, metric 50, localpref 100, weight 32768, valid, aggregated, local, best
Une Access list de type « as-path » permet d’inclure uniquement les sous-réseaux locaux dans l’agrégation :
ip as-path access-list 1 permit ^$ ! route-map ADV permit 10 match as-path 1 ! router bgp 200 aggregate-address 3.1.0.0 255.255.240.0 as-set summary-only advertise-map ADV
Vérifications:
l’AS 300 ne fait plus parti des attributs
R2#show ip bgp Network Next Hop Metric LocPrf Weight Path s> 2.2.0.0/24 0.0.0.0 0 32768 i *> 2.2.0.0/22 0.0.0.0 50 100 32768 i s> 2.2.1.0/24 0.0.0.0 0 32768 i s> 2.2.2.0/24 0.0.0.0 0 32768 i s> 2.2.3.0/24 10.1.1.3 0 0 300 i R2#show ip bgp 2.2.0.0/22 BGP routing table entry for 2.2.0.0/22, version 9 Paths: (1 available, best #1, table Default-IP-Routing-Table) Advertised to update-groups: 1 Local, (aggregated by 200 2.2.2.1) 0.0.0.0 from 0.0.0.0 (2.2.2.1) Origin IGP, metric 50, localpref 100, weight 32768, valid, aggregated, local, atomic-aggregate, best