Skip to content

Router Lab III: When BGP Meets OSPF

Introduction

You can find materials for Lab III in the ospf-bgp directory. We need to handle a much more complex network topology in this lab. But all required configurations have been introduced in the previous two labs.

topology-lab1

Lab 3 Target Network Topology

As the topology shows, we have 5 AS and 8 routers. You need to connect all these routers so any two of them can ping each other using the local IP addresses (N.N.N.N).

  • You need to use the BGP protocol for inter-AS links and OSPF for intra-AS links.
  • Static routes are forbidden.
  • Two special route rules must be satisfied:
    • Packets from R1 to R3 should follow the path: R1 -> R5 -> R6 -> R8 -> R7 -> R3.
    • Packets from R3 to R1 should follow the path: R3 -> R7 -> R6 -> R8 -> R5 -> R1.

Hints

redistribute BGP and redistribute OSPF

By default, BGP agent will not advertise routes from OSPF to its BGP peers. Similarly, OSPF agent will not advertise routes from BGP to its OSPF peers. You need to explicitly configure them using redistribute BGP and redistribute OSPF, respectively.

For example, R6 won't advertise the route to R2 to R5 unless redistribute BGP is added in R6's OSPF configuration. R5 won't advertise the route to R6 to R1 unless redistribute OSPF match internal is added in R5's BGP configuration. internal here means route inside the AS. As the name indicates, you need to add redistribute OSPF match external to tell R5 to distribute route to R2 to R1. You may refer to cEOS's BGP document and OSPF document for more details.

Troubleshooting

Following commands may help when you meet troubles:

  • show ip route: display the current routing table.
  • show ip bgp summary: show details of active BGP neighbors.
  • show ip ospf neighbor: show details of active OSPF neighbors.

Reference Complete Routing Table

When you finish your work, routing table on R1 may look like

Text Only
R1>show ip route

VRF: default
Codes: C - connected, S - static, K - kernel, 
       O - OSPF, IA - OSPF inter area, E1 - OSPF external type 1,
       E2 - OSPF external type 2, N1 - OSPF NSSA external type 1,
       N2 - OSPF NSSA external type2, B - Other BGP Routes,
       B I - iBGP, B E - eBGP, R - RIP, I L1 - IS-IS level 1,
       I L2 - IS-IS level 2, O3 - OSPFv3, A B - BGP Aggregate,
       A O - OSPF Summary, NG - Nexthop Group Static Route,
       V - VXLAN Control Service, M - Martian,
       DH - DHCP client installed default route,
       DP - Dynamic Policy Route, L - VRF Leaked,
       G  - gRIBI, RC - Route Cache Route

Gateway of last resort is not set

 C        1.1.1.0/24 is directly connected, Loopback0
 B E      2.2.2.0/24 [200/0] via 10.1.1.5, Ethernet1
 B E      3.3.3.0/24 [200/0] via 10.1.1.5, Ethernet1
 B E      4.4.4.0/24 [200/0] via 10.1.1.5, Ethernet1
 B E      5.5.5.0/24 [200/0] via 10.1.1.5, Ethernet1
 B E      6.6.6.0/24 [200/0] via 10.1.1.5, Ethernet1
 B E      7.7.7.0/24 [200/0] via 10.1.1.5, Ethernet1
 B E      8.8.8.0/24 [200/0] via 10.1.1.5, Ethernet1
 C        10.1.1.0/24 is directly connected, Ethernet1
 B E      10.1.2.0/24 [200/0] via 10.1.1.5, Ethernet1
 B E      10.1.3.0/24 [200/0] via 10.1.1.5, Ethernet1
 B E      10.1.4.0/24 [200/0] via 10.1.1.5, Ethernet1
 B E      10.1.5.0/24 [200/0] via 10.1.1.5, Ethernet1
 B E      10.1.6.0/24 [200/0] via 10.1.1.5, Ethernet1
 B E      10.1.7.0/24 [200/0] via 10.1.1.5, Ethernet1
 B E      10.1.8.0/24 [200/0] via 10.1.1.5, Ethernet1
 B E      10.1.9.0/24 [200/0] via 10.1.1.5, Ethernet1

