BGP local-AS feature


The BGP local-as command has several keywords, this test is trying to clarify how to use them.

According to Cisco documentation, this command is to support Dual AS configuration for network AS migration.
Here we are assuming R2 is ISP and is planing to migrate from AS 200 to AS 2000. R3 is R2's customer, R1 is another ISP where we will check and verify if R2 AS# migration causes problem.


1. local-as without any other keywords.
R2#sh run s bgp
router bgp 200
no synchronization
bgp log-neighbor-changes
neighbor 10.10.12.1 remote-as 100
neighbor 10.10.23.3 remote-as 300
neighbor 10.10.23.3 local-as 2000
no auto-summary
R2#

hmm, got error:

*Mar 1 02:24:26.247: %BGP-3-NOTIFICATION: received from neighbor 10.10.23.3 2/2 (peer in wrong AS) 2 bytes 07D0

looks R2 is using the local-AS command AS# instead of the bgp process AS# to talk to peer R3. Let's change R3 to use remote-as# 2000 for now.

R3#sh run s bgp
router bgp 300
no synchronization
bgp log-neighbor-changes
network 192.168.10.0
neighbor 10.10.23.2 remote-as 2000
no auto-summary
R3#

Then we check the bgp table on both R1 and R3:

R1#sh ip bgp
BGP table version is 9, local router ID is 10.10.12.1
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

*> 10.10.12.0/24 0.0.0.0 0 32768 i
*> 192.168.10.0 10.10.12.2 0 200 2000 300 iR1#

we can see R2 added the new AS number into the path along with existing AS number. This is becasue R2 talk to R1 using AS200 but talk to R3 using AS2000

R3#sh ip bgp
BGP table version is 5, local router ID is 192.168.10.1
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

*> 10.10.12.0/24 10.10.23.2 0 2000 200 100 i
*> 192.168.10.0 0.0.0.0 0 32768 i
R3#

R3 has same output, so both existing and new AS number are prepended into the path. This seems not affect communication between AS 100 and As 300.

R1#ping 192.168.10.1
Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 192.168.10.1, timeout is 2 seconds:!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 28/48/64 ms
R1#

2. Now let's add keyword no-prepend.
R2#sh run s bgp
router bgp 200
no synchronization
bgp log-neighbor-changes
neighbor 10.10.12.1 remote-as 100
neighbor 10.10.23.3 remote-as 300
neighbor 10.10.23.3 local-as 2000 no-prepend
no auto-summary
R2#

Check R1 and R3 again:
R1#sh ip bgp
BGP table version is 11, local router ID is 10.10.12.1
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

*> 10.10.12.0/24 0.0.0.0 0 32768 i
*> 192.168.10.0 10.10.12.2 0 200 300 i
R1#

R3#sh ip bgp
BGP table version is 7, local router ID is 192.168.10.1
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

*> 10.10.12.0/24 10.10.23.2 0 2000 200 100 i
*> 192.168.10.0 0.0.0.0 0 32768 i
R3#

hmm, seems the no-prepend keyword only applied on received routes. This keyword tells the router don't prepend new AS number for routes learned from this neighbor, just keep existing process AS#

3. Add keyword repalce-as
R2#sh run s bgp
router bgp 200
no synchronization
bgp log-neighbor-changes
neighbor 10.10.12.1 remote-as 100
neighbor 10.10.23.3 remote-as 300
neighbor 10.10.23.3 local-as 2000 no-prepend replace-as
no auto-summary
R2#

check R1 and R3

R1#sh ip bgp
BGP table version is 13, local router ID is 10.10.12.1
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

*> 10.10.12.0/24 0.0.0.0 0 32768 i
*> 192.168.10.0 10.10.12.2 0 200 300 iR1#

R3#sh ip bgp
BGP table version is 9, local router ID is 192.168.10.1
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

*> 10.10.12.0/24 10.10.23.2 0 2000 100 i
*> 192.168.10.0 0.0.0.0 0 32768 i
R3#

The replace-as keyword only applied to advertised routes to this neighbor, it replaced the process AS# with local-as command AS#

4. Add the last keyword dual-as

R2 and R3's BGP config:
R2#sh run s bgp
router bgp 200
no synchronization
bgp log-neighbor-changes
neighbor 10.10.12.1 remote-as 100
neighbor 10.10.23.3 remote-as 300
neighbor 10.10.23.3 local-as 2000 no-prepend replace-as dual-as
no auto-summary
R2#

R3#sh run s bgp
router bgp 300
no synchronization
bgp log-neighbor-changes
network 192.168.10.0
neighbor 10.10.23.2 remote-as 2000
no auto-summary
R3#

Then checked, R1 and R3 's BGP table didn't change. Let's change R3's config to set remote-as back to 200.

R3#sh run s bgp
router bgp 300
no synchronization
bgp log-neighbor-changes
network 192.168.10.0
neighbor 10.10.23.2 remote-as 200
no auto-summary
R3#

R1's bgp table didn't change, but R3 changed:

R3#sh ip bgp
BGP table version is 13, local router ID is 192.168.10.1
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
*> 10.10.12.0/24 10.10.23.2 0 200 100 i
*> 192.168.10.0 0.0.0.0 0 32768 i
R3#

So this dual-as keyword allows the neighbor to configure with either old AS or new AS. in anohter word, it tells customer: my AS will be changed, you can use either of them for now, so not in rush, you can change it during your next maintenance window.

Reference:
http://www.cisco.com/en/US/docs/ios/12_3t/12_3t11/feature/guide/gtbgpdas.html

Comments

Popular posts from this blog

Firepower FMC and FTD troubleshooting

ASA IKEv1 VPN troubleshooting Steps and Tips

Firepower 2100/1100 FTD/ASA initial setup, reimage, upgrade.