CSC263 ยท 2079 ยท 10 marks
Explain distance vector routing with example.
Explain distance vector routing with example.[10]
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
| Feature | Description |
|---|---|
| Algorithm used | Bellman-Ford |
| Information shared | Only with direct neighbors |
| Traffic overhead | Less (compared to Link State) |
| Convergence speed | Slower |
| Configuration | Easy |
| Hierarchical structure | No |
| Example protocol | RIP (max 15 hops) |
How It Works (Step-by-Step)
- Initialization: Each router knows only the cost to its directly connected neighbors. All other destinations are set to infinity (unknown).
- Advertisement: Each router sends its entire routing table to all directly connected neighbors periodically.
- 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$
- 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:
| Destination | Cost | Next Hop |
|---|---|---|
| A | 0 | - |
| B | 2 | B |
| C | inf | - |
| D | 4 | D |
Router B:
| Destination | Cost | Next Hop |
|---|---|---|
| A | 2 | A |
| B | 0 | - |
| C | 1 | C |
| D | inf | - |
Router C:
| Destination | Cost | Next Hop |
|---|---|---|
| A | inf | - |
| B | 1 | B |
| C | 0 | - |
| D | 3 | D |
Router D:
| Destination | Cost | Next Hop |
|---|---|---|
| A | 4 | A |
| B | inf | - |
| C | 3 | C |
| D | 0 | - |
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:
| Destination | Cost | Next Hop |
|---|---|---|
| A | 0 | - |
| B | 2 | B |
| C | 3 | B |
| D | 4 | D |
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:
| Destination | Cost | Next Hop |
|---|---|---|
| A | 2 | A |
| B | 0 | - |
| C | 1 | C |
| D | 4 | C |
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:
| Destination | Cost | Next Hop |
|---|---|---|
| A | 3 | B |
| B | 1 | B |
| C | 0 | - |
| D | 3 | D |
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:
| Destination | Cost | Next Hop |
|---|---|---|
| A | 4 |
Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.