Distance-vector (DV) routing is a distributed algorithm used in early routing protocols such as RIP (Routing Information Protocol). Each router maintains a vector of distances (costs) to all known destinations, along with the next hop on the best path. Routers periodically exchange their distance vectors with directly connected neighbours. Using the Bellman-Ford equation, each router updates its own vector to find the least-cost paths. DV is simple and requires little computation, but it suffers from slow convergence and the well-known count-to-infinity problem when link costs increase or links fail. Various enhancements such as split horizon, poison reverse, triggered updates, and hold-down timers mitigate these issues. This tutorial provides an in-depth exploration of DV routing, including the mathematical foundations, convergence analysis, loop prevention techniques, and a thorough comparison with link-state routing.
In distance-vector routing, each router x maintains:
Routers exchange their distance vectors with neighbours periodically (e.g., every 30 seconds in RIP) or when the vector changes (triggered updates). Upon receiving a vector from neighbour v, router x updates its own vector using the Bellman-Ford equation:
where N(x) is the set of neighbours of x. This equation is applied iteratively until convergence.
The Bellman-Ford algorithm is a dynamic programming solution to the shortest path problem in a graph with no negative cycles. For a graph with n vertices, it computes shortest paths from a source by relaxing all edges repeatedly. In a distributed setting, each router runs the Bellman-Ford iteration using vectors from neighbours.
Centralised Bellman-Ford algorithm:
In DV routing, the algorithm is distributed: each node computes its own distances based on neighbours' distances, and the process is asynchronous. The algorithm converges to the true shortest paths if the network is static and no updates are lost.
Routers send their entire distance vector (or only changes) to neighbours. When a router receives an update, it recalculates its distances. If any distance decreases, it may trigger an immediate update (triggered update). However, if a distance increases, the router must wait for a while (hold-down) to avoid flapping. The periodic exchange ensures that all routers eventually learn about changes, but the propagation of information is slow—one hop per update interval.
Convergence is the process of all routers having consistent, accurate distance vectors. In DV, convergence can be slow, especially when a link fails and the cost to a destination increases. The count-to-infinity problem arises when routers gradually increase the cost to an unreachable destination, each advertising a path through the other, until the cost reaches a maximum (e.g., 16 in RIP, which is considered infinity).
Example: A, B, C in a line. A is connected to B, B to C, and C to a destination. If the link between A and B fails, B may think it can reach A via C (if C has a route to A through B), and C may think it can reach A via B, leading to increasing costs until infinity.
To mitigate count-to-infinity and routing loops, distance-vector protocols employ several techniques:
The convergence time of DV can be bounded based on the network diameter and the update interval. In the worst case, the count-to-infinity problem can cause convergence to take O(n) update cycles, where n is the number of routers, because each hop may increase the cost by 1 per cycle until infinity is reached. With infinity set to a small number (e.g., 16), convergence is limited but may still take up to 16 cycles. The use of triggered updates and hold-down timers can reduce this, but not eliminate it entirely.
| Aspect | Distance-Vector | Link-State |
|---|---|---|
| Information exchanged | Distance vectors (distances to all destinations) with neighbours | LSAs (link-state advertisements) flooded to all routers |
| Topology knowledge | Only knows distances via neighbours | Complete topology map |
| Convergence speed | Slow; may suffer from count-to-infinity | Fast; all routers compute independently |
| Complexity | Low (O(degree) per update) | Higher (O(|V| log |V|) per computation) |
| Scalability | Limited (RIP max 15 hops) | More scalable with areas |
| Loop-free guarantee | Not inherent; requires mechanisms | Inherently loop-free due to consistent topology |
Poison reverse is an extension of split horizon that explicitly advertises a metric of infinity to the neighbour from which the route was learned. This quickly informs the neighbour that the route is not usable, preventing loops. Triggered updates propagate changes immediately, reducing convergence time but increasing overhead during flapping. Damping techniques (like hold-down timers and route dampening) are used to suppress oscillations by delaying route acceptance after a metric increase.
In modern routing, distance-vector is rarely used for interior routing except in small networks (RIP). However, the principles are similar to those used in BGP for inter-domain routing, though BGP is path-vector and uses policy.
Figure 1: Simple network illustrating count-to-infinity
A --- B --- C --- D (destination)
If A-B fails, B may think it can reach A via C, and C via B, leading to increasing costs.
Answer each question; check your understanding by revealing the answer.
Question 1: What information does a router maintain in distance-vector routing?
Question 2: Write the Bellman-Ford equation for a router x.
Question 3: What is the count-to-infinity problem?
Question 4: What is the purpose of split horizon?
Question 5: How does poison reverse differ from split horizon?
Question 6: What is a triggered update?
Question 7: What is a hold-down timer and why is it used?
Question 8: What is the maximum hop count in RIP?
Question 9: In distance-vector routing, why do routers exchange their entire vectors periodically?
Question 10: Can distance-vector routing guarantee loop-free paths without additional mechanisms? Explain.
Question 11: How does the Bellman-Ford algorithm handle negative edge weights?
Question 12: What is the main advantage of distance-vector over link-state in terms of implementation?
Question 13: What causes routing loops in distance-vector?
Question 14: How does a router detect a neighbour failure in DV?
Question 15: What is the effect of triggered updates on convergence time?
Question 16: Compare the bandwidth overhead of distance-vector and link-state.
Question 17: In RIP, what happens when a route's metric reaches 16?
Question 18: Why is distance-vector not suitable for large networks?
Question 19: How does the hold-down timer interact with triggered updates?
Question 20: What is the difference between periodic and triggered updates in DV?
Question 21: Explain the concept of "routing by rumor" in distance-vector.
Question 22: In the Bellman-Ford equation, what does D_v(y) represent?
Work through these problems; sample solutions are hidden.
Exercise 1: Consider a network with three routers A, B, C. Link costs: A-B=2, B-C=3, A-C=10. Initially, each router knows only its direct links. Show the initial distance vectors. Then perform one exchange of vectors between neighbours (A and B, B and C, A and C) and update each router's vector.
Exercise 2: Explain how the count-to-infinity problem occurs in the network A-B-C-D, where A is the destination. Show the sequence of distance vectors when the link A-B fails.
Exercise 3: Why does split horizon not prevent the count-to-infinity problem in a three-node loop (A-B-C-A) when the link A-B fails?
Exercise 4: Compare the convergence time of distance-vector with and without triggered updates for a network with diameter 5. Assume periodic updates every 30 seconds.
Exercise 5: How does poison reverse improve upon split horizon? Provide an example where split horizon fails but poison reverse succeeds.
Exercise 6: Calculate the number of updates required for all routers to converge in a simple line of n routers when a link at one end fails, using the Bellman-Ford equation with infinity set to 16. How does the presence of triggered updates affect this?
Exercise 7: A router has the following distance vector: to A: 2 via X, to B: 5 via X, to C: 3 via Y. It receives a vector from neighbour X: (A:1, B:3, C:4). If the link cost to X is 1, what are the new distances and next hops?
Exercise 8: Explain why distance-vector routing is often called "routing by rumor".
Exercise 9: Compare the memory requirements of distance-vector and link-state. Which is more suitable for small networks?
Exercise 10: In RIP, what is the purpose of the "garbage collection" timer (flush timer)?
These questions require deeper thought and research. Write comprehensive answers.
Homework 1: Prove that the Bellman-Ford algorithm correctly computes shortest paths in a graph with no negative cycles, and explain why the distributed version eventually converges if updates are periodic.
Homework 2: Derive the maximum time for the count-to-infinity problem to converge in RIP, given a network diameter of d and a hold-down timer of 180 seconds. Consider both periodic updates (30s interval) and triggered updates.
Homework 3: Compare and contrast split horizon, poison reverse, and hold-down timers. When is each most effective? Provide examples where each might fail.
Homework 4: Explain how distance-vector routing can be modified to support policies (as in BGP). What makes BGP a path-vector protocol rather than a pure distance-vector?
Homework 5: Analyse the stability of distance-vector routing under traffic load variations. How can dynamic metrics cause oscillations?
Homework 6: Prove that the count-to-infinity problem is bounded in RIP because of the maximum hop count (15). What happens if the network diameter is greater than 15?
Homework 7: Design a distance-vector protocol that avoids the count-to-infinity problem entirely. Is it possible? Discuss theoretical limitations.
Homework 8: Explain the concept of "route poisoning" and how it is used in conjunction with triggered updates to speed up convergence. Give a step-by-step example.
Homework 9: Compare the convergence of distance-vector routing when using periodic updates versus event-driven updates in a network with frequent link flapping. Which is more stable?
Homework 10: Research the Enhanced Interior Gateway Routing Protocol (EIGRP) and explain how it improves upon traditional distance-vector protocols like RIP. Focus on the Diffusing Update Algorithm (DUAL) and its loop-free property.
Homework 11: Write pseudocode for a distance-vector routing algorithm that includes split horizon, poison reverse, and triggered updates. Describe the data structures and the event handlers for receiving a vector, timer expiry, and neighbour failure.
Homework 12: Discuss the trade-offs between using distance-vector and link-state in a mobile ad hoc network (MANET). Why are distance-vector approaches often preferred? What modifications are needed?
This tutorial provided a comprehensive examination of distance-vector routing, including the Bellman-Ford algorithm, distributed computation, convergence issues, and loop prevention mechanisms. We analyzed the count-to-infinity problem and the various techniques used to mitigate it. The comparison with link-state routing highlighted the trade-offs between simplicity and performance. While distance-vector is less common in modern intra-domain routing (except for small networks), its principles are foundational and are also reflected in path-vector protocols like BGP. Understanding these concepts is crucial for network engineers designing and troubleshooting routing protocols.
End of Tutorial 5 .