Local As

This scenario demonstrates how to configure local-as feature. This feature allows for BGP sessions to establish using an alternate ASN than the ASN that the BGP process is running on.

Test BGP Local-AS options

Description

In this scenario, DUT1 and DUT2 are configured as BGP peers against DUT0. A route in DUT1 will be exported to DUT2 through DUT0. The option “local-as” is used in DUT0 to establish the BGP connection, as running ASN in DUT0 is different than remote AS configured in DUT1 and DUT2. The AS-Path of the route received in DUT2 will be checked after configure “no-prepend” and “replace-as” options in DUT0.

Scenario

Example 1

Step 1: Clean all the configuration in DUT0:

delete
set system login user admin authentication encrypted-password $6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0

Step 2: Clean all the configuration in DUT1:

delete
set system login user admin authentication encrypted-password $6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0

Step 3: Clean all the configuration in DUT2:

delete
set system login user admin authentication encrypted-password $6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0

Step 4: Set the following configuration in DUT0:

set interfaces ethernet eth0 address 192.168.100.1/24
set interfaces ethernet eth1 address 192.168.200.1/24
set interfaces dummy dum0 address 1.1.1.1/24
set protocols route-map PERMIT rule 1 action permit
set protocols bgp 50 neighbor DUT1 remote-address 192.168.100.2
set protocols bgp 50 neighbor DUT1 remote-as 20
set protocols bgp 50 neighbor DUT1 local-as 10
set protocols bgp 50 neighbor DUT1 route-map import PERMIT
set protocols bgp 50 neighbor DUT2 remote-address 192.168.200.2
set protocols bgp 50 neighbor DUT2 remote-as 30
set protocols bgp 50 neighbor DUT2 local-as 10
set protocols bgp 50 neighbor DUT2 route-map export PERMIT

Step 5: Set the following configuration in DUT1:

set interfaces ethernet eth0 address 192.168.100.2/24
set interfaces dummy dum0 address 1.1.1.1/24
set protocols bgp 20 neighbor DUT0 remote-address 192.168.100.1
set protocols bgp 20 neighbor DUT0 remote-as 10
set protocols bgp 20 neighbor DUT0 route-map export PERMIT
set protocols bgp 20 redistribute connected route-map RED
set protocols route-map PERMIT rule 1 action permit
set protocols route-map RED rule 1 action permit
set protocols route-map RED rule 1 match interface dum0

Step 6: Set the following configuration in DUT2:

set interfaces ethernet eth0 address 192.168.200.2/24
set protocols bgp 30 neighbor DUT0 remote-address 192.168.200.1
set protocols bgp 30 neighbor DUT0 remote-as 10
set protocols bgp 30 neighbor DUT0 route-map import PERMIT
set protocols route-map PERMIT rule 1 action permit

Note

By default, the alternate ASN is added to the AS-Path for routes that are sent and received between peers.

Step 7: Run command protocols bgp show ip at DUT2 and check if output matches the following regular expressions:

\*> 1.1.1.0/24\s+192.168.200.1\s+.\s+10 50 10 20
Show output
BGP table version is 1, local router ID is 192.168.200.2, vrf id 0
Default local pref 100, local AS 30
local address -
Status codes:  s suppressed, d damped, h history, * valid, > best, = multipath,
               i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes:  i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

    Network          Next Hop            Metric LocPrf Weight Path
 *> 1.1.1.0/24       192.168.200.1                          0 10 50 10 20 ?

Displayed  1 routes and 1 total paths

Step 8: Set the following configuration in DUT0:

set protocols bgp 50 neighbor DUT1 local-as 10 no-prepend

Note

The option “no-prepend” is used to stop the alternate ASN from being prepended when receiving routes.

Step 9: Run command protocols bgp show ip at DUT2 and check if output matches the following regular expressions:

\*> 1.1.1.0/24\s+192.168.200.1\s+.\s+10 50 20
Show output
BGP table version is 3, local router ID is 192.168.200.2, vrf id 0
Default local pref 100, local AS 30
local address -
Status codes:  s suppressed, d damped, h history, * valid, > best, = multipath,
               i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes:  i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

    Network          Next Hop            Metric LocPrf Weight Path
 *> 1.1.1.0/24       192.168.200.1                          0 10 50 20 ?

Displayed  1 routes and 1 total paths

Step 10: Set the following configuration in DUT0:

set protocols bgp 50 neighbor DUT2 local-as 10 no-prepend replace-as

Note

The option “replace-as” is used to stop the alternate ASN from being prepended when sending routes.

Step 11: Run command protocols bgp show ip at DUT2 and check if output matches the following regular expressions:

