Skip to content

Solved lab4 (bgp).

Prerequisites

Before running the generator and parser, install the requirements by running:

pip3 install -r requirements.txt

Generator

Before running generator create empty containers.

To run generator, execute:

python3 generator.py

It will connect to each node and setup the ip addresses and bgp config for each leaf/spine and PC automatically.

Parser

To run parser, execute:

python3 parser.py -n {leaf1,leaf2,spine1,spine2,spine3,spine4,PC1,PC2} -n {leaf1,leaf2,spine1,spine2,spine3,spine4,PC1,PC2} -s {leaf1,leaf2,spine1,spine2,spine3,spine4,PC1,PC2} -s {leaf1,leaf2,spine1,spine2,spine3,spine4,PC1,PC2}

With -n options you specify the first and the second node for which ping and traceroute will be run. (this option is required) With -s options you specify for which nodes you want all show commands to be executed.

Example:

python3 parser.py -n Leaf1 -n Leaf2 -s PC1 -s Spine3 (**case-sensitive**)

This command will execute ping and traceroute from Leaf1 to Leaf2. Also, it will execute sh run, sh ip route, show ip bgp summary and show ip bgp neighbors for PC1 and Spine3.

sh ip bgp ( BGP таблица), на ее основе описать используемый AS PATH между РС1 и РС2.

sh ip bgp from PC1
BGP table version is 22, local router ID is 10.0.254.7, vrf id 0
Default local pref 100, local AS 65100
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
*> 10.0.254.1/32    172.16.11.2                            0 65001 65000 ?
*> 10.0.254.2/32    172.16.11.2                            0 65001 65000 ?
*> 10.0.254.3/32    172.16.11.2                            0 65001 65200 ?
*> 10.0.254.4/32    172.16.11.2                            0 65001 65200 ?
*> 10.0.254.5/32    172.16.11.2              0             0 65001 ?
*> 10.0.254.6/32    172.16.11.2                            0 65001 65000 65002 ?
*> 10.0.254.7/32    0.0.0.0                  0         32768 ?
*> 10.0.254.8/32    172.16.11.2                            0 65001 65000 65002 65101 ?
*  172.16.11.0/30   172.16.11.2              0             0 65001 ?
*>                  0.0.0.0                  0         32768 ?
*> 172.16.22.0/30   172.16.11.2                            0 65001 65000 65002 ?
*> 172.16.111.0/30  172.16.11.2              0             0 65001 ?
*> 172.16.112.0/30  172.16.11.2              0             0 65001 ?
*> 172.16.113.0/30  172.16.11.2              0             0 65001 ?
*> 172.16.114.0/30  172.16.11.2              0             0 65001 ?
*> 172.16.221.0/30  172.16.11.2                            0 65001 65000 ?
*> 172.16.222.0/30  172.16.11.2                            0 65001 65000 ?
*> 172.16.223.0/30  172.16.11.2                            0 65001 65200 ?
*> 172.16.224.0/30  172.16.11.2                            0 65001 65200 ?

Displayed  18 routes and 19 total paths

From this table we can see that in order to make it to PC2 from PC1, we have to go through the following path: 65001 65000 65002 65101 which corresponds to Leaf1 -> Spine1/2 (Plane 1) -> Leaf 2 -> PC2.

На РС1 и РС2 посмотреть маршрутную информацию о lo интерфейса другого lo (show ip bgp 10.0.254.5 и show ip bgp 10.0.254.6)

show ip bgp 10.0.254.5 from PC1
BGP routing table entry for 10.0.254.5/32, version 12
Paths: (1 available, best #1, table default)
  Advertised to non peer-group peers:
  eth1
  65001
    172.16.11.2 from eth1 (10.0.254.5)
      Origin incomplete, metric 0, valid, external, best (First path received)
      Last update: Sat May 18 08:05:43 2024
show ip bgp 10.0.254.6 from PC1
BGP routing table entry for 10.0.254.6/32, version 13
Paths: (1 available, best #1, table default)
  Advertised to non peer-group peers:
  eth1
  65001 65000 65002
    172.16.11.2 from eth1 (10.0.254.5)
      Origin incomplete, valid, external, best (First path received)
      Last update: Sat May 18 08:05:43 2024
show ip bgp 10.0.254.5 from PC2
BGP routing table entry for 10.0.254.5/32, version 12
Paths: (1 available, best #1, table default)
  Advertised to non peer-group peers:
  eth1
  65002 65000 65001
    172.16.22.2 from eth1 (10.0.254.6)
      Origin incomplete, valid, external, best (First path received)
      Last update: Sat May 18 08:05:43 2024
show ip bgp 10.0.254.6 from PC2
BGP routing table entry for 10.0.254.6/32, version 14
Paths: (1 available, best #1, table default)
  Advertised to non peer-group peers:
  eth1
  65002
    172.16.22.2 from eth1 (10.0.254.6)
      Origin incomplete, metric 0, valid, external, best (First path received)
      Last update: Sat May 18 08:05:44 2024

Не забыть про отражение в выводе используемого NH

From PC1: Leaf1: Nexthop: 172.16.11.1

From PC2: Leaf2: Nexthop: 172.16.22.1

From Leaf1: PC1: Nexthop: 172.16.11.2 Spine1: Nexthop: 172.16.111.2 Spine2: Nexthop: 172.16.112.2 Spine3: Nexthop: 172.16.113.2 Spine4: Nexthop: 172.16.114.2

From Leaf2: PC2: Nexthop: 172.16.22.2 Spine1: Nexthop: 172.16.221.2 Spine2: Nexthop: 172.16.222.2 Spine3: Nexthop: 172.16.223.2 Spine4: Nexthop: 172.16.224.2

From Spine1: Leaf1: Nexthop: 172.16.111.1 Leaf2: Nexthop: 172.16.221.1

From Spine2: Leaf1: Nexthop: 172.16.112.1 Leaf2: Nexthop: 172.16.222.1

From Spine3: Leaf1: Nexthop: 172.16.113.1 Leaf2: Nexthop: 172.16.223.1

From Spine4: Leaf1: Nexthop: 172.16.114.1 Leaf2: Nexthop: 172.16.224.1

Merge request reports