Back to the 2024 paper

Module 3: Network Layer & Routing

20247m

Explain the distance vector routing for the following example.

Distance Vector Routing Diagram

Worked SolutionAI Assisted

Distance vector routing: worked example

Network from the figure (link costs): A–B = 5, A–C = 2, A–D = 3, B–C = 4, B–E = 3, C–E = 4.

Principle

In distance vector routing each router keeps a table of the best-known distance to every destination and the next hop. Periodically it sends its vector (distance to all nodes) only to its direct neighbours. Each router then applies the Bellman-Ford equation:

Dₓ(y) = min over neighbours v of { c(x, v) + Dᵥ(y) }

The process repeats until no table changes (convergence).

Step 0: initial vectors (only direct neighbours known, ∞ = unknown)

Order: [A, B, C, D, E]

Router A B C D E
A 0 5 2 3 ∞
B 5 0 4 ∞ 3
C 2 4 0 ∞ 4
D 3 ∞ ∞ 0 ∞
E ∞ 3 4 ∞ 0

Step 1: after the first exchange (using neighbours' initial vectors)

Example calculations:

  • A → E: via B = 5 + 3 = 8; via C = 2 + 4 = 6; via D = 3 + ∞. Minimum = 6 (via C).
  • B → D: via A = 5 + 3 = 8; via C = 4 + ∞; via E = 3 + ∞. Minimum = 8 (via A).
  • C → D: via A = 2 + 3 = 5.
  • D → B: via A = 3 + 5 = 8; D → C: via A = 3 + 2 = 5.
  • E → A: via B = 3 + 5 = 8; via C = 4 + 2 = 6.
Router A B C D E
A 0 5 2 3 6
B 5 0 4 8 3
C 2 4 0 5 4
D 3 8 5 0 ∞
E 6 3 4 ∞ 0

Step 2: after the second exchange

  • D → E: via A = 3 + 6 = 9.
  • E → D: via B = 3 + 8 = 11; via C = 4 + 5 = 9.

All other entries are unchanged.

Step 3: third exchange gives no change, so the tables have converged

Final routing tables (destination: cost via next hop)

Router To A To B To C To D To E
A 0 5 (B) 2 (C) 3 (D) 6 (C)
B 5 (A) 0 4 (C) 8 (A) 3 (E)
C 2 (A) 4 (B) 0 5 (A) 4 (E)
D 3 (A) 8 (A) 5 (A) 0 9 (A)
E 6 (C) 3 (B) 4 (C) 9 (C) 0

Example: the best A→E path is A → C → E with cost 2 + 4 = 6. The best D→E path is D → A → C → E with cost 3 + 2 + 4 = 9.

Remarks

  • Each router knows only its neighbours and their vectors, not the whole topology.
  • Count-to-infinity: if a link fails, wrong information may circulate slowly; it is reduced with split horizon, poison reverse, and triggered updates.
  • The protocol used in practice for this method is RIP.

Similar questions

Budget AppAndroid App

Pocketly on Android

Log daily food, travel, and hostel expenses instantly. Set monthly spending limits and see where your money goes without complex spreadsheets.