root@router-city — first login

Router City.
Every packet needs a plan —
and a push.

You've just joined Router City's Network Operations team. Six routers, one misbehaving forwarding table, and a delivery deadline. Before you touch a single packet, you need to understand the two jobs every router does — and the algorithms that make the whole city work at scale. Six modules. One final exam. No hand-holding at the end.

hop 1 / 6

Forwarding vs. Routing

Two jobs, two very different speeds. Kurose & Ross's own analogy is a road trip: routing is planning the whole trip from source to destination. Forwarding is just getting through a single interchange — a local, split-second decision.

case study — the letter from h1 to h6

A letter (packet) leaves host h1 for host h6 across three switches. Two different questions get answered by two different planes:

Data Plane

Local, per-router. Looks only at the packet sitting in front of it right now, and decides which output port to use. Runs in hardware, per-packet, at line rate.

Control Plane

Network-wide logic. Decides the paths that datagrams follow end-to-end, and installs the forwarding tables that the data plane blindly obeys.

quick check

Router R3 receives a packet and instantly sends it out interface 2 because its forwarding table says so. Which plane made this specific decision, and which plane decided that route existed in the first place?

A

Data plane made the decision, control plane built the table.

B

Control plane made the decision, data plane built the table.

C

Both are the same plane — routers don't separate the two.

hop 2 / 6

Longest Prefix Matching

A router's forwarding table doesn't store every destination — it stores prefix ranges. When a destination address could match more than one row, the router always takes the longest matching prefix, because longer prefixes describe more specific — and therefore more authoritative — ranges.

R7's forwarding table
Destination address range (prefix)Prefix lengthInterface
11001000 00010111 00010*21 bits0
11001000 00010111 0001100024 bits1
11001000 00010111 00011*21 bits2
otherwise3
simulate a lookup

Pick a destination address arriving at R7. Watch the bit-by-bit match against every row, then choose the interface before revealing the router's answer.

hop 3 / 6

Link-State Routing — Dijkstra

In link-state routing (OSPF, IS-IS), every router floods its link costs so everyone knows the whole map. Each router then runs Dijkstra's algorithm locally to compute shortest paths to every destination. Step through it below — and predict each move before the algorithm does it.

Router City core — link costs
Source: A — click "Run next step" to begin
NodeTentative distance from AVia
hop 4 / 6

Distance Vector — Bellman-Ford

Distance vector (RIP, EIGRP) never sees the whole map. Every router only knows its own neighbors, and periodically gossips its own distance vector to them. Over several rounds, the estimates converge to the true shortest distances — the same answer Dijkstra reaches globally.

gossip rounds on the same graph

Each round, every node updates its distance to F using: D(node) = min over neighbors [ cost(node,neighbor) + D(neighbor) ].

Round 0 — nobody has heard from F yet
link-state vs. distance vector
Link-StateDistance Vector
Topology knowledgeGlobal — everyone sees the full mapLocal — only direct neighbors
Message costO(N·E) flooding messagesOnly exchanges with neighbors, but rounds can be many
Convergence riskPossible oscillation if costs depend on loadRouting loops, "count-to-infinity"
Fault blast radiusA lying router mostly hurts itself (each router computes its own table)A lying router's bad vector propagates to everyone downstream
hop 5 / 6

Scaling It Up — Autonomous Systems & BGP

The internet isn't one flat network — it's a network of networks. Routers are grouped into Autonomous Systems (AS): a university, an ISP, a datacenter. Inside an AS, routers agree on one intra-domain protocol (OSPF, EIGRP, RIP). Between AS's, everyone speaks one common language: BGP.

click each region to see who's in charge
hop 6 / 6 — final exam

The Router City Certification Exam

No more guided walkthroughs. Three tasks, real computation required, wrong answers just get a nudge — not the solution. Solve all three to get certified.

task 1 — longest prefix match, on your own

Same forwarding table as Module 2. A new packet arrives at R7:

11001000  00010111  00011011  11110000

Which output interface does R7 use?

Compare the destination against each prefix one byte at a time. Two rows are the same length (21 bits) — they only differ in their last 5 bits.
Byte 3 of the destination is 00011011. Its first 5 bits are 00011. Which 21-bit prefix has last-5-bits 00011?
The 24-bit row needs byte 3 to be exactly 00011000. It isn't — so that longer prefix is disqualified. The winner is the next-longest row that still matches.
task 2 — run Dijkstra yourself

A new link-cost map (not the one from Module 3). Compute the total shortest-path cost from A to F and type it in.

Start at A (distance 0). List A's direct neighbors and their costs — that's your first set of tentative distances.
After visiting A and its cheapest neighbor, don't forget to relax edges: a longer path through a cheaper intermediate node can beat a shorter-looking direct edge.
By the time you've finalized A, B, and C, node D's best tentative distance should come out to 6. If yours doesn't, re-check the B→C and C→D edges.
task 3 — pick the right protocol

Router R1 sits inside AS 100 (a university network). It needs to deliver a packet to a server inside AS 200 (a datacenter on the other side of the country), reachable through gateway router R9.

Which protocol determines the path between AS 100 and AS 200?

progress: task 1 task 2 task 3