2079 3

CSC263 ยท 2079 ยท 10 marks

Explain distance vector routing with example.

Explain distance vector routing with example.[10]

Computer NetworksChapter 4: Network LayerTypes of Routing

Quick answer

Distance Vector Routing is a dynamic routing algorithm where each router maintains a routing table (distance vector) that contains: - The destination network/node - The distance (cost/hop count) to reach that destination - The direction (vector) i.e., the next hop (outgoing interface) to reach that destination

Distance Vector Routing

Definition

Each router shares its routing table only with its directly connected neighbors at regular intervals. Based on the received information, each router updates its own table. This process continues until all routers have consistent, stable routing tables -- a state called convergence.

Distance Vector Routing uses the Bellman-Ford Algorithm to compute shortest paths.


Key Characteristics

FeatureDescription
Algorithm usedBellman-Ford
Information sharedOnly with direct neighbors
Traffic overheadLess (compared to Link State)
Convergence speedSlower
ConfigurationEasy
Hierarchical structureNo
Example protocolRIP (max 15 hops)

How It Works (Step-by-Step)

  1. Initialization: Each router knows only the cost to its directly connected neighbors. All other destinations are set to infinity (unknown).
  2. Advertisement: Each router sends its entire routing table to all directly connected neighbors periodically.
  3. Update: When a router receives a neighbor's table, it applies the Bellman-Ford equation:

$$D(x, y) = \min_{v} { c(x, v) + D(v, y) }$$

Where:

  • $D(x, y)$ = estimated cost from node $x$ to destination $y$
  • $c(x, v)$ = cost from $x$ to neighbor $v$
  • $D(v, y)$ = neighbor $v$'s advertised cost to reach $y$
  1. Repeat until no more updates occur (convergence).

Example

Consider the following network with 4 routers: A, B, C, D and the link costs shown below:

    A ---2--- B
    |         |
    4         1
    |         |
    D ---3--- C

Link costs:

  • A -- B = 2
  • A -- D = 4
  • B -- C = 1
  • D -- C = 3

Step 1: Initial Routing Tables (Each router knows only direct neighbors)

Router A:

DestinationCostNext Hop
A0-
B2B
Cinf-
D4D

Router B:

DestinationCostNext Hop
A2A
B0-
C1C
Dinf-

Router C:

DestinationCostNext Hop
Ainf-
B1B
C0-
D3D

Router D:

DestinationCostNext Hop
A4A
Binf-
C3C
D0-

Step 2: First Exchange -- Routers share tables with neighbors

Router A updates using tables received from B and D:

  • A to C via B: cost(A,B) + cost(B,C) = 2 + 1 = 3 (better than inf) --> update
  • A to C via D: cost(A,D) + cost(D,C) = 4 + 3 = 7 (worse than 3) --> ignore
  • A to D via B: cost(A,B) + cost(B,D) = 2 + inf = inf --> no update
  • A to B via D: cost(A,D) + cost(D,B) = 4 + inf = inf --> no update

Updated Router A Table:

DestinationCostNext Hop
A0-
B2B
C3B
D4D

Router B updates using tables from A and C:

  • B to D via A: cost(B,A) + cost(A,D) = 2 + 4 = 6 (better than inf) --> update
  • B to D via C: cost(B,C) + cost(C,D) = 1 + 3 = 4 (better than 6) --> update

Updated Router B Table:

DestinationCostNext Hop
A2A
B0-
C1C
D4C

Router C updates using tables from B and D:

  • C to A via B: cost(C,B) + cost(B,A) = 1 + 2 = 3 (better than inf) --> update
  • C to A via D: cost(C,D) + cost(D,A) = 3 + 4 = 7 --> ignore

Updated Router C Table:

DestinationCostNext Hop
A3B
B1B
C0-
D3D

Router D updates using tables from A and C:

  • D to B via A: cost(D,A) + cost(A,B) = 4 + 2 = 6 (better than inf) --> update
  • D to B via C: cost(D,C) + cost(C,B) = 3 + 1 = 4 (better than 6) --> update

Updated Router D Table:

DestinationCostNext Hop
A4

Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.