Exercises — Distance vector routing — RIP, Bellman-Ford, count-to-infinity
Before we start, one symbol recap so nothing appears unexplained:
The one engine behind everything:
Level 1 — Recognition
Exercise 1.1 (L1)
State what three fields each entry of a distance vector table holds.
Recall Solution
Each entry is a triple: destination, cost (cheapest known total cost to that destination), and next-hop (which neighbour to forward through). See Routing Tables and Next-Hop Forwarding.
Exercise 1.2 (L1)
In RIP, what numeric cost means "unreachable", and what is the largest valid cost?
Recall Solution
16 = ∞ (unreachable). The largest valid hop count is 15. The cap exists to bound count-to-infinity.
Exercise 1.3 (L1)
Which transport protocol and port does RIP use, and how often does it broadcast?
Recall Solution
RIP runs over UDP port 520 and broadcasts its full distance vector every 30 seconds. A route with no update for 180 s (6 periods) is declared dead.
Level 2 — Application
Exercise 2.1 (L2)
Network links: A—B = 4, B—C = 1, A—C = 6. Neighbour advertises ; neighbour advertises . Compute and its next-hop.

Recall Solution
's neighbours are (link 4) and (link 6).
- Via : .
- Via : .
- , next-hop .
Why wins even though is the destination: the direct link (6) is more expensive than hopping through (4+1=5). The cheapest route need not be the direct one.
Exercise 2.2 (L2)
X—Y = 2, Y—Z = 2, X—Z = 3. Run one Bellman-Ford update for given , .
Recall Solution
- Via : .
- Via : .
- , next-hop (the direct link wins this time).
Exercise 2.3 (L2)
A router hears from neighbour (link cost 5): "", and from neighbour (link cost 2): "". What does this router set as its cost to ?
Recall Solution
- Via : (adding to infinity stays infinity — no route through a dead-end).
- Via : .
- , next-hop .
Level 3 — Analysis
Exercise 3.1 (L3)
A — B — C, all links cost 1. The link B–C breaks. Without split horizon, trace and for the first three exchanges. Explain why 's first post-break value is 3, not ∞.

Recall Solution
| Exchange | Why | ||
|---|---|---|---|
| steady state | 1 (direct) | 2 (via B) | before break |
| after break | 3 | 2 | see below |
| next | 3 | 4 | trusts 's new 3 |
| next | 5 | 4 | trusts 's new 4 |
Why 's value becomes 3, not ∞: the moment B–C dies, would set — but had earlier advertised "". does not know that 's route to physically passed through itself. So computes "reach via " . This is a phantom route that loops . That is the count-to-infinity bug: bad news crawls up one step per exchange.
Exercise 3.2 (L3)
Explain why Distance Vector routing can suffer count-to-infinity but Dijkstra's Algorithm (used in Link-State Routing (OSPF)) never does.
Recall Solution
Dijkstra runs on a router that already holds the entire topology map, so it can see that a link is gone before recomputing — no stale second-hand estimate can survive. DV routers only ever hear local neighbour summaries ( numbers) and cannot tell whether that summary secretly loops back through themselves. The missing global view is precisely what lets a phantom route persist and count upward. This is why DV = distributed Bellman-Ford Algorithm while OSPF = local Dijkstra's Algorithm.
Level 4 — Synthesis
Exercise 4.1 (L4)
Repeat Exercise 3.1's break, but now with split horizon. Show that marks unreachable immediately, and explain the mechanism.
Recall Solution
Split horizon rule: never advertise a route back to the neighbour you learned it from. learned via , so advertises "" to (while still telling the outside world 2).
- When B–C dies, looks for alternatives. Its only other neighbour is , and has told that .
- So computes via : . No phantom route exists.
- sets immediately — no counting.
Mechanism: the looping estimate was never injected back to in the first place, so there is nothing to ping-pong.
Exercise 4.2 (L4)
Consider a triangle A—B—C—A, all links cost 1, all routers using split horizon. The route from all three to a destination attached to dies. Argue whether split horizon alone guarantees no count-to-infinity here.

Recall Solution
It does NOT guarantee safety. Split horizon only breaks 2-node loops (the ping-pong). In a triangle, bad news can circulate the long way around: when loses , might still hold a stale route " via ", and a stale route " via " — each learned it from a different neighbour than the one they advertise back to, so split horizon does not silence them. The stale cost then crawls upward around the ring toward 16. This is exactly why RIP also needs the hard 16-cap plus triggered updates and hold-down timers.
Level 5 — Mastery
Exercise 5.1 (L5)
A network has nodes. Give the guaranteed maximum number of DV exchanges needed for good news (a new shortest path) to reach every node, and justify it from first principles using the Principle of Optimality.
Recall Solution
At most exchanges. Justification: a direct neighbour of destination learns the true cost after 1 exchange (it already knows ). A node 2 hops away learns after 2 exchanges, and in general a node hops away after exchanges. Any shortest path in an -node graph has at most edges (a longer path would revisit a node, and by the Principle of Optimality a shortest path never needs to repeat a node — repeating means a removable loop of non-negative cost). So after exchanges, every shortest path is discovered. This is exactly the Bellman-Ford Algorithm iteration bound and connects DV to Dynamic Programming (each exchange = one BF relaxation round).
Exercise 5.2 (L5)
Design a concrete link-cost scenario on P—Q = 10, Q—R = 10, P—R = 10 where, from 's perspective, the cheapest route to is not the direct link. If impossible, prove it. Then generalise the condition.
Recall Solution
With those exact symmetric costs it's impossible from : via costs direct, so the direct link (10) wins. To make the 2-hop route win we need .
A working redesign: set P—R = 25, keep P—Q = 10, Q—R = 10. Now:
- Direct: .
- Via : .
- , next-hop .
General condition (triangle inequality violation): the direct link is not on the shortest path exactly when some neighbour satisfies . In metric graphs where the triangle inequality holds tightly this never happens; DV routing is what automatically discovers such shortcuts without any node seeing the full graph. Contrast with BGP, which routes on policy (business relationships), not pure cost.
Recall Master check: one line summary
Distance Vector ::: distributed Bellman-Ford — each router keeps (dest, cost, next-hop), shares its whole vector with neighbours only, minimises ; suffers count-to-infinity, patched by split horizon, poison reverse, and RIP's 16-cap.