And routing table on R5 may look like

Text Only
R5>show ip route

VRF: default
Codes: C - connected, S - static, K - kernel, 
       O - OSPF, IA - OSPF inter area, E1 - OSPF external type 1,
       E2 - OSPF external type 2, N1 - OSPF NSSA external type 1,
       N2 - OSPF NSSA external type2, B - Other BGP Routes,
       B I - iBGP, B E - eBGP, R - RIP, I L1 - IS-IS level 1,
       I L2 - IS-IS level 2, O3 - OSPFv3, A B - BGP Aggregate,
       A O - OSPF Summary, NG - Nexthop Group Static Route,
       V - VXLAN Control Service, M - Martian,
       DH - DHCP client installed default route,
       DP - Dynamic Policy Route, L - VRF Leaked,
       G  - gRIBI, RC - Route Cache Route

Gateway of last resort is not set

 B E      1.1.1.0/24 [200/0] via 10.1.1.1, Ethernet1
 O E2     2.2.2.0/24 [110/1] via 10.1.5.6, Ethernet2
 O E2     3.3.3.0/24 [110/1] via 10.1.5.6, Ethernet2
 O E2     4.4.4.0/24 [110/1] via 10.1.5.6, Ethernet2
 C        5.5.5.0/24 is directly connected, Loopback0
 O E2     6.6.6.0/24 [110/11] via 10.1.5.6, Ethernet2
 O E2     7.7.7.0/24 [110/13] via 10.1.5.6, Ethernet2
 O E2     8.8.8.0/24 [110/12] via 10.1.5.6, Ethernet2
 C        10.1.1.0/24 is directly connected, Ethernet1
 O E2     10.1.2.0/24 [110/1] via 10.1.5.6, Ethernet2
 O E2     10.1.3.0/24 [110/1] via 10.1.5.6, Ethernet2
 O E2     10.1.4.0/24 [110/1] via 10.1.5.6, Ethernet2
 C        10.1.5.0/24 is directly connected, Ethernet2
 O        10.1.6.0/24 [110/4] via 10.1.5.6, Ethernet2
 O        10.1.7.0/24 [110/3] via 10.1.5.6, Ethernet2
 C        10.1.8.0/24 is directly connected, Ethernet3
 O        10.1.9.0/24 [110/2] via 10.1.5.6, Ethernet2

Test

Once you have finished the configuration, you can use the following script in the ospf-bgp directory to test your work:

Bash Session
❯ ./test.py
R1 -> R1: True R2: True R3: True R4: True R5: True R6: True R7: True R8: True 
R2 -> R1: True R2: True R3: True R4: True R5: True R6: True R7: True R8: True 
R3 -> R1: True R2: True R3: True R4: True R5: True R6: True R7: True R8: True 
R4 -> R1: True R2: True R3: True R4: True R5: True R6: True R7: True R8: True 
R5 -> R1: True R2: True R3: True R4: True R5: True R6: True R7: True R8: True 
R6 -> R1: True R2: True R3: True R4: True R5: True R6: True R7: True R8: True 
R7 -> R1: True R2: True R3: True R4: True R5: True R6: True R7: True R8: True 
R8 -> R1: True R2: True R3: True R4: True R5: True R6: True R7: True R8: True 
Pass Connectivity Test
Path R1 -> R3: 1 -> 5 -> 6 -> 8 -> 7 -> 3
Path R3 -> R1: 3 -> 7 -> 6 -> 8 -> 5 -> 1
Pass Path Test

It checks the connectivity between all pairs of routers. If you pass the connectivity and the route path test, you can submit your work.

Submission

Once the configuration is completed, you could use the pack.sh script to pack your work and submit the tarball (router_submit_<student_ID>.tar.gz) on Tsinghua's Learning Center. We will validate your configurations again and grade your project according the correctness of your configurations.

It also collect all configurations on the solution subdirectory, you could use the solution.clab.yaml to deploy your solution:

Bash
sudo containerlab deploy -t solution.clab.yaml --reconfigure