Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router...

44
Distance-Vector Routing Antonio Carzaniga Faculty of Informatics Università della Svizzera italiana December 13, 2017

Transcript of Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router...

Page 1: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

Distance-Vector Routing

Antonio Carzaniga

Faculty of InformaticsUniversità della Svizzera italiana

December 13, 2017

Page 2: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

Outline

Recap on link-state routing

Distance-vector routing

Bellman-Ford equation

Distance-vector algorithm

Examples

Page 3: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

Recap on Routing

Goal: each router umust compute, for every other router v, the next-hopneighbor x that is on the least-cost path from u to v

u

Page 4: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

Recap on Routing

Goal: each router umust compute, for every other router v, the next-hopneighbor x that is on the least-cost path from u to v

u

v

Page 5: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

Recap on Routing

Goal: each router umust compute, for every other router v, the next-hopneighbor x that is on the least-cost path from u to v

u

v

x1x2

x3

x4

Page 6: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

Recap on Routing

Goal: each router umust compute, for every other router v, the next-hopneighbor x that is on the least-cost path from u to v

u

v

x1x2

x3

x4

Page 7: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

Recap on Link-State Routing

Page 8: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

Recap on Link-State Routing

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

Page 9: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

Recap on Link-State Routing

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

Routers use LSAs from other routers to compile an image of the entire network

Page 10: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

Recap on Link-State Routing

Every router broadcast a link-state advertisement (LSA) containing the costs of itsadjacent 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 localcomputation (Dijkstra’s algorithm) to find the least-cost paths to every otherrouter

Page 11: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

Recap on Link-State Routing

Every router broadcast a link-state advertisement (LSA) containing the costs of itsadjacent 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 localcomputation (Dijkstra’s algorithm) to find the least-cost paths to every otherrouter

In essence

◮ broadcast transmission of topology information

◮ global knowledge of the network

◮ local computation

Page 12: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

Changes in Link Costs

Page 13: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

Changes in Link Costs

Routers monitor the state of their adjacent links

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

Page 14: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

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 regularintervals

Page 15: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

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 regularintervals

Changes in link costs are propagated quickly to all routers

Routers can then react by recomputing paths and by updating their forwardingtables accordingly

◮ in fact, this “reaction” is not different from the normal behavior of the protocol

Page 16: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

Distance-Vector Routing

Page 17: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

Distance-Vector Routing

Every router umaintains 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

Page 18: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

Distance-Vector Routing

Every router umaintains 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

Page 19: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

Distance-Vector Routing

Every router umaintains 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

Page 20: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

Distance-Vector Routing

Every router umaintains 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 routerhas a minimal distance vector

Page 21: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

Distance-Vector Routing

Page 22: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

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)

Page 23: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

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 first step along that path

◮ router u does not know about any link cost except its adjacent links

Page 24: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

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 first step along that path

◮ router u does not know about any link cost except its adjacent links

Global computation

◮ the computation is actually distributed

Page 25: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

Intuition

Page 26: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

Intuition

The main idea behind the distance-vector algorithm is expressed well by theBellman-Ford equation

D′u[v] = minx∈neighbors(u)

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

Page 27: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

Intuition

The main idea behind the distance-vector algorithm is expressed well by theBellman-Ford equation

D′u[v] = minx∈neighbors(u)

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

u

v

x1x2

x3

x4

Page 28: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

Intuition

The main idea behind the distance-vector algorithm is expressed well by theBellman-Ford equation

D′u[v] = minx∈neighbors(u)

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

u

v

x1x2

x3

x4

31

62

20

18

25

Page 29: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

Distance-Vector Algorithm

Executing locally at node u

Page 30: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

Distance-Vector Algorithm

Executing locally at node u

Variables storing values known at each iteration

Page 31: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

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)

Page 32: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

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

Page 33: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

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

Page 34: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

Distance-Vector Algorithm: Initialization

