Vous êtes sur la page 1sur 44

Distance-Vector Routing

Antonio Carzaniga
Faculty of Informatics University of Lugano

May 12, 2009

20052007

Antonio Carzaniga

Outline
Recap on link-state routing Distance-vector routing Bellman-Ford equation Distance-vector algorithm Examples

20052007

Antonio Carzaniga

Recap on Routing
Goal: each router u must be able to compute, for each other router v, the next-hop neighbor x that is on the least-cost path from u to v

20052007

Antonio Carzaniga

Recap on Routing
Goal: each router u must be able to compute, for each other router v, the next-hop neighbor x that is on the least-cost path from u to v v

20052007

Antonio Carzaniga

Recap on Routing
Goal: each router u must be able to compute, for each other router v, the next-hop neighbor x that is on the least-cost path from u to v v x3 x4 u x2 x1

20052007

Antonio Carzaniga

Recap on Routing
Goal: each router u must be able to compute, for each other router v, the next-hop neighbor x that is on the least-cost path from u to v v x3 x4 u x2 x1

20052007

Antonio Carzaniga

Recap on Link-State Routing

20052007

Antonio Carzaniga

Recap on Link-State Routing


Every router broadcast a link-state advertisement (LSA) containing the costs of its adjacent links

20052007

Antonio Carzaniga

Recap on Link-State Routing


Every router broadcast a link-state advertisement (LSA) containing the costs of its adjacent links Routers use LSAs from other routers to compile an image of the entire network

20052007

Antonio Carzaniga

Recap on Link-State Routing


Every router broadcast a link-state advertisement (LSA) containing the costs of its adjacent links Routers use LSAs from other routers to compile an image of the entire network With a complete knowledge of the network topology, routers perform a local computation (Dijkstras algorithm) to nd the least-cost paths to every other router

20052007

Antonio Carzaniga

Recap on Link-State Routing


Every router broadcast a link-state advertisement (LSA) containing the costs of its adjacent links Routers use LSAs from other routers to compile an image of the entire network With a complete knowledge of the network topology, routers perform a local computation (Dijkstras algorithm) to nd the least-cost paths to every other router In essence

broadcast transmission of topology information global knowledge of the network local computation
20052007 Antonio Carzaniga

Changes in Link Costs

20052007

Antonio Carzaniga

Changes in Link Costs


Routers monitor the state of their adjacent links

e.g., measuring the round-trip time using a local ping protocol

20052007

Antonio Carzaniga

Changes in Link Costs


Routers monitor the state of their adjacent links

e.g., measuring the round-trip time using a local ping protocol

The measured costs are used to build LSAs, which are issued also at regular intervals

20052007

Antonio Carzaniga

Changes in Link Costs


Routers monitor the state of their adjacent links

e.g., measuring the round-trip time using a local ping protocol

The measured costs are used to build LSAs, which are issued also at regular intervals Changes in link costs are propagated quickly to all routers Routers can then react by recomputing paths and by updating their forwarding tables accordingly

in fact, this reaction is not dierent from the normal behavior of the protocol

20052007

Antonio Carzaniga

Distance-Vector Routing

20052007

Antonio Carzaniga

Distance-Vector Routing
Every router u maintains a distance vector

v is a destination node in the network Du [v] is the best known distance between u and v nu [v] is the next-hop router on the best known path to v

20052007

Antonio Carzaniga

Distance-Vector Routing
Every router u maintains a distance vector

v is a destination node in the network Du [v] is the best known distance between u and v nu [v] is the next-hop router on the best known path to v

Routers exchange their distance vectors with their neighbors

20052007

Antonio Carzaniga

Distance-Vector Routing
Every router u maintains a distance vector

v is a destination node in the network Du [v] is the best known distance between u and v nu [v] is the next-hop router on the best known path to v

Routers exchange their distance vectors with their neighbors If the distance vector of a neighbor leads to a better path to some destinations, the router updates its distance vector and sends it out again to its neighbors

20052007

Antonio Carzaniga

Distance-Vector Routing
Every router u maintains a distance vector

v is a destination node in the network Du [v] is the best known distance between u and v nu [v] is the next-hop router on the best known path to v