\*> 1.1.1.0/24\s+192.168.200.1\s+.\s+10 20
Show output
BGP table version is 5, local router ID is 192.168.200.2, vrf id 0
Default local pref 100, local AS 30
local address -
Status codes:  s suppressed, d damped, h history, * valid, > best, = multipath,
               i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes:  i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

    Network          Next Hop            Metric LocPrf Weight Path
 *> 1.1.1.0/24       192.168.200.1                          0 10 20 ?

Displayed  1 routes and 1 total paths

Example 2

Step 1: Clean all the configuration in DUT0:

delete
set system login user admin authentication encrypted-password $6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0

Step 2: Clean all the configuration in DUT1:

delete
set system login user admin authentication encrypted-password $6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0

Step 3: Clean all the configuration in DUT2:

delete
set system login user admin authentication encrypted-password $6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0

Step 4: Set the following configuration in DUT0:

set interfaces ethernet eth0 address 192.168.100.1/24
set interfaces ethernet eth1 address 192.168.200.1/24
set interfaces dummy dum0 address 1.1.1.1/24
set protocols route-map PERMIT rule 1 action permit
set protocols bgp 50 peer-group DUT1 remote-as 20
set protocols bgp 50 peer-group DUT1 local-as 10
set protocols bgp 50 peer-group DUT1 listen range 192.168.100.0/24
set protocols bgp 50 peer-group DUT1 route-map import PERMIT
set protocols bgp 50 peer-group DUT2 remote-as 30
set protocols bgp 50 peer-group DUT2 local-as 10
set protocols bgp 50 peer-group DUT2 listen range 192.168.200.0/24
set protocols bgp 50 peer-group DUT2 route-map export PERMIT

Step 5: Set the following configuration in DUT1:

set interfaces ethernet eth0 address 192.168.100.2/24
set interfaces dummy dum0 address 1.1.1.1/24
set protocols bgp 20 neighbor DUT0 remote-address 192.168.100.1
set protocols bgp 20 neighbor DUT0 remote-as 10
set protocols bgp 20 neighbor DUT0 route-map export PERMIT
set protocols bgp 20 redistribute connected route-map RED
set protocols route-map PERMIT rule 1 action permit
set protocols route-map RED rule 1 action permit
set protocols route-map RED rule 1 match interface dum0

Step 6: Set the following configuration in DUT2:

set interfaces ethernet eth0 address 192.168.200.2/24
set protocols bgp 30 neighbor DUT0 remote-address 192.168.200.1
set protocols bgp 30 neighbor DUT0 remote-as 10
set protocols bgp 30 neighbor DUT0 route-map import PERMIT
set protocols route-map PERMIT rule 1 action permit

Note

By default, the alternate ASN is added to the AS-Path for routes that are sent and received between peers.

Step 7: Run command protocols bgp show ip at DUT2 and check if output matches the following regular expressions:

\*> 1.1.1.0/24\s+192.168.200.1\s+.\s+10 50 10 20
Show output
BGP table version is 1, local router ID is 192.168.200.2, vrf id 0
Default local pref 100, local AS 30
local address -
Status codes:  s suppressed, d damped, h history, * valid, > best, = multipath,
               i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes:  i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

    Network          Next Hop            Metric LocPrf Weight Path
 *> 1.1.1.0/24       192.168.200.1                          0 10 50 10 20 ?

Displayed  1 routes and 1 total paths

Step 8: Set the following configuration in DUT0:

set protocols bgp 50 peer-group DUT1 local-as 10 no-prepend

Note

The option “no-prepend” is used to stop the alternate ASN from being prepended when receiving routes.

Step 9: Run command protocols bgp show ip at DUT2 and check if output matches the following regular expressions:

\*> 1.1.1.0/24\s+192.168.200.1\s+.\s+10 50 20
Show output
BGP table version is 3, local router ID is 192.168.200.2, vrf id 0
Default local pref 100, local AS 30
local address -
Status codes:  s suppressed, d damped, h history, * valid, > best, = multipath,
               i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes:  i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

    Network          Next Hop            Metric LocPrf Weight Path
 *> 1.1.1.0/24       192.168.200.1                          0 10 50 20 ?

Displayed  1 routes and 1 total paths

Step 10: Set the following configuration in DUT0:

set protocols bgp 50 peer-group DUT2 local-as 10 no-prepend replace-as

Note

The option “replace-as” is used to stop the alternate ASN from being prepended when sending routes.

Step 11: Run command protocols bgp show ip at DUT2 and check if output matches the following regular expressions:

\*> 1.1.1.0/24\s+192.168.200.1\s+.\s+10 20
Show output
BGP table version is 5, local router ID is 192.168.200.2, vrf id 0
Default local pref 100, local AS 30
local address -
Status codes:  s suppressed, d damped, h history, * valid, > best, = multipath,
               i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes:  i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

    Network          Next Hop            Metric LocPrf Weight Path
 *> 1.1.1.0/24       192.168.200.1                          0 10 20 ?

Displayed  1 routes and 1 total paths