Chapter 9 · Hands-on labs
Six short labs that turn the slides into commands you actually run — read and edit your own forwarding table, watch a packet get routed hop-by-hop across the real Internet, cross Autonomous-System boundaries, and even run a routing daemon with FRRouting. Each maps to a Chapter 9 topic.
iproute2 (ip), traceroute, mtr, whois, and (Lab 5) frr. Install missing ones: sudo apt install -y traceroute mtr-tiny whois frr. The ❯ is just the prompt — Copy grabs only the command.Your forwarding table — every destination the kernel knows:
ip route
default via 192.168.1.1 dev eth0 192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.23
The default route is the “gateway of last resort”; the /24 is the directly-connected LAN. That’s a forwarding table — destination → next hop / link.
Ask the kernel which route a destination uses (longest-prefix match in action):
ip route get 8.8.8.8 ip route get 192.168.1.50
8.8.8.8 via 192.168.1.1 dev eth0 ... <- uses default 192.168.1.50 dev eth0 src 192.168.1.23 ... <- uses the local /24
ip route get runs the same forwarding decision a router makes: pick the most specific matching route. Local traffic stays on the LAN; everything else follows the default.10.0.0.0/8 and 10.5.0.0/16, which would ip route get 10.5.0.1 choose, and why? (answer below)Add a static route for a test network (blackhole = safely discard, changes nothing real):
sudo ip route add blackhole 203.0.113.0/24 ip route | grep 203.0.113
blackhole 203.0.113.0/24
Confirm the kernel would use it:
ip route get 203.0.113.5
Clean up — remove your static route:
sudo ip route del blackhole 203.0.113.0/24
Trace the route to a distant site — each line is one router (hop):
traceroute -n 8.8.8.8
1 192.168.1.1 1.0 ms <- your gateway 2 100.64.0.1 8.4 ms <- ISP edge 3 72.14.215.85 12.1 ms <- upstream ... 7 8.8.8.8 14.0 ms <- destination
This is routing made visible: each hop is a router that made an independent forwarding decision to push your packet one step closer.
Live view of the same path with per-hop loss & latency (press q to quit):
mtr -n 8.8.8.8
Trace with AS numbers — each [ASxxxx] is a different Autonomous System:
traceroute -A -n 8.8.8.8
2 100.64.0.1 [AS12345] <- your ISP's AS 5 72.14.x.x [AS15169] <- Google's AS 8 8.8.8.8 [AS15169]
Who owns an AS / IP? Look up a hop:
whois 8.8.8.8 | grep -iE "OrgName|origin|netname|route"
When the AS number changes between hops, your packet has crossed an AS boundary — a place where BGP (inter-AS routing) decided the handoff.
FRRouting is the open-source descendant of Quagga/zebra — the same daemons the slides mention. You’ll run it on your own machine to meet the tooling (a full multi-router lab belongs in Packet Tracer / GNS3).
Install & enable the RIP and OSPF daemons:
sudo apt install -y frr sudo sed -i 's/^ripd=no/ripd=yes/; s/^ospfd=no/ospfd=yes/' /etc/frr/daemons sudo systemctl restart frr
Enter the router CLI (looks just like Cisco IOS):
sudo vtysh
Hello, this is FRRouting (version ...). kali# show ip route kali# configure terminal kali(config)# router ospf kali(config-router)# network 192.168.1.0/24 area 0
Inspect the routing state from inside vtysh:
show ip route show ip ospf show ip rip
show ip ospf, is OSPF using the link-state or distance-vector algorithm? What single word in the name tells you? (answer below)Add two blackhole routes to the same test net with different metrics (lower = preferred):
sudo ip route add blackhole 198.51.100.0/24 metric 100 sudo ip route add blackhole 198.51.100.0/24 metric 50
Which one wins? Ask the kernel:
ip route show 198.51.100.0/24 ip route get 198.51.100.9
blackhole 198.51.100.0/24 metric 50 blackhole 198.51.100.0/24 metric 100 198.51.100.9 dev lo ... (via the metric-50 route)
Clean up:
sudo ip route del blackhole 198.51.100.0/24 metric 50 sudo ip route del blackhole 198.51.100.0/24 metric 100
Lab 1. It chooses 10.5.0.0/16 — longest-prefix match: the most specific (longest mask) route that contains the destination always wins.
Lab 2. Static is right for a small stub network or a single edge link (like your capstone’s default route to the ISP). Dynamic wins when there are many routers/paths that change, so routes must be re-learned automatically.
Lab 3. Paths usually share the first few hops (your gateway + ISP) then diverge once traffic reaches the wider Internet and heads toward each destination’s network. The shared portion is your own ISP’s path out.
Lab 4. Count the distinct [ASxxxx] tags — typically 2–4. Your ISP’s AS is the first non-private one after your gateway.
Lab 5. OSPF uses the link-state algorithm — the words “Shortest Path First” refer to Dijkstra’s shortest-path-first computation over a full topology map.
Lab 6. OSPF costs are bandwidth-based, so a path with more hops but faster links can have a lower total cost than a shorter path over slow links — RIP, counting only hops, can’t see that difference.
| This lab’s tool | Connects to… |
|---|---|
| ip route / static routes (Labs 1–2) | Chapter 4 & the NSSA-241 capstone — configuring routes on a router |
| traceroute / TTL (Lab 3) | Chapter 5 — how traceroute abuses the IP TTL field |
| AS numbers / BGP (Lab 4) | Inter-AS routing — the global routing table |
| FRR ospfd/ripd (Lab 5) | The distance-vector & link-state algorithms, running for real |