When an Internet service provider (ISP) acquires a network that belongs to a different autonomous system (AS), there is no seamless method for moving the BGP peers in the acquired network to the AS of the acquiring ISP. The process of configuring the acquired BGP peers with the new AS number can be time-consuming and cumbersome. Moreover, the customers of the acquired network either might not want to or immediately be able to modify their peering arrangements or configuration. During such a transition period, it can be useful to configure BGP peers that have been migrated to the new AS to also use the former AS number in BGP updates. This second AS is called a local AS. The use of a local AS number permits the routers in an acquired network to appear to belong to two ASs: the new AS (the global AS) to which it now physically belongs and the former AS. All routers running BGP must be configured with a global AS by including the autonomous-system number statement at the [edit routing-options] hierarchy level.
The JUNOS Software implementation of the local AS feature supports the following options:
Configuring a local AS that is used in inbound and outbound BGP updates is particularly useful when the customer of an acquired network provider does not want to or is not immediately able to modify its peering arrangements or configuration. For example, ISP A, with an AS of 1000, acquires ISP B, with an AS of 100. ISP B’s customer, ISP C, does not want to change its configuration. After ISP B becomes part of ISP A, a local AS number of 100 is configured for use in EBGP peering sessions with ISP C. This means that the local AS value of 100 is prepended before the global AS value of 1000 in the AS path used to export routes to direct external peers in ISP C.
Configuring a local AS with the alias option is especially useful when you are migrating the routers in an acquired network to the new AS. During the migration process, some routers might be configured with the new AS while others remain configured with the former AS. For example, it is good practice to start by migrating first to the new AS any routers that function as route reflectors. However, as you migrate the router reflector clients incrementally, the route reflector has to peer with routers configured with the former AS as well as routers configured with the new AS. To establish local peering sessions, it can be useful for the BGP peers in the network to be able to use both the local AS and the global AS. At the same time, you want to hide this local AS from external peers and use only the global AS in the AS path when exporting routes to another AS. In such situations, choose the alias option.
The private option is useful for establishing local peering with routers that remain configured with former their AS or with a specific customer that has not yet modified its peering arrangements. The local AS is used to establish the BGP session with the EBGP neighbor but is hidden in the AS path sent to external peers in another AS.
Use the no-prepend-global-as option when you want to strip the global AS number from outbound BGP updates. This option is useful in a virtual private network (VPN) scenario where you want to hide the global AS from the VPN.
![]() |
Note: If the local AS for the EBGP or IBGP peer is the same as the current AS, do not use the local-as statement to specify the local AS number. |
To configure a local AS, include the local-as statement:
- local-as autonomous-system <loops number> <private | alias> no-prepend-global-as;
The local-as statement is supported for BGP at the global, group, and neighbor hierarchy levels.
For autonomous-system, you can specify a number from 1 through 4,294,967,295 in plain-number format. In JUNOS Release 9.1 and later, the range for autonomous system (AS) numbers is extended to provide BGP support for 4-byte AS numbers as defined in RFC 4893, BGP Support for Four-octet AS Number Space. The JUNOS Software continues to support 2-byte AS numbers.
In JUNOS Release 9.3 and later, you can also configure a 4-byte AS number using the AS-dot notation format of two integer values joined by a period: <16-bit high-order value in decimal>.<16-bit low-order value in decimal>. For example, the 4-byte AS number of 65,546 in plain-number format is represented as 1.10 in the AS-dot notation format. You can specify a value from 0.0 through 65535.65535 in AS-dot notation format.
Include the private option so that the local AS is not prepended before the global AS in the AS path sent to external peers. When you specify the private option, the local AS is prepended only in the AS path sent to the EBGP neighbor.
Include the alias option to configure the local AS as an alias to the global AS configured at the [edit routing-options] hierarchy level. When you configure a local AS as an alias, during the establishment of the BGP open session, the AS used in the Open message alternates between the local AS and the global AS. The local AS is prepended to the AS path only when the peering session with an EBGP neighbor is established using that local AS. The local AS is hidden in the AS path sent to any other external peers. Only the global AS is prepended to the AS Path when the BGP session is established using the global AS.
![]() |
Note: The private and alias options are mutually exclusive. You cannot configure both options with the same local-as statement. |
Include the no-prepend-global-as option to have the global AS configured at the [edit routing-options] hierarchy level stripped from the AS path sent to external peers. When you use this option, only the local AS is included in the AS path.
Include the loops number statement to specify the maximum number of times the local AS can appear in an AS Path. For number, specify a value from 1 through 10.
You can include the local-as statement 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.
![]() |
Note: If you configure the local AS values for any BGP group, the detection of routing loops is performed using both the AS and the local AS values for all BGP groups. |
Use the local-as statement when ISPs merge and want to preserve a customer’s configuration, particularly the AS with which the customer is configured to establish a peering relationship. Use the local-as statement to simulate the AS number already in place in customer routers, even if the ISP’s router has moved to a different AS.
Figure 11: Local AS Configuration
In Figure 11, Router 1 and Router 2 are in AS 64496, Router 4 is in AS 64511, and Router 3 is in AS 64510. Router 2 used to belong to AS 64497, which has merged with another network and now belongs to AS 64496. Because Router 3 still peers with Router 2 using its former AS, 64497, Router 2 needs to be configured with a local AS of 64497 to maintain peering with Router 3. Configuring a local AS of 64497 permits Router 2 to add AS 64497 when advertising routes to Router 3. Router 3 sees an AS path of 64497 64496 for the prefix 10/8.
To prevent Router 2 from adding the local AS number in its announcements to other peers, use the local-as 64497 private statement. This statement configures Router 2 to not include the local AS 64497 when announcing routes to Router 1 and to Router 4. In this case, Router 4 sees an AS path of 64496 64510 for the prefix 10.222/16.
The configuration for each router follows.
- On Router 1:
- routing-options {
- autonomous-system 64496;
- }
- protocols {
-
- bgp {
-
- group internal-AS64496 {
- type internal;
- local-address 10.1.1.1;
- neighbor 10.1.1.2;
- }
- }
- }
- On Router 2:
- routing-options {
- autonomous-system 64496;
- }
- protocols {
-
- bgp {
-
- group internal-AS64496 {
- type internal;
- local-address 10.1.1.2;
- neighbor 10.1.1.1;
- }
-
- group external-AS64511 {
- type external;
- peer-as 64511;
- neighbor 192.168.1.2;
- }
-
- group external-AS64510 {
- type external;
- peer-as 64511;
- local-as 64497 private;
- neighbor 192.168.10.2;
- }
- }
- }
- On Router 3:
- routing-options {
- autonomous-system 64510;
- }
- protocols {
-
- bgp {
-
- group external-AS64497 {
- type external;
- peer-as 64497;
- neighbor 192.168.10.1;
- }
- }
- }
- On Router 4:
- routing-options {
- autonomous-system 64511;
- }
- protocols {
-
- bgp {
-
- group externl-64496 {
- peer-as 64496;
- neighbor 192.168.1.1;
- }
- }
- }