Routers exchange their distance vectors with their neighbors If the distance vector of a neighbor leads to a better path to some destinations, the router updates its distance vector and sends it out again to its neighbors After a number of iterations, the algorithm converges to a point where every router has a minimal distance vector

20052007

Antonio Carzaniga

Distance-Vector Routing

20052007

Antonio Carzaniga

Distance-Vector Routing
Local transmission of topology information

routers exchange their distance vectors only with their neighbors no broadcast protocol needed (a local broadcast can be useful)

20052007

Antonio Carzaniga

Distance-Vector Routing
Local transmission of topology information

routers exchange their distance vectors only with their neighbors no broadcast protocol needed (a local broadcast can be useful)

Local knowledge of the network

router u knows its distance Du [v] and the rst step along that path router u does not know about any link cost except its adjacent links

20052007

Antonio Carzaniga

Distance-Vector Routing
Local transmission of topology information

routers exchange their distance vectors only with their neighbors no broadcast protocol needed (a local broadcast can be useful)

Local knowledge of the network

router u knows its distance Du [v] and the rst step along that path router u does not know about any link cost except its adjacent links

Global computation

the computation is actually distributed

20052007

Antonio Carzaniga

Intuition

20052007

Antonio Carzaniga

Intuition
The main idea behind the distance-vector algorithm is expressed well by the Bellman-Ford equation
Du [v] = xneighbors(u)

min

(c(u, x) + Dx [v])

20052007

Antonio Carzaniga

Intuition
The main idea behind the distance-vector algorithm is expressed well by the Bellman-Ford equation
Du [v] = xneighbors(u)

min

(c(u, x) + Dx [v])

v x3 x4 u x2 x1
20052007 Antonio Carzaniga

Intuition
The main idea behind the distance-vector algorithm is expressed well by the Bellman-Ford equation
Du [v] = xneighbors(u)

min

(c(u, x) + Dx [v])

18 x3 6 u x2 1 x4 25 20 x1
20052007 Antonio Carzaniga

Distance-Vector Algorithm
Executing locally at node u

20052007

Antonio Carzaniga

Distance-Vector Algorithm
Executing locally at node u Variables storing values known at each iteration

20052007

Antonio Carzaniga

Distance-Vector Algorithm
Executing locally at node u Variables storing values known at each iteration

Du [v], cost of the least-cost path from u to v (distance vector)

20052007

Antonio Carzaniga

Distance-Vector Algorithm
Executing locally at node u Variables storing values known at each iteration

Du [v], cost of the least-cost path from u to v (distance vector) nu [v], next-hop node (neighbor of u) on the least-cost path from u to v

20052007

Antonio Carzaniga

Distance-Vector Algorithm
Executing locally at node u Variables storing values known at each iteration

Du [v], cost of the least-cost path from u to v (distance vector) nu [v], next-hop node (neighbor of u) on the least-cost path from u to v Dx [v], distance vectors of every neighbor node x

20052007

Antonio Carzaniga

Distance-Vector Algorithm: Initialization


Initialization 1 for v V 2 do if v neighbors(u) 3 then Du [v] c(u, v) 4 nu [v] v 5 else Du [v] 6 for x neighbors(u) 7 do for v V 8 do Dx [v] 9 send Du to all neighbor nodes

20052007

Antonio Carzaniga

Distance-Vector Algorithm: Loop


1 when Dx is received from neighbor x 2 do Dx Dx 3 for v N 4 do Du [v] minxneighbors(u)(c(u, x) + Dx [v]) 5 if Du was updated 6 then send Du to all neighbor nodes

7 when link cost c(u, x) changes 8 do for v N 9 do Du [v] minxneighbors(u)(c(u, x) + Dx [v]) 10 if Du was updated 11 then send Du to all neighbor nodes

20052007

Antonio Carzaniga

Distance-Vector Algorithm: Du Update


updating Du : v N : Du [v] minxneighbors(u)(c(u, x) + Dx [v])
1 2 3 4 5 6 7 updated false for v N do for x neighbors(u) do if Du [v] > c(u, x) + Dx [v] then Du [v] c(u, x) + Dx [v] nu [v] x updated true

20052007

Antonio Carzaniga

Example

b 2 a

