Routing - Bellmanford

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

CS144

An Introduc/on to Computer Networks


Rou$ng
Distance Vector Protocol:
Bellman Ford algorithm
Nick McKeown
Professor of Electrical Engineering
and Computer Science, Stanford University

CS144, Stanford University

Problem: How can routers work together


to nd minimum cost spanning tree?
B

A
1

R1
2

R2
2

R3

R4

R6

R5

R7

R8

Equivalent to nding minimum


cost spanning tree among routers only

R1
2

R2
2

R3

R4

R6

R5

R7

R8

The Distributed Bellman-Ford Algorithm


Example: Find min-cost spanning tree to R8
Assume routers know cost of link to each neighbor.
Router Ri maintains value cost Ci to reach R8.
Vector C=(C1, C2,C7) is the distance vector to R8.
Ini/ally, set C = (, , ).
1. A\er T seconds, Ri sends Ci to its neighbors.
2. If Ri learns lower cost path, update Ci.
3. Repeat.
Natural extension to calculate tree for R1 R7.

An example
1

R1
4

R2
1

R3

R4

R6

R5

R7

R8

R1

R1

R1

8, R3

R1

8, R3

R1

7, R2

R1

6, R4

R2

R2

R2

7, R5

R2

6, R4

R2

5, R5

R2

5, R5

R3

R3

R3

R3

R3

R3

R4

R4

R4

2, R7

R4

2, R7

R4

2, R7

R4

2, R7

R5

R5

R5

R5

4, R4

R5

4, R4

R5

4, R4

R6

R6

R6

R6

R6

R6

R7

R7

R7

R7

R7

R7

Distributed
Bellman-Ford Algorithm
Ques/ons:
1.
2.
3.

What is the maximum run /me of the


algorithm?
Will the algorithm always converge?
What happens when link costs change, or when
routers/links fail?

A Problem with Bellman-Ford


Bad news travels slowly
R1

R2

R3

R4

Consider the calcula/on of distances to R4:


Time

R1

R2

R3

3,R2

2,R3

1, R4

3,R2

2,R3

3,R2

3,R2

4,R3

3,R2

5,R2

4,R3

5,R2


Coun/ng
to innity

Link R3

R4 fails

Coun/ng to Innity Problem


Solu9ons

1.
2.
3.
4.

Set innity = some small integer (e.g. 16).


Stop when count = 16.
Split Horizon: Because R2 received lowest cost path
from R3, it does not adver/se cost to R3.
Split-horizon with poison reverse: R2 adver/ses
innity to R3.
There are many problems with (and xes for) the
Bellman-Ford algorithm.

Bellman Ford in prac/ce


Bellman-Ford algorithm is an example of a Distance
Vector algorithm.
It was used in the rst Internet rou/ng protocol,
called Rou/ng Informa/on Protocol (RIP).
It requires very ligle computa/on on the routers, is
distributed, and will eventually converged.
Over /me it was replaced by algorithms that
calculate the en/re spanning tree at each router.

CS144, Stanford University

You might also like