You can configure BGP with a different local AS number for each EBGP session, which allows BGP to configure a local AS for each EBGP session. Configuring a local AS simulates a virtual AS for the router. The AS paths for the routes from that EBGP peer have the configured
local-asprepended before the peer AS for that session. This is useful if ISP A has acquired another ISP B, but does not want to change the configurations of ISP B's customer routers. ISP B's AS is the AS that is configured as the local AS.
NOTE: If the local AS for the EBGP/IBGP peer is the same as the current AS, do not use the
local-asstatement to specify the local AS number.
To configure a local AS, include the
local-asstatement:local-asautonomous-system<private>;For a list of hierarchy levels at which you can configure this statement, see the statement summary section for this statement.
If you include the
privatekeyword, the local AS is not prepended before the peer AS. This means that the AS paths do not show details of such a configuration, and ISP A's EBGP peers and IBGP peers do not see any difference from before the local AS configuration.Examples: Configuring a Local AS
You can include the
local-asstatement to configure a router to use a different AS number than the one for which the router is configured. The local AS is used in all BGP protocol exchanges with the routers that are configured for simulating a virtual AS.Use the
local-asstatement when ISPs merge and want to preserve a customer's configuration, particularly the AS the customer is configured to peer with. Use thelocal-asstatement to simulate the AS number already in place in customer routers, even if the ISP's router is in a different AS now.
![]()
In Figure 10, Router 1 and Router 2 are in AS 65500, Router 4 is in AS 64513, and Router 3 is in AS 64512. Router 2 uses AS 65001 as its local AS.
Router 2 adds AS 65001 when announcing Router 1's routes to Router 3. Router 3 sees an AS path of 65001 65500 64512 for the prefix 10/8. To prevent Router 2 from adding the virtual AS number in its announcements to other peers, use the
local-asautonomous-systemprivatestatement. Thelocal-asautonomous-systemprivatestatement configures Router 2 to not include the virtual AS number configured inlocal-aswhen announcing Router 1's routes to Router 3. In this case, Router 3 sees an AS path of 65500 64512 for the prefix 10/8.The configuration for each router follows.
On Router 1:routing-options {autonomous-system 65500;}protocols {bgp {group internal-AS65500 {type internal;local-address 10.1.1.1;neighbor 10.1.1.2;}}}On Router 2:routing-options {autonomous-system 65500;}protocols {bgp {group internal-AS65500 {type internal;local-address 10.1.1.2;neighbor 10.1.1.1;}group external-AS64513 {type external;peer-as 64513;neighbor 192.168.1.2;}group external-AS64512 {type external;peer-as 64512;neighbor 192.168.10.2;}}}On Router 3:routing-options {autonomous-system 64512;}protocols {bgp {group external-AS65001 {type external;peer-as 65001;neighbor 192.168.10.1;}}}On Router 4:routing-options {autonomous-system 64513;}protocols {bgp {group external-65500 {peer-as 65500;neighbor 192.168.1.1;}}}