c 6

20052007

Antonio Carzaniga

Example
a Da Db Dd b Db Da Dc c Dc Db Dd d Dd Da Dc a 0 a 2 a a 4 b 2 b 0 b 1 b c c 1 c 0 c 6 d 4 d d 6 d 0 b 2 a 4

c 6 d

20052007

Antonio Carzaniga

Example
a Da Db Dd b Db Da Dc c Dc Db Dd d Dd Da Dc a 0 a 2 a a 4 b 2 b 0 b 1 b c c 1 c 0 c 6 d 4 d d 6 d 0 a Da Db Dd b Db Da Dc c Dc Db Dd d Dd Da Dc a 0 2 4 a 2 0 a 3 2 4 a 4 0 b 2 0 b 0 2 1 b 1 0 b 6 2 1 c 3 1 6 c 1 0 c 0 1 6 c 6 0 d 4 0 d 6 4 6 d 6 0 d 0 4 6 b 2 a 4

c 6 d

20052007

Antonio Carzaniga

Example
a Da Db Dd b Db Da Dc c Dc Db Dd d Dd Da Dc a 0 a 2 a a 4 b 2 b 0 b 1 b c c 1 c 0 c 6 d 4 d d 6 d 0 a Da Db Dd b Db Da Dc c Dc Db Dd d Dd Da Dc a 0 2 4 a 2 0 a 3 2 4 a 4 0 b 2 0 b 0 2 1 b 1 0 b 6 2 1 c 3 1 6 c 1 0 c 0 1 6 c 6 0 d 4 0 d 6 4 6 d 6 0 d 0 4 6 a Da Db Dd b Db Da Dc c Dc Db Dd d Dd Da Dc a 0 2 4 a 2 0 3 a 3 2 4 a 4 0 3 b 2 0 6 b 0 2 1 b 1 0 6 b 6 2 1 c 3 1 6 c 1 3 0 c 0 1 6 c 6 3 0 d 4 6 0 d 6 4 6 d 6 6 0 d 0 4 6

20052007

Antonio Carzaniga

Example (2)

b 2 a

c 9

20052007

Antonio Carzaniga

Example (2)
a Da Db Dd b Db Da Dc c Dc Db Dd d Dd Da Dc a 0 a 2 a a 4 b 2 b 0 b 1 b c c 1 c 0 c 9 d 4 d d 9 d 0 b 2 a 4

c 9 d

20052007

Antonio Carzaniga

Example (2)
a Da Db Dd b Db Da Dc c Dc Db Dd d Dd Da Dc a 0 a 2 a a 4 b 2 b 0 b 1 b c c 1 c 0 c 9 d 4 d d 9 d 0 a Da Db Dd b Db Da Dc c Dc Db Dd d Dd Da Dc a 0 2 4 a 2 0 a 3 2 4 a 4 0 b 2 0 b 0 2 1 b 1 0 b 6 2 1 c 3 1 9 c 1 0 c 0 1 9 c 9 0 d 4 0 d 6 4 9 d 9 0 d 0 4 9 b 2 a 4

c 9 d

20052007

Antonio Carzaniga

Example (2)
a Da Db Dd b Db Da Dc c Dc Db Dd d Dd Da Dc a 0 a 2 a a 4 b 2 b 0 b 1 b c c 1 c 0 c 9 d 4 d d 9 d 0 a Da Db Dd b Db Da Dc c Dc Db Dd d Dd Da Dc a 0 2 4 a 2 0 a 3 2 4 a 4 0 b 2 0 b 0 2 1 b 1 0 b 6 2 1 c 3 1 9 c 1 0 c 0 1 9 c 9 0 d 4 0 d 6 4 9 d 9 0 d 0 4 9 a Da Db Dd b Db Da Dc c Dc Db Dd d Dd Da Dc a 0 2 4 a 2 0 3 a 3 2 4 a 4 0 3 b 2 0 6 b 0 2 1 b 1 0 6 b 6 2 1 c 3 1 9 c 1 3 0 c 0 1 9 c 7 3 0 d 4 6 0 d 6 4 9 d 7 6 0 d 0 4 9

20052007

Antonio Carzaniga

Vous aimerez peut-être aussi