COMPUTER NETWORKS/Student Engineering Notebook
Page 09·notes
ROUTING PROTOCOLS & ALGORITHMS—~24 MIN READ

Distance Vector vs Link State Routing: Algorithms & Traps

“Bellman-Ford updates, count-to-infinity, split horizon, and Dijkstra SPF.”

1.Distance Vector Routing & Bellman-Ford Principle

Distance Vector is a decentralized routing algorithm where each router maintains a table (vector) of minimum distances to all known destinations. Periodically (e.g., every 30s in RIP), each node sends its entire routing table ONLY to its immediate neighbors.

Bellman-Ford Equation: Let D_x(y) be the cost of the least-cost path from node x to node y. D_x(y) = min_v { c(x, v) + D_v(y) }, where the minimum is taken over all neighbors v of x, and c(x, v) is the direct link cost from x to v.

The Count-to-Infinity Problem: Good news travels fast, but bad news travels agonizingly slow. When a link breaks (cost increases to infinity), adjacent routers may exchange outdated mutual vectors, incrementing distance by 1 at each iteration until reaching infinity (RIP defines infinity as 16 hops).

Mitigations: Split Horizon (never advertise a route back out the same interface through which it was learned) and Poison Reverse (actively advertise a distance of infinity back to the next-hop neighbor).

2. Routing Paradigm Comparison: Distance Vector vs Link State

Core architectural differences between RIP (Distance Vector) and OSPF (Link State):

DimensionDistance Vector (RIP)Link State (OSPF)
Underlying AlgorithmDistributed Bellman-Ford equationDijkstra Shortest Path First (SPF)
Knowledge ScopeTells neighbors about the entire worldTells the entire world about its local neighbors
Topology AwarenessHas NO map of full network; routes on hearsayEvery router builds complete identical network graph
Convergence SpeedSlow (susceptible to routing loops)Fast (no count-to-infinity issue)
Message OverheadPeriodic broadcasts of full routing tablesTriggered Link State Advertisements (LSA)
MetricHop count (maximum 15 hops; 16 = infinity)Cost based on reference bandwidth (100 Mbps / Bandwidth)
WORKED EXAM ANALYSIS · STEP-BY-STEP DERIVATION

3. GATE Worked Numerical: Distance Vector Routing Table Update

⚠️ Pitfall Warning:

When applying Bellman-Ford update from neighbor vector, don't forget to ADD the link cost to that neighbor before comparing against current known distance!

Problem: Node X is connected to neighbors A, B, and C with direct link costs: c(X, A) = 2, c(X, B) = 5, c(X, C) = 1.

Node X receives distance vectors from A, B, and C with costs to destination D:

D_A(D) = 6, D_B(D) = 2, D_C(D) = 8.

Compute X's new minimum distance to destination D and the next-hop router.

Step 1: Compute candidate costs through each neighbor:

Path via A: c(X, A) + D_A(D) = 2 + 6 = 8.

Path via B: c(X, B) + D_B(D) = 5 + 2 = 7.

Path via C: c(X, C) + D_C(D) = 1 + 8 = 9.

Step 2: D_X(D) = min(8, 7, 9) = 7.

Step 3: Minimum cost is 7 via neighbor B. Node X updates its routing table entry for destination D: Cost = 7, Next Hop = B.

WORKED NUMERICAL · STUDENT DERIVATION✎ Key Takeaway: Distance vector uses only neighbours' vectors; link state floods the whole topology and runs Dijkstra locally.

Worked example: one distance vector update

Problem Statement:
Router A reaches B at cost 2 and C at cost 7. B says its distance to D is 5; C says its distance to D is 1. What is A's new distance to D?
Step 1: Bellman-Ford equation

d_A(D) = min over neighbours v of [cost(A, v) + d_v(D)].

Step 2: Through B

2 + 5.

7
Step 3: Through C

7 + 1.

8
Step 4: Take the minimum

Choose B as the next hop.

min(7, 8)
↳ Result: 7 via B
Final Answer:d_A(D) = 7, next hop B
STUDENT PRACTICE · CONCEPT DRILL

Practice: test yourself

Original practice questions in the GATE style, with worked explanations. Not past-paper questions.

Problem 1 · FOUNDATION

The count-to-infinity problem affects:

Problem 2 · GATE-LEVEL

Link state routers compute their routes with:

Problem 3 · TRICKY

A and B are directly linked at cost 1, and B is linked to C at cost 1. The B–C link fails. With no split horizon and costs counting to infinity at 16 (as in RIP), what is the largest finite cost B will hold for C before it gives up?

SOURCE TRANSPARENCY & CITATIONS

Primary Academic References & Exam Sources

Every concept in Notes From a B.Tech Brain is synthesized from authoritative academic texts, seminal peer-reviewed research, verified exam archives, and renowned university lectures.

Curated University Lecture Series
Computer Networks: A Systems Approach (6th Edition) ·
LECTURE SERIES
RECOMMENDED YOUTUBE EDUCATORS & FULL-COURSE PLAYLISTS

Curated for clarity, rigorous numerical solving, and semester excellence:

Knowledge Gate · Computer Networks for GATE↗Instructor: Sanchit Jain · Covers: OSI/TCP-IP layers, sliding window, CRC, subnetting, TCP congestion control

GATE-level numerical drilling and PYQ analysis.

Open YouTube↗
Gate Smashers · Computer Networks Full Course↗Instructor: Varun Singla · Covers: Ethernet, IP addressing, routing algorithms, TCP/UDP, DNS & HTTP

Step-by-step conceptual walkthroughs with worked GATE numericals.

Open YouTube↗
Neso Academy · Computer Networks Series↗Instructor: Neso Academy · Covers: Data link layer, framing, error detection, medium access, TCP/IP

Clear whiteboard lectures for foundational and semester exam coverage.

Open YouTube↗