Chapter: 1 (Routing I: OSPF)
Duration: 90 minutes
Tools: Containerlab, FRRouting (FRR), Wireshark, vtysh
Points: 10
Objectives
By the end of this lab you will:
- Build a 4-router, 3-area OSPF topology using Containerlab and FRR
- Observe OSPF neighbor state progression from Down to Full
- Inspect the LSDB and identify LSA types 1, 2, and 3
- Force a link failure and measure convergence time
- Verify inter-area routing works through an ABR
Topology
Area 0 (Backbone):
R1 (10.0.12.1) ---- R2 (10.0.12.2)
Lo: 1.1.1.1 Lo: 2.2.2.2 (ABR)
Area 1:
R2 (10.0.23.1) ---- R3 (10.0.23.2)
Lo: 3.3.3.3
Area 2:
R2 (10.0.24.1) ---- R4 (10.0.24.2)
Lo: 4.4.4.4
R2 is the ABR connecting Area 1 and Area 2 to Area 0. R3 and R4 are internal routers in Areas 1 and 2 respectively.
Setup
1. Create the topology file
# File: topo-ospf4.clab.yml
name: ospf4
topology:
nodes:
r1:
kind: linux
image: frrouting/frr:latest
r2:
kind: linux
image: frrouting/frr:latest
r3:
kind: linux
image: frrouting/frr:latest
r4:
kind: linux
image: frrouting/frr:latest
links:
- endpoints: ["r1:eth1", "r2:eth1"] # Area 0 link
- endpoints: ["r2:eth2", "r3:eth1"] # Area 1 link
- endpoints: ["r2:eth3", "r4:eth1"] # Area 2 link
containerlab deploy -t topo-ospf4.clab.yml
2. Enable OSPF daemon on each container
# On each container, enable ospfd and zebra
docker exec clab-ospf4-r1 bash -c "
sed -i 's/ospfd=no/ospfd=yes/' /etc/frr/daemons
service frr restart"
# Repeat for r2, r3, r4
3. Configure IP addresses
# R1
docker exec -it clab-ospf4-r1 vtysh
configure terminal
interface eth1
ip address 10.0.12.1/30
!
interface lo
ip address 1.1.1.1/32
!
router ospf
router-id 1.1.1.1
auto-cost reference-bandwidth 10000
network 10.0.12.0/30 area 0
network 1.1.1.1/32 area 0
!
Repeat with appropriate addresses on R2 (ABR: configure eth1 in area 0, eth2 in area 1, eth3 in area 2), R3 (area 1), and R4 (area 2).
Exercises
Exercise 1: Neighbor State Observation (20 min)
Watch OSPF neighbor establishment in real-time:
# Terminal 1: watch neighbor table update on R1
watch -n 1 "docker exec clab-ospf4-r1 vtysh -c 'show ip ospf neighbor'"
# Terminal 2: capture OSPF packets on R1's eth1 interface
docker exec clab-ospf4-r1 tcpdump -i eth1 -n "proto ospf" -w /tmp/ospf_hellos.pcap &
Record:
- How many seconds elapsed from the first Hello received to the Full state?
- What is R1's Router ID? What is R2's Router ID?
- What is the DR/BDR on the R1-R2 segment? How was it elected? (Hint: compare Bridge IDs / RIDs)
Open /tmp/ospf_hellos.pcap in Wireshark. Identify: Hello, DBD, LSR, LSU, and LSAck packets.
Exercise 2: LSDB Inspection (20 min)
After all adjacencies reach Full state:
# View full LSDB on R3 (Area 1 internal router)
docker exec clab-ospf4-r3 vtysh -c "show ip ospf database"
# View only Type 3 Summary LSAs
docker exec clab-ospf4-r3 vtysh -c "show ip ospf database summary"
# View routing table on R3
docker exec clab-ospf4-r3 vtysh -c "show ip route ospf"
Record:
- How many LSAs are in R3's LSDB? List each by type (Router/Network/Summary/etc.)
- Does R3 have a Type 1 (Router) LSA for R4? Why or why not?
- Does R3 have a Type 3 (Summary) LSA that covers R4's loopback (4.4.4.4/32)?
- What is the routing table entry for 4.4.4.4/32 on R3? Mark it as
O IA(inter-area)? - What is the next-hop for R3 to reach R4?
Exercise 3: Convergence Measurement (30 min)
Baseline measurement:
# Start continuous ping from R3 to R4's loopback
docker exec -it clab-ospf4-r3 sh -c "ping -i 0.2 -c 500 4.4.4.4" > /tmp/ping_baseline.txt &
# In another terminal: watch the OSPF neighbor table
watch -n 0.2 "docker exec clab-ospf4-r2 vtysh -c 'show ip ospf neighbor'"
Force a link failure:
# Disable the R2-R4 link (simulates link failure)
docker exec clab-ospf4-r4 ip link set eth1 down
Record:
- How many ping packets were lost between when you disabled the link and when pings to 4.4.4.4 failed completely?
- How long (in seconds) until R3 could no longer reach R4?
- How long (in seconds) until R2's neighbor table showed R4 as Down?
- What OSPF dead interval explains this convergence time?
Restore and tune:
# Restore the link
docker exec clab-ospf4-r4 ip link set eth1 up
# Now configure BFD to reduce detection time
docker exec -it clab-ospf4-r2 vtysh
configure terminal
bfd
peer 10.0.24.2 local-address 10.0.24.1
detect-multiplier 3
receive-interval 300
transmit-interval 300
!
!
interface eth3
ip ospf bfd
!
Repeat the link failure test with BFD enabled. Record the new convergence time.
Exercise 4: Reference Bandwidth Verification (10 min)
# Check the cost of R1's eth1 interface
docker exec clab-ospf4-r1 vtysh -c "show ip ospf interface eth1"
Record:
- What is the current cost of R1's eth1 interface?
- If the interface bandwidth is 10 Gbps and you set
auto-cost reference-bandwidth 10000, what should the cost be? - Change the reference bandwidth and verify the cost changes.
Lab Report
Submit a short lab report (1-2 pages, or annotated terminal output) answering:
- What is the relationship between the OSPF Hello timer, Dead interval, and convergence time?
- R3 sees R4's network as
O IA(inter-area). What LSA type is responsible for this route, and which router generated it? - What is BFD's role in reducing convergence time? What is the minimum BFD detection time with
detect-multiplier 3andreceive-interval 300? - Why does OSPF have a Designated Router on multi-access segments? What problem does it solve?
Cleanup
containerlab destroy -t topo-ospf4.clab.yml
Grading (10 points)
| Item | Points |
|---|---|
| Topology deployed and all 4 adjacencies reach Full state | 2 |
| LSDB inspection: correctly identifies LSA types and inter-area routing | 3 |
| Convergence measurement: records loss count, convergence time, and Dead interval explanation | 3 |
| Lab report: correctly explains DR election, BFD, and Type 3 Summary LSA | 2 |