BGP Local-AS  -  Overview

The 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-number
neighbor 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 diagramBGP LOCAL-AS CONCEPT
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:

BGP Local-AS - Scenario1

“local-as  xxx” command

router bgp 100
neighbor remote-as 300
neighbor 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
 *>                                                         0                   200 100 i
 *>                 0                                    0                    200 100 i
 *>                    0                                  32768               i

R1#show ip bgp
     Network                Next Hop             Metric       LocPrf         Weight            Path
*>                      0                                  32768                i
r>i                       0               100                0                     i
*>i                     0               100                0                   200 300    i


“local-as  xxx  no-prepend” command.

R2(config)#router bgp 100
R2(config-router)#neighbor local-as 200 no-prepend

Below are the outputs from R1 now:

R1#show ip bgp | i
 *>i                 0    100      0        300 i

You will not see AS 100 in AS Path for R3’s prefix on R1.

But, we’ll see not difference in output of R3 for R1’s prefix  The output of R3 will be same as given in Scenario1.


“local-as xxx  no-prepend replace-as” command.

R2(config-router)#neighbor local-as 200 no-prepend replace-as

With “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 ( and R2’s prefixes (, on R3.

R3#show ip bgp
     Network          Next Hop            Metric                 LocPrf      Weight         Path
 *>                                                                0               200 i
 *>                 0                                             0               200 i
 *>                   0                                          32768             i

Reference Commands:

show ip bgp neighbor x.x.x.x
show ip bgp peer-group peer group name

R2# show ip bgp neighbors
BGP neighbor is,  remote AS 300,  local AS 200, external link
BGP version 4, remote router ID
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 is received with AS PATH 200, 100.

 R3# debug ip bgp updates

*July 22 11:35:15.153: BGP(0): rcvd UPDATE w/ attr: nexthop9.9.23.2, origin i, metric 0, path 200 100

Click Here for other useful BGP articles