Sub topic 1
What a Routing Protocol Has to Do
Prerequisites
This chapter assumes you know basic IP addressing and subnetting, the difference between a router and a switch, and how a routing table uses longest-prefix match to pick a route. You should also know basic graph terms: nodes, edges, weights, and shortest path.
Routing versus forwarding
Routers do two separate jobs, and the rest of this tutorial depends on keeping them apart.
- Forwarding is the per-packet action. The router reads the destination address, looks it up in the forwarding table using longest-prefix match, and sends the packet out an interface. It happens in hardware, in nanoseconds to microseconds.
- Routing is the process that fills the table. Routers exchange information, compute paths, and install the results. It runs in software, on a timescale of seconds, and only when something changes.
A routing protocol belongs to the second job. It never touches a packet in transit. It only decides what the forwarding table says.
What the protocol must supply
Static routes work for a small network, but they break when links fail and they do not scale. A dynamic routing protocol has to provide four things.
- Discovery. Each router must learn which destinations exist and which neighbors it can reach.
- Path selection. When several paths exist, the protocol must choose one using a metric, a number that measures how good a path is.
- Adaptation. When a link or router fails, or a new one appears, routers must notice and recompute.
- Consistency. Routers must agree well enough that packets do not loop or get dropped. Each router decides on its own, so its decision has to fit with its neighbors' decisions.
The last requirement is the hard one. Suppose router A sends traffic for a network to B because B claims to be closer. If B believes A is closer, the packet bounces between them until its TTL (time to live) reaches zero.
Two ways to get there
The two algorithm families in this tutorial differ in what routers share.
| Family | What routers share | Who computes the path |
|---|---|---|
| Distance-vector | Each router tells its neighbors its own distances to destinations | Each router builds its table from neighbors' claims |
| Link-state | Each router floods the state of its own links to everyone | Each router computes paths itself from a full map |
Distance-vector is routing by rumor: you trust what your neighbor says. Link-state gives every router the same map and lets each one work out the answer.
Common mistakes
- Treating a slow routing update as a slow forwarding path. Packets keep flowing using the old table until the new one is installed.
- Assuming the best path is always the shortest in hops. Metrics can include bandwidth, delay, or administrative cost, which later chapters cover.
Exercise
A link fails at 12:00:00. Packets are still forwarded at 12:00:01 using the old table, some of them into the dead link. Which job, routing or forwarding, is responsible for the delay in fixing this, and why?
Show answer
Routing. Forwarding only follows the table it has. The routing protocol must detect the failure, exchange information, recompute paths, and install a new table. Until it finishes, the forwarding table is stale.