Computer Networks · Distance Vector and Link State Routing
DVR: Local Routing Table Construction (Destination, Distance, Next Hop)
Overview
Distance Vector Routing (DVR) begins with each router building a local routing table from its own local knowledge alone — only the costs of its directly connected links.
This table, with columns Destination, Distance and Next Hop, is the starting point of DVR, created before any information is exchanged with other routers.
Key concepts
- Local routing table: every router first constructs its own table using only knowledge about its directly connected neighbors.
- Three columns: Destination (the node to reach), Distance (the cost to reach it), Next Hop (the immediate node to go through — e.g., to go from A to C, the next hop is either B or D).
- Rule 1: every node knows only about its neighbors; it never knows the distance to a node that is not its neighbor.
- Rule 2: every node knows how many routers exist in total, so it knows which destinations to list.
- A destination entry is filled only if that destination is a direct neighbor; for a non-neighbor the distance is infinity and there is no next hop.
- For itself, the distance is 0 and the next hop is itself.
- For a direct neighbor, the distance is the known link cost and the next hop is that neighbor itself.
How it works
- List every router in the network as a destination (the total number of routers is known to every node).
- For the node itself: distance = 0, next hop = itself.
- For each directly connected neighbor: distance = link cost, next hop = that neighbor.
- For every non-neighbor: distance = infinity, next hop = none.
Topology used: nodes A, B, C, D with link costs A–B = 2, B–C = 3, B–D = 7, A–D = 1, C–D = 11.
Neighbors of each node:
- B's neighbors: A, C, D (all directly connected).
- A's neighbors: B, D (A is not a neighbor of C).
- C's neighbors: B, D (C is not a neighbor of A).
- D's neighbors: A, B, C (D is a neighbor to everyone).
Formulas
distance(self) = 0, next hop(self) = self
distance(neighbor) = link cost, next hop(neighbor) = that neighbor
distance(non-neighbor) = infinity, next hop(non-neighbor) = none
Worked examples
Routing table at B — B knows A, C, D because all are directly connected neighbors, so all distances are filled.
| Destination | Distance | Next Hop |
|---|---|---|
| A | 2 | A |
| B | 0 | B |
| C | 3 | C |
| D | 7 | D |
Routing table at A — A is not a neighbor of C, so A does not know the distance to C: it writes infinity and no next hop.
| Destination | Distance | Next Hop |
|---|---|---|
| A | 0 | A |
| B | 2 | B |
| C | infinity | — (none) |
| D | 1 | D |
Routing table at C — C is not a neighbor of A, so C writes the distance to A as infinity; all other entries are filled because B and D are neighbors.
| Destination | Distance | Next Hop |
|---|---|---|
| A | infinity | — (none) |
| B | 3 | B |
| C | 0 | C |
| D | 11 | D |
Routing table at D — D is a neighbor to everyone, so every distance is filled.
| Destination | Distance | Next Hop |
|---|---|---|
| A | 1 | A |
| B | 7 | B |
| C | 11 | C |
| D | 0 | D |
Revision summary
- The table has exactly three columns: Destination | Distance | Next Hop.
- A destination is filled only if it is a direct neighbor; otherwise distance = infinity and next hop = none.
- Distance to self = 0, next hop = self.
- Distance to a direct neighbor = link cost, next hop = that neighbor.
- Every node knows the total number of routers but knows distances only to its neighbors.
- This local table is only the first step of DVR, built before any information is exchanged with other routers.
Previous-year exam insights
- In DVR each router periodically sends its full distance vector (distance to every known destination) to all its direct neighbours, and on receiving a neighbour's vector it updates each entry as min over neighbours of (cost to that neighbour + neighbour's advertised distance), setting the next hop to that neighbour; this is Bellman-Ford, and the local table is only the initial state before such exchanges.
- DVR converges slowly and suffers the count-to-infinity problem (good news travels fast, bad news travels slowly) after a link or router fails; it is mitigated by split horizon (do not advertise a route back to the neighbour you learned it from), poison reverse (advertise such routes with distance infinity) and triggered updates, and is bounded by defining infinity as a finite value such as 16 (RIP).
- DVR exchanges full routing tables only with directly connected neighbours, whereas link-state routing floods link-state packets to all routers, each router builds the complete topology and runs Dijkstra; link state converges faster and is free of count-to-infinity but needs more memory and computation.
- DVR's message complexity is low (messages only between neighbours) but convergence time can be large, while link-state routing sends link-state packets per router (flooded to all nodes) but converges in rounds after which all routers have identical topology databases.
- The distance vector algorithm is distributed (each node computes only its own table from neighbours' vectors) and asynchronous (nodes need not update simultaneously); it is guaranteed to converge to correct shortest paths if link costs stay fixed and no node advertises an infinite metric as finite.
- Routing tables in DVR store, for each destination, the cost (metric) and the next hop; the actual outgoing interface and the full path are not stored, and the next hop for a destination is always a direct neighbour, so a router never needs global topology knowledge.