Rarely used feature, but it might come in handy.

In the following scenario a service provider AS 1 has a customer which is using a private AS 65000 within his network. The customer has just received their own AS number and they are planning to migrate from the private one. Theirs intention is to introduce the new AS gradually and keep the old peerings with the private AS up and running during the migration.
What a customer needs is a feature that will allow a router to replace their own AS number with another one in the eBGP updates.
Here is an example:
multihop_ebgp_2nd-AS

To assure a smooth transition, AS 1 and AS 65000 configure two parallel BGP sessions. Because same routers are being used for the second session, new pair of interfaces is introduced. Configuration for R1 is nothing special:

hostname r1
!
interface Loopback0
 ipv6 address 2001:DB8:1::/128
!
interface Loopback1
 ipv6 address 2001:DB8:1::1/128
!
router bgp 1
 address-family ipv6
  ! old session
  neighbor 2001:DB8:2::23:1 remote-as 65000
  neighbor 2001:DB8:2::23:1 ebgp-multihop 2
  neighbor 2001:DB8:2::23:1 update-source Loopback0
  ! new session
  neighbor 2001:DB8:3:: remote-as 333
  neighbor 2001:DB8:3:: ebgp-multihop 2
  neighbor 2001:DB8:3:: update-source Loopback1
  ! this is announced from AS 1
  network 2001:DB8:1::/48
!

On the customer side, R3 is configured with the “local-as” feature:

hostname r3
!
interface Loopback0
! this will be used for source in the new BGP session
 ipv6 address 2001:DB8:3::/128
!
interface GigabitEthernet0/0
 ipv6 address 2001:DB8:2::23:1/127
!
router bgp 65000
 address-family ipv6
  ! old session
  neighbor 2001:DB8:1:: remote-as 1
  neighbor 2001:DB8:1:: ebgp-multihop 2
  neighbor 2001:DB8:1:: update-source GigabitEthernet0/0
  ! new session for AS 333
  neighbor 2001:DB8:1::1 remote-as 1
  neighbor 2001:DB8:1::1 local-as 333 no-prepend replace-as
  neighbor 2001:DB8:1::1 ebgp-multihop 2
  neighbor 2001:DB8:1::1 update-source Loopback0
  ! this is announced from AS 65000/333
  network 2001:DB8:3::/48
!
! routes for R1
ipv6 route 2001:DB8:1::/128 2001:DB8:2::23:0
ipv6 route 2001:DB8:1::1/128 2001:DB8:2::23:0

You will find a very concise explanation of this feature in this ipSpace blog post by Ivan Pepelnjak with the two key points:

  • no-prepend disables local-as prepending on incoming eBGP updates;
  • replace-as replaces router’s own AS with local-as on outgoing eBGP updates.

Here is how the AS_PATH for the announced prefixes would be without these two keywords:

! R3 is configured without no-prepend replace-as
R1#sh bgp ipv6 unicast 2001:DB8:3::/48
BGP routing table entry for 2001:DB8:3::/48, version 7
Paths: (1 available, best #1, table default)
  Advertised to update-groups:
     2
  333 65000
    2001:DB8:3:: (metric 2) from 2001:DB8:3:: (3.3.3.3)
      Origin IGP, metric 0, localpref 100, valid, external, best

R3#show bgp ipv6 unicast 2001:DB8:1::/48
BGP routing table entry for 2001:DB8:1::/48, version 10
Paths: (1 available, best #1, table default)
  Not advertised to any peer
  333 1
    2001:DB8:1::1 from 2001:DB8:1::1 (1.1.1.1)
      Origin IGP, metric 0, localpref 100, valid, external, best

AS 333 (local-as) is added to both, the announced 2001:db8:3::/48 from R3 and the received 2001:db8:1::/48 from R1. With the no-prepend option nothing will change for R1, but R3 will not prepended AS 333 to the announcement from R1 (note that AS_PATH toward 2001:db8:1::/48 changed from “333 1” to “1”):

R3#show bgp ipv6 unicast 2001:DB8:1::/48
BGP routing table entry for 2001:DB8:1::/48, version 16
Paths: (1 available, best #1, table default)
  Not advertised to any peer
  1
    2001:DB8:1::1 from 2001:DB8:1::1 (1.1.1.1)
      Origin IGP, metric 0, localpref 100, valid, external, best

The replace-as option has the effect on R1. AS_PATH for 2001:db8:3::/48 is changed from “333 65000” to “333” as expected:

R1#sh bgp ipv6 unicast 2001:DB8:3::/48
BGP routing table entry for 2001:DB8:3::/48, version 11
Paths: (1 available, best #1, table default)
Flag: 0x820
  Advertised to update-groups:
     2
  333
    2001:DB8:3:: (metric 2) from 2001:DB8:3:: (3.3.3.3)
      Origin IGP, metric 0, localpref 100, valid, external, best

The “local-as” feature has another option – dual-as. This option enables the router configured with the “local-as” to established the eBGP peering session using its own real AS or by using the local one. During the establishment process, the AS number used in the open message alternates between the local AS and the global AS. With Juniper routers this behaviour is configured with the alias option.


Google within Cisco for “BGP Support for Dual AS Configuration for Network AS Migrations” or check for the same functionality in Junos OS.

Advertisements