BGP LOCAL AS CONCEPT
This blog explains the BGP Local-AS Concept in detail. The BGP Local-AS feature allows a router to appear to be a member of a second autonomous system (AS), in addition to its real AS. This feature can only be used for true eBGP peers. You cannot use this feature for two peers that are members of different confederation sub-ASs.
BGP LOCAL-AS CONCEPT - Command Syntax
neighbor x.x.x.x local-as local-AS-numberneighbor peer-group local-as local-AS-number
Local-AS cannot be customized for individual peers in a peer group. Local-AS cannot have the local BGP protocol AS number or the AS number of the remote peer. The local-as command is valid only if the peer is a true eBGP peer. It does not work for two peers in different sub-ASs in a confederation.
Consider the below diagram
At some point of time say ISP A acquires ISP B, then topology will be like as per below diagram:
Once ISA A has acquired ISP B, we need to change the BGP config (Specifically AS number) on both R2 and R3.
The issue is that R3 doesn’t agree to change its configuration and only wants its neighborship to remain with R2 under AS 200 and not the new AS 100.
To solve this, we can use below config on R2:
The issue is that R3 doesn’t agree to change its configuration and only wants its neighborship to remain with R2 under AS 200 and not the new AS 100.
To solve this, we can use below config on R2:
BGP Local-AS - Scenario1 - “local-as xxx” command
R2#router bgp 100
neighbor 9.9.23.3 remote-as 300
neighbor 9.9.23.3 local-as 200 >>>>>>>>> Neighborship with R3.
Below is the output of BGP table from R3 and R1.
R3#show ip bgp
Network Next Hop Metric LocPrf Weight Path
*> 9.9.0.1/32 9.9.23.2 0 200 100 i
*> 9.9.0.2/32 9.9.23.2 0 0 200 100 i
*> 9.9.0.3/32 0.0.0.0 0 32768 i
R1#show ip bgp
Network Next Hop Metric LocPrf Weight Path
*> 9.9.0.1/32 0.0.0.0 0 32768 i
r>i 9.9.0.2/32 9.9.0.2 0 100 0 i
*>i 9.9.0.3/32 9.9.23.3 0 100 0 200 300 i
R2(config)#router bgp 100
R2(config-router)#neighbor 9.9.23.3 local-as 200 no-prepend
Below are the outputs from R1 now:
R1#show ip bgp | i 9.9.0.3
*>i 9.9.0.3/32 9.9.23.3 0 100 0 300 i
r>i 9.9.0.2/32 9.9.0.2 0 100 0 i
*>i 9.9.0.3/32 9.9.23.3 0 100 0 200 300 i
BGP LOCAL-AS CONCEPT - Scenario 2 - “local-as xxx no-prepend” command.
R2(config)#router bgp 100
R2(config-router)#neighbor 9.9.23.3 local-as 200 no-prepend
Below are the outputs from R1 now:
R1#show ip bgp | i 9.9.0.3
*>i 9.9.0.3/32 9.9.23.3 0 100 0 300 i
You will not see AS 100 in AS Path for R3’s prefix 9.9.0.3/32 on R1.
But, we’ll see not difference in output of R3 for R1’s prefix 9.9.0.1/32. The output of R3 will be same as given in Scenario1.
BGP LOCAL-AS CONCEPT - Scenario 3 - “local-as xxx no-prepend replace-as” command.
R2(config-router)#neighbor 9.9.23.3 local-as 200 no-prepend replace-asWith “replace-as” option, we don’t see any difference in out of R1 (will be same as output given in Scenario 2), but on R3, we will not see AS 100 for R1 (9.9.0.1/32) and R2’s prefixes (9.9.0.2/32), on R3.
R3#show ip bgp
Network Next Hop Metric LocPrf Weight Path
*> 9.9.0.1/32 9.9.23.2 0 200 i
*> 9.9.0.2/32 9.9.23.2 0 0 200 i
*> 9.9.0.3/32 0.0.0.0 0 32768 i
Reference Commands:
show ip bgp neighbor x.x.x.x
show ip bgp peer-group peer group name
show ip bgp peer-group peer group name
R2# show ip bgp neighbors 9.9.23.3
BGP neighbor is 9.9.23.3, remote AS 300, local AS 200, external link
BGP version 4, remote router ID 9.9.0.3
BGP state = Established, up for 00:22:42
BGP neighbor is 9.9.23.3, remote AS 300, local AS 200, external link
BGP version 4, remote router ID 9.9.0.3
BGP state = Established, up for 00:22:42
To troubleshoot, the debug ip bgp updates command displays the received prefixes with its attributes from the neighbor. This output shows that the prefix 9.9.0.1/32 is received with AS PATH 200, 100.
R3# debug ip bgp updates
R3# debug ip bgp updates
*July 22 11:35:15.153: BGP(0): 9.9.23.2 rcvd UPDATE w/ attr: nexthop9.9.23.2, origin i, metric 0, path 200 100