Distance Vector Routing
Tell your neighbours what you know — then watch count-to-infinity happen when a link fails.
Skip to the animationIn distance vector routing each router tells its neighbours how far it is from everywhere, and believes what they tell it — which converges quickly on good news and disastrously slowly on bad.
The algorithm
No router has a map. Each knows its own directly attached links and whatever its neighbours advertise. Periodically it sends its whole distance table to each neighbour, and applies the Bellman-Ford update: for each destination, take the minimum over all neighbours of (cost to that neighbour + the cost they advertise).
Good news spreads fast. A newly available route propagates one hop per exchange until everyone knows it, and the tables stabilise.
The vocabulary
- Protocol data unit
- What the thing is called at each layer: segment at transport, packet at network, frame at link. Different names for the same bytes with different amounts of header wrapped round them.
- Encapsulation
- A layer treats everything it receives from above as opaque payload and prepends its own header. It never looks inside, which is precisely what makes layers replaceable.
- Peer layers
- A layer only ever meaningfully talks to the same layer at the other end. TCP at one end reads the header TCP at the other end wrote, and nothing in between touches it.
- Propagation vs transmission delay
- Propagation is how long a bit takes to travel the distance — set by physics. Transmission is how long it takes to push all the bits out — set by bandwidth. Only the second improves when you buy a faster link.
- Round-trip time (RTT)
- Send to reply. Every acknowledgement-based protocol is ultimately paced by this, which is why the interesting question is always how much you can send before one arrives.
Count-to-infinity
Bad news is the problem. When a link fails, a neighbour may still be advertising a route it learned through the router that just lost it — and a distance vector carries distances only, with nothing about the path. There is no way to detect the loop.
- 1The A–B link fails, and B should mark A unreachable.
- 2C, not yet informed, still advertises A at cost 2 — a route that ran through B.
- 3B believes it and records A at cost 3, pointing at C.
- 4C hears 3 and goes to 4. B hears 4 and goes to 5.
- 5The count creeps upward one exchange at a time while packets for A loop between them.
The count only terminates at an agreed value meaning unreachable. RIP defines infinity as 16, which is why a RIP network can never exceed 15 hops — a severe limit accepted purely to bound this loop.
The mitigations
- Split horizon — never advertise a route back to the neighbour you learned it from. Kills the simple two-router loop entirely.
- Poison reverse — advertise it back explicitly as infinity, which is more emphatic and converges faster.
- Triggered updates — send a change immediately rather than waiting for the periodic timer.
- Hold-down timers — ignore new routes to a destination for a while after it goes down.
Together these help a great deal. None of them eliminates loops involving three or more routers, which is the fundamental limitation and the reason link-state protocols exist.
Against link state
| Distance vector | Link state | |
|---|---|---|
| Knows | distances to destinations | the entire topology |
| Tells | its whole table, to neighbours only | its own links, to everyone |
| Computes with | Bellman-Ford, incrementally | Dijkstra, from scratch |
| Convergence | slow; loops possible | fast; no loops |
| Memory and CPU | low | higher |
| Protocols | RIP, EIGRP | OSPF, IS-IS |
Advantages and disadvantages
Advantages
- Very little memory — a router stores one distance per destination, not a topology.
- Simple to implement, and updates go only to direct neighbours.
- Converges quickly when routes appear or improve.
Disadvantages
- Count-to-infinity makes convergence after a failure slow, with loops meanwhile.
- The hop limit imposed to bound the count caps the size of the network.
- Periodic full-table updates waste bandwidth even when nothing changed.
Watch it work
Check yourself
question 1 / 4
One question at a time. Pick an answer to see why it is right or wrong, then move on — there is no score to keep and nothing is saved.