Thursday, April 7, 2022

BGP local-as

 

Here’s what I’ve been able to check in the lab. The “no-prepend” indeed removes the “local-as”-ASN from the bgp-advertisement to another site. So this can be used to make it cleaner. Note that the real 4BASN is never shown at the other site. You will see below that none of the other options (replace-as, dual-as) seem to make a difference.

 

 

Setup:

(172.16.22.0/24)101RS001-----------cedge101------------mpls-------- cedge201--------------------201RS002

                AS65005-----(local-as 5)AS420001111-----------------AS420002222(local-as 5)-----AS64922

 

I kept the ASNs on the switches different just to be able to get the BGP info also on the switches. We can still use the same during the migration in PROD, as they will follow the less specific routes.

 

 

Test 1)

Cedge101#

router bgp 420001111

  neighbor 172.16.20.1 local-as 5

Cedge201#

router bgp 420001111

neighbor 172.16.30.6 local-as 5

 

cedge101#sh ip bgp vpnv4 vrf 1 172.16.22.0/24

BGP routing table entry for 1:1:172.16.22.0/24, version 550

Paths: (2 available, best #1, table 1)

  Not advertised to any peer

  Refresh Epoch 1

 5 65005

    172.16.20.1 (via vrf 1) from 172.16.20.1 (172.16.25.21)

      Origin incomplete, metric 200, localpref 100, valid, external, best

      Community: 101:65005

      Extended Community: RT:420001111:1

      rx pathid: 0, tx pathid: 0x0

      Updated on Jul 28 2021 12:22:23 UTC

  Refresh Epoch 1

  5 65005, (received-only)

    172.16.20.1 (via vrf 1) from 172.16.20.1 (172.16.25.21)

      Origin incomplete, metric 200, localpref 100, valid, external

      Community: 101:65005

      rx pathid: 0, tx pathid: 0

      Updated on Jul 28 2021 12:22:23 UTC

 

 

cedge201#sh ip bgp vpnv4 vrf 1 172.16.22.0/24

BGP routing table entry for 1:1:172.16.22.0/24, version 104

Paths: (2 available, best #1, table 1)

  Advertised to update-groups:

     5          6        

  Refresh Epoch 1

  5 65005

    10.0.30.10 (via default) from 0.0.0.0 (192.168.20.2)

      Origin incomplete, metric 1000, localpref 50, valid, sourced, best

      Community: 101:65005

      Extended Community: SoO:0:102 RT:420002222:1

      rx pathid: 0, tx pathid: 0x0

      Updated on Jul 28 2021 12:22:31 UTC

  Refresh Epoch 1

  5 65005, (received & used)

    172.16.30.2 (via vrf 1) from 172.16.30.2 (192.168.20.1)

      Origin incomplete, metric 1000, localpref 50, valid, internal

      Community: 101:65005

      Extended Community: SoO:0:102 RT:420002222:1

      rx pathid: 0, tx pathid: 0

      Updated on Jul 28 2021 12:22:31 UTC

 

102RS001#sh ip bgp 172.16.22.0/24

BGP routing table entry for 172.16.22.0/24, version 372

Paths: (2 available, best #2, table default)

  Advertised to update-groups:

     2        

  Refresh Epoch 1

  5 420002222 5 65005

    172.16.30.5 from 172.16.30.5 (192.168.20.2)

      Origin incomplete, metric 1000, localpref 100, valid, external

      Community: 6684141

      Extended Community: SoO:0:102 RT:420002222:1

      rx pathid: 0, tx pathid: 0

  Refresh Epoch 1

  5 420002222 5 65005

    172.16.30.17 from 172.16.30.17 (192.168.20.1)

      Origin incomplete, metric 1000, localpref 100, valid, external, best

      Community: 6684141

      Extended Community: SoO:0:102 RT:420002222:1

      rx pathid: 0, tx pathid: 0x0

102RS001#

 

 

 Test 2) no-prepend

 

Cedge101#

router bgp 420001111

  neighbor 172.16.20.1 local-as 5 no-prepend

 

Cedge201#

router bgp 420001111

neighbor 172.16.30.6 local-as 5

 

cedge101#sh ip bgp vpnv4 vrf 1 172.16.22.0/24

BGP routing table entry for 1:1:172.16.22.0/24, version 358

Paths: (2 available, best #1, table 1)

  Not advertised to any peer

  Refresh Epoch 1

  65005

    172.16.20.1 (via vrf 1) from 172.16.20.1 (172.16.25.21)

      Origin incomplete, metric 200, localpref 100, valid, external, best

      Community: 101:65005

      Extended Community: RT:420001111:1

      rx pathid: 0, tx pathid: 0x0

      Updated on Jul 28 2021 11:48:37 UTC

  Refresh Epoch 1

  65005, (received-only)

    172.16.20.1 (via vrf 1) from 172.16.20.1 (172.16.25.21)

      Origin incomplete, metric 200, localpref 100, valid, external

      Community: 101:65005

      rx pathid: 0, tx pathid: 0

      Updated on Jul 28 2021 11:48:37 UTC

 

cedge201#sh ip bgp vpnv4 vrf 1 172.16.22.0/24

BGP routing table entry for 1:1:172.16.22.0/24, version 110

Paths: (2 available, best #1, table 1)

  Advertised to update-groups:

     5          6        

  Refresh Epoch 1

 65005

    10.0.30.10 (via default) from 0.0.0.0 (192.168.20.2)

      Origin incomplete, metric 1000, localpref 50, valid, sourced, best

      Community: 101:65005

      Extended Community: SoO:0:102 RT:420002222:1

      rx pathid: 0, tx pathid: 0x0

      Updated on Jul 28 2021 12:26:30 UTC

  Refresh Epoch 1

  65005, (received & used)

    172.16.30.2 (via vrf 1) from 172.16.30.2 (192.168.20.1)

      Origin incomplete, metric 1000, localpref 50, valid, internal

      Community: 101:65005

      Extended Community: SoO:0:102 RT:420002222:1

      rx pathid: 0, tx pathid: 0

      Updated on Jul 28 2021 12:26:30 UTC

 

 

102RS001#sh ip bgp 172.16.22.0/24

BGP routing table entry for 172.16.22.0/24, version 340

Paths: (2 available, best #2, table default)

  Advertised to update-groups:

     2        

  Refresh Epoch 1

  5 420002222 65005

    172.16.30.5 from 172.16.30.5 (192.168.20.2)

      Origin incomplete, metric 1000, localpref 100, valid, external

      Community: 6684141

      Extended Community: SoO:0:102 RT:420002222:1

      rx pathid: 0, tx pathid: 0

  Refresh Epoch 1

  5 420002222 65005

    172.16.30.17 from 172.16.30.17 (192.168.20.1)

      Origin incomplete, metric 1000, localpref 100, valid, external, best

      Community: 6684141

      Extended Community: SoO:0:102 RT:420002222:1

      rx pathid: 0, tx pathid: 0x0

 

 Test 3) no-prepend replace-as

 

Cedge101#

router bgp 420001111

  neighbor 172.16.20.1 local-as 5 no-prepend replace-as

Cedge201#

router bgp 420001111

neighbor 172.16.30.6 local-as 5

 

cedge101#sh ip bgp vpnv4 vrf 1 172.16.22.0/24

BGP routing table entry for 1:1:172.16.22.0/24, version 578

Paths: (2 available, best #1, table 1)

  Not advertised to any peer

  Refresh Epoch 1

  65005

    172.16.20.1 (via vrf 1) from 172.16.20.1 (172.16.25.21)

      Origin incomplete, metric 200, localpref 100, valid, external, best

      Community: 101:65005

      Extended Community: RT:420001111:1

      rx pathid: 0, tx pathid: 0x0

      Updated on Jul 28 2021 12:28:00 UTC

  Refresh Epoch 1

  65005, (received-only)

    172.16.20.1 (via vrf 1) from 172.16.20.1 (172.16.25.21)

      Origin incomplete, metric 200, localpref 100, valid, external

      Community: 101:65005

      rx pathid: 0, tx pathid: 0

      Updated on Jul 28 2021 12:28:00 UTC

 

cedge201#sh ip bgp vpnv4 vrf 1 172.16.22.0/24

BGP routing table entry for 1:1:172.16.22.0/24, version 126

Paths: (2 available, best #2, table 1)

  Advertised to update-groups:

     5          6        

  Refresh Epoch 1

  65005, (received & used)

    172.16.30.2 (via vrf 1) from 172.16.30.2 (192.168.20.1)

      Origin incomplete, metric 1000, localpref 50, valid, internal

      Community: 101:65005

      Extended Community: SoO:0:102 RT:420002222:1

      rx pathid: 0, tx pathid: 0

      Updated on Jul 28 2021 12:28:08 UTC

  Refresh Epoch 1

  65005

    10.0.30.10 (via default) from 0.0.0.0 (192.168.20.2)

      Origin incomplete, metric 1000, localpref 50, valid, sourced, best

      Community: 101:65005

      Extended Community: SoO:0:102 RT:420002222:1

      rx pathid: 0, tx pathid: 0x0

      Updated on Jul 28 2021 12:28:08 UTC

cedge201#

 

102RS001#sh ip bgp 172.16.22.0/24

BGP routing table entry for 172.16.22.0/24, version 396

Paths: (2 available, best #2, table default)

  Advertised to update-groups:

     2        

  Refresh Epoch 1

 5 420002222 65005

    172.16.30.17 from 172.16.30.17 (192.168.20.1)

      Origin incomplete, metric 1000, localpref 100, valid, external

      Community: 6684141

      Extended Community: SoO:0:102 RT:420002222:1

      rx pathid: 0, tx pathid: 0

  Refresh Epoch 1

  5 420002222 65005

    172.16.30.5 from 172.16.30.5 (192.168.20.2)

      Origin incomplete, metric 1000, localpref 100, valid, external, best

      Community: 6684141

      Extended Community: SoO:0:102 RT:420002222:1

      rx pathid: 0, tx pathid: 0x0

 

 Test 4) no-prepend replace-as dual-as

 

Cedge101#

router bgp 420001111

  neighbor 172.16.20.1 local-as 5 no-prepend replace-as dual-as

Cedge201#

router bgp 420001111

neighbor 172.16.30.6 local-as 5

 

cedge101#sh ip bgp vpnv4 vrf 1 172.16.22.0/24

BGP routing table entry for 1:1:172.16.22.0/24, version 592

Paths: (2 available, best #1, table 1)

  Not advertised to any peer

  Refresh Epoch 1

  65005

    172.16.20.1 (via vrf 1) from 172.16.20.1 (172.16.25.21)

      Origin incomplete, metric 200, localpref 100, valid, external, best

      Community: 101:65005

      Extended Community: RT:420001111:1

      rx pathid: 0, tx pathid: 0x0

      Updated on Jul 28 2021 12:30:30 UTC

  Refresh Epoch 1

  65005, (received-only)

    172.16.20.1 (via vrf 1) from 172.16.20.1 (172.16.25.21)

      Origin incomplete, metric 200, localpref 100, valid, external

      Community: 101:65005

      rx pathid: 0, tx pathid: 0

      Updated on Jul 28 2021 12:30:30 UTC

 

cedge201#sh ip bgp vpnv4 vrf 1 172.16.22.0/24

BGP routing table entry for 1:1:172.16.22.0/24, version 143

Paths: (2 available, best #2, table 1)

  Advertised to update-groups:

     5          6        

  Refresh Epoch 1

  65005, (received & used)

    172.16.30.2 (via vrf 1) from 172.16.30.2 (192.168.20.1)

      Origin incomplete, metric 1000, localpref 50, valid, internal

      Community: 101:65005

      Extended Community: SoO:0:102 RT:420002222:1

      rx pathid: 0, tx pathid: 0

      Updated on Jul 28 2021 12:30:38 UTC

  Refresh Epoch 1

  65005

    10.0.30.10 (via default) from 0.0.0.0 (192.168.20.2)

      Origin incomplete, metric 1000, localpref 50, valid, sourced, best

      Community: 101:65005

      Extended Community: SoO:0:102 RT:420002222:1

      rx pathid: 0, tx pathid: 0x0

      Updated on Jul 28 2021 12:30:38 UTC

 

102RS001#sh ip bgp 172.16.22.0/24

BGP routing table entry for 172.16.22.0/24, version 420

Paths: (2 available, best #2, table default)

  Advertised to update-groups:

     2        

  Refresh Epoch 1

  5 420002222 65005

    172.16.30.17 from 172.16.30.17 (192.168.20.1)

      Origin incomplete, metric 1000, localpref 100, valid, external

      Community: 6684141

      Extended Community: SoO:0:102 RT:420002222:1

      rx pathid: 0, tx pathid: 0

  Refresh Epoch 1

  5 420002222 65005

    172.16.30.5 from 172.16.30.5 (192.168.20.2)

      Origin incomplete, metric 1000, localpref 100, valid, external, best

      Community: 6684141

      Extended Community: SoO:0:102 RT:420002222:1

      rx pathid: 0, tx pathid: 0x0

No comments:

Post a Comment

test

import os import argparse import json def load_json_file(filepath):     with open(filepath, 'r') as f:         return json.load(f) d...