Sub topic 4
Distance-vector routing: routing by rumor
This chapter assumes you know basic IP addressing, what a routing table is, and how longest-prefix match picks a route. It also assumes you know basic graph terms such as nodes, edges, and weights.
The core idea
A distance-vector protocol lets each router know only two things about a destination: how far it is, and which neighbor to send packets to. The router never sees the whole network. It learns distances from its neighbors and trusts what they say.
That is why this approach is called routing by rumor. Router A hears from B, "I can reach network N at cost 2." A adds the cost of the A–B link and records "N costs 3 via B." A did not check B's claim. It just believes it.
The name comes from the message each router sends: a vector, which is a list of (destination, distance) pairs.
What a router stores
Each router keeps a table with one row per destination:
| Destination | Cost | Next hop |
|---|---|---|
| 10.1.0.0/16 | 1 | directly connected |
| 10.2.0.0/16 | 3 | B |
| 10.3.0.0/16 | 5 | C |
The router does not store the full path. It stores only the first step. Each router along the way makes its own next-hop decision, so the packet follows a chain of local choices.
A worked example
Take three routers in a line: A, B, and C. Each link has cost 1. C is directly attached to network N.
- C advertises N with cost 0, because N is directly attached.
- B adds its link cost to C (1) and records N at cost 1 via C.
- B advertises N with cost 1 to A.
- A adds its link cost to B (1) and records N at cost 2 via B.
Information moves one router per exchange. In a larger network, a change takes several rounds to reach distant routers.
Properties to remember
- Local view. A router knows its neighbors and their advertised distances, nothing more.
- Periodic or triggered updates. Routers resend vectors on a timer, and some also send them when something changes.
- Simple state. Memory use grows with the number of destinations, not with the number of links in the network.
- Second-hand information. A router's picture is only as accurate as its neighbors' pictures. This is the root of the failure modes covered in later chapters.
Exercise
Router R has neighbors X (link cost 2) and Y (link cost 1). X advertises network N at cost 4. Y advertises N at cost 6. What does R record for N?
Show answer
Via X the cost is 2 + 4 = 6. Via Y the cost is 1 + 6 = 7. R records N at cost 6 with next hop X.
Exercise
Why does a distance-vector router store only a next hop and not the full path to a destination?
Show answer
It only knows its neighbors' advertised distances, not the topology beyond them. Each router along the path makes its own next-hop decision, so the first step is enough to forward a packet.