✄ Initialization1 for v ∈ V2 do if v ∈ neighbors(u)3 then Du[v]← c(u, v)4 nu[v]← v5 else Du[v]← ∞6 for x ∈ neighbors(u)7 do for v ∈ V8 do Dx[v]← ∞9 send Du to all neighbor nodes

Page 35: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

Distance-Vector Algorithm: Loop

1 when D′x is received from neighbor x2 do Dx ← D′x3 for v ∈ N4 do Du[v]← minx∈neighbors(u)(c(u, x) + Dx[v])5 if Du was updated6 then send Du to all neighbor nodes

7 when link cost c(u, x) changes8 do for v ∈ N9 do Du[v]← minx∈neighbors(u)(c(u, x) + Dx[v])10 if Du was updated11 then send Du to all neighbor nodes

Page 36: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

Distance-Vector Algorithm: Du Update

✄ updating Du:✄ [v ∈ N : Du[v]← minx∈neighbors(u)(c(u, x) + Dx[v])

1 updated ← FALSE

2 for v ∈ N3 do for x ∈ neighbors(u)4 do if Du[v] > c(u, x) + Dx[v]5 then Du[v]← c(u, x) + Dx[v]6 nu[v]← x7 updated ← TRUE

Page 37: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

Example

a

b c

d

2

1

6

4

Page 38: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

Example

a a b c d

Da 0 2 ∞ 4Db ∞ ∞ ∞ ∞

Dd ∞ ∞ ∞ ∞

b a b c d

Db 2 0 1 ∞

Da ∞ ∞ ∞ ∞

Dc ∞ ∞ ∞ ∞

c a b c d

Dc ∞ 1 0 6Db ∞ ∞ ∞ ∞

Dd ∞ ∞ ∞ ∞

d a b c d

Dd 4 ∞ 6 0Da ∞ ∞ ∞ ∞

Dc ∞ ∞ ∞ ∞

a

b c

d

2

1

6

4

Page 39: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

Example

a a b c d

Da 0 2 ∞ 4Db ∞ ∞ ∞ ∞

Dd ∞ ∞ ∞ ∞

b a b c d

Db 2 0 1 ∞

Da ∞ ∞ ∞ ∞

Dc ∞ ∞ ∞ ∞

c a b c d

Dc ∞ 1 0 6Db ∞ ∞ ∞ ∞

Dd ∞ ∞ ∞ ∞

d a b c d

Dd 4 ∞ 6 0Da ∞ ∞ ∞ ∞

Dc ∞ ∞ ∞ ∞

a a b c d

Da 0 2 3 4Db 2 0 1 ∞

Dd 4 ∞ 6 0

b a b c d

Db 2 0 1 6

Da 0 2 ∞ 4Dc ∞ 1 0 6

c a b c d

Dc 3 1 0 6Db 2 0 1 ∞

Dd 4 ∞ 6 0

d a b c d

Dd 4 6 6 0Da 0 2 ∞ 4Dc ∞ 1 0 6

a

b c

d

2

1

6

4

Page 40: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

Example

a a b c d

Da 0 2 ∞ 4Db ∞ ∞ ∞ ∞

Dd ∞ ∞ ∞ ∞

b a b c d

Db 2 0 1 ∞

Da ∞ ∞ ∞ ∞

Dc ∞ ∞ ∞ ∞

c a b c d

Dc ∞ 1 0 6Db ∞ ∞ ∞ ∞

Dd ∞ ∞ ∞ ∞

d a b c d

Dd 4 ∞ 6 0Da ∞ ∞ ∞ ∞

Dc ∞ ∞ ∞ ∞

a a b c d

Da 0 2 3 4Db 2 0 1 ∞

Dd 4 ∞ 6 0

b a b c d

Db 2 0 1 6

Da 0 2 ∞ 4Dc ∞ 1 0 6

c a b c d

Dc 3 1 0 6Db 2 0 1 ∞

Dd 4 ∞ 6 0

d a b c d

Dd 4 6 6 0Da 0 2 ∞ 4Dc ∞ 1 0 6

a a b c d

Da 0 2 3 4Db 2 0 1 6Dd 4 6 6 0

b a b c d

Db 2 0 1 6Da 0 2 3 4Dc 3 1 0 6

c a b c d

Dc 3 1 0 6Db 2 0 1 6Dd 4 6 6 0

d a b c d

Dd 4 6 6 0Da 0 2 3 4Dc 3 1 0 6

Page 41: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

Example (2)

a

b c

d

2

1

9

4

Page 42: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

Example (2)

a a b c d

Da 0 2 ∞ 4Db ∞ ∞ ∞ ∞

Dd ∞ ∞ ∞ ∞

b a b c d

Db 2 0 1 ∞

Da ∞ ∞ ∞ ∞

Dc ∞ ∞ ∞ ∞

c a b c d

Dc ∞ 1 0 9Db ∞ ∞ ∞ ∞

Dd ∞ ∞ ∞ ∞

d a b c d

Dd 4 ∞ 9 0Da ∞ ∞ ∞ ∞

Dc ∞ ∞ ∞ ∞

a

b c

d

2

1

9

4

Page 43: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

Example (2)

a a b c d

Da 0 2 ∞ 4Db ∞ ∞ ∞ ∞

Dd ∞ ∞ ∞ ∞

b a b c d

Db 2 0 1 ∞

Da ∞ ∞ ∞ ∞

Dc ∞ ∞ ∞ ∞

c a b c d

Dc ∞ 1 0 9Db ∞ ∞ ∞ ∞

Dd ∞ ∞ ∞ ∞

d a b c d

Dd 4 ∞ 9 0Da ∞ ∞ ∞ ∞

Dc ∞ ∞ ∞ ∞

a a b c d

Da 0 2 3 4Db 2 0 1 ∞

Dd 4 ∞ 9 0

b a b c d

Db 2 0 1 6

Da 0 2 ∞ 4Dc ∞ 1 0 9

c a b c d

Dc 3 1 0 9Db 2 0 1 ∞

Dd 4 ∞ 9 0

d a b c d

Dd 4 6 9 0Da 0 2 ∞ 4Dc ∞ 1 0 9

a

b c

d

2

1

9

4

Page 44: Distance-Vector Routing - USI Informatics · 2017. 12. 13. · Distance-Vector Routing Every router u maintains a “distance vector” v is a destination node in the network Du[v]is

Example (2)

a a b c d

Da 0 2 ∞ 4Db ∞ ∞ ∞ ∞

Dd ∞ ∞ ∞ ∞

b a b c d

Db 2 0 1 ∞

Da ∞ ∞ ∞ ∞

Dc ∞ ∞ ∞ ∞

c a b c d

Dc ∞ 1 0 9Db ∞ ∞ ∞ ∞

Dd ∞ ∞ ∞ ∞

d a b c d

Dd 4 ∞ 9 0Da ∞ ∞ ∞ ∞

Dc ∞ ∞ ∞ ∞

a a b c d

Da 0 2 3 4Db 2 0 1 ∞

Dd 4 ∞ 9 0

b a b c d

Db 2 0 1 6

Da 0 2 ∞ 4Dc ∞ 1 0 9

c a b c d

Dc 3 1 0 9Db 2 0 1 ∞

Dd 4 ∞ 9 0

d a b c d

Dd 4 6 9 0Da 0 2 ∞ 4Dc ∞ 1 0 9

a a b c d

Da 0 2 3 4Db 2 0 1 6Dd 4 6 9 0

b a b c d

Db 2 0 1 6Da 0 2 3 4Dc 3 1 0 9

c a b c d

Dc 3 1 0 7

Db 2 0 1 6Dd 4 6 9 0

d a b c d

Dd 4 6 7 0Da 0 2 3 4Dc 3 1 0 9