Description :

Il est parfois intéressant de changer son AS vis-à-vis d'un voisin eBGP.

Architecture du lab :

BGP lab localas

R1 va se présenter à R3 en AS 11 au lieu de l'AS 1.

Configurations :

R1

1 router bgp 1
2  no synchronization
3  bgp router-id 1.1.1.1
4  bgp log-neighbor-changes
5  network 192.168.0.0
6  neighbor 10.1.2.2 remote-as 2
7  neighbor 10.1.3.3 remote-as 3
8  neighbor 10.1.3.3 local-as 11
9  no auto-summary

R2

1 router bgp 2
2  no synchronization
3  bgp router-id 2.2.2.2
4  bgp log-neighbor-changes
5  neighbor 10.1.2.1 remote-as 1
6  no auto-summary

R3

1 router bgp 3
2  no synchronization
3  bgp router-id 3.3.3.3
4  bgp log-neighbor-changes
5  neighbor 10.1.3.1 remote-as 11
6  no auto-summary

Table de routage

R2

1 R2#sh  ip bgp
2 BGP table version is 2, local router ID is 2.2.2.2
3 Status codes: s suppressed, d damped, h history,  valid, > best, i - internal,
4               r RIB-failure, S Stale
5 Origin codes: i - IGP, e - EGP, ? - incomplete
6 
7    Network          Next Hop            Metric LocPrf Weight Path
8 > 192.168.0.0      10.1.2.1                 0             0 1 i

R3

1 R3#sh ip bgp
2 BGP table version is 2, local router ID is 3.3.3.3
3 Status codes: s suppressed, d damped, h history,  valid, > best, i - internal,
4               r RIB-failure, S Stale
5 Origin codes: i - IGP, e - EGP, ? - incomplete
6 
7    Network          Next Hop            Metric LocPrf Weight Path
8 > 192.168.0.0      10.1.3.1                 0             0 11 1 i

On voit que R1 annonce aussi par défaut l'AS d'origine.
Si l'on complétement dissimuler l'AS d'origine, il faut ajouter no-prepend replace-as à la commande local-as

Modifications de configuration :

R1

1 router bgp 1
2  no synchronization
3  bgp router-id 1.1.1.1
4  bgp log-neighbor-changes
5  network 192.168.0.0
6  neighbor 10.1.2.2 remote-as 2
7  neighbor 10.1.3.3 remote-as 3
8  neighbor 10.1.3.3 local-as 11 no-prepend replace-as
9  no auto-summary

A noter que le peering R1-R3 va être renégocier.

Table de routage R3

1 R3#sh ip bgp
2 BGP table version is 14, local router ID is 3.3.3.3
3 Status codes: s suppressed, d damped, h history,  valid, > best, i - internal,
4               r RIB-failure, S Stale
5 Origin codes: i - IGP, e - EGP, ? - incomplete
6 
7    Network          Next Hop            Metric LocPrf Weight Path
8 > 192.168.0.0      10.1.3.1                 0             0 11 i

Bonus :

On peut aussi ajouter dual-as à la commande local-as 11 no-prepend replace-as dual-as, cela permet à R3 de monter un peering sur l'AS d'origine (AS 1) ou celle définie par local-as (AS 11).

Mais qu'une à la fois.

Configuration de R1 :

1 router bgp 1
2  no synchronization
3  bgp router-id 1.1.1.1
4  bgp log-neighbor-changes
5  network 192.168.0.0
6  neighbor 10.1.2.2 remote-as 2
7  neighbor 10.1.3.3 remote-as 3
8  neighbor 10.1.3.3 local-as 11 no-prepend replace-as dual-as
9  no auto-summary

Table de routage R3 avec une config de peering sur AS 11 (neighbor 10.1.3.1 remote-as 11) :

1 R3#sh ip bgp
2 BGP table version is 20, local router ID is 3.3.3.3
3 Status codes: s suppressed, d damped, h history,  valid, > best, i - internal,
4               r RIB-failure, S Stale
5 Origin codes: i - IGP, e - EGP, ? - incomplete
6 
7    Network          Next Hop            Metric LocPrf Weight Path
8 > 192.168.0.0      10.1.3.1                 0             0 11 i

Table de routage R3 avec une config de peering sur AS 1 (neighbor 10.1.3.1 remote-as 1) :

1 R3#sh ip bgp
2 BGP table version is 22, local router ID is 3.3.3.3
3 Status codes: s suppressed, d damped, h history,  valid, > best, i - internal,
4               r RIB-failure, S Stale
5 Origin codes: i - IGP, e - EGP, ? - incomplete
6 
7    Network          Next Hop            Metric LocPrf Weight Path
8 > 192.168.0.0      10.1.3.1                 0             0 1 i