CMPT 371

33
© Janice Regan, CMPT 128, 2007-2012 1 CMPT 371 Data Communications and Networking Routing 2

description

CMPT 371. Data Communications and Networking Routing 2. Distance Vector Routing. Each station (router) maintains a global routing table Routing table contains one entry for each station (router) in the network Each entry includes a measure of the ‘distance’ to a particular station (router) - PowerPoint PPT Presentation

Transcript of CMPT 371

Page 1: CMPT 371

© Janice Regan, CMPT 128, 2007-20121

CMPT 371Data Communications and Networking

Routing 2

Page 2: CMPT 371

Janice Regan © 2005-1012 2

Distance Vector RoutingEach station (router) maintains a global routing table

Routing table contains one entry for each station (router) in the network Each entry includes a measure of the ‘distance’

to a particular station (router) Periodically (or when its routing table

changes) each router sends a copy of its routing table to its neighbors

When updates (of neighbors routing tables) are received a routing algorithm is used to update the local routing table incorporating any changes from the recently received update

Page 3: CMPT 371

3Janice Regan © 2005-1012

Bellman Ford Algorithm Initialization

Update for each successive h≥0. For each v≠u compute

where

hxDxyyD xhx 0)()( ,,0

)],()([min

)( ,,1 wvcvDw

wD xhxh

linkshinvtoxfromnpropagatiofortleastvDbtoafromnpropagatiofortbac

pathinlinksnumberofimumhnodegneighborinaisw

nodeanyisvnodesourcetheisx

xh cos)(cos),(max

,

Page 4: CMPT 371

Janice Regan © 2005-1012 4

Bellman-Ford Algorithm: Find the minimum cost paths from station

A to every other station in the network below

II J LK

E F HG

B DC

2

4

3

2

5

1

6

6

2

4

4

8

5

3

44

2

2

4

A

4

Page 5: CMPT 371

Janice Regan © 2005-1012 5

(0,∞)

Initialization Set all paths from A to be ∞

II J LK

E F HG

B DC

2

4

3

2

5

1

6

6

2

4

4

8

5

3

44

2

2

4

A

4

(0,∞) (0,∞)

(0,∞)

(0,∞)

(0,∞)

(0,∞)

(0,∞)

(0,∞)

(0,∞)

(0,∞)

Page 6: CMPT 371

6Janice Regan © 2005-1012

T A B C D E F G H I J K L

A A 0 ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞

Page 7: CMPT 371

Find all minimum cost paths of length 1 hop from the station A

Janice Regan © 2005-1012 7

(0,∞)(A,5)

(0,∞)(0,∞)(A,2)

Iteration 1

II J LK

E F HG

B DC

2

4

3

2

5

1

6

6

2

4

4

8

5

3

44

2

2

4

A

4

(0,∞) (0,∞)

(0,∞)

(0,∞)

(0,∞)

(0,∞)

(0,∞)

(0,∞)(0,∞)

{ }B, E, F

(A,1)

Page 8: CMPT 371

8Janice Regan © 2005-1012

T A B C D E F G H I J K L

A A 0 ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞

BEF A 0 A 5 ∞ ∞ A 1 A 2 ∞ ∞ ∞ ∞ ∞ ∞

Page 9: CMPT 371

, E

(0,∞)

Find all minimum cost paths of length 2 hops from the station A

Janice Regan © 2005-1012 9(0,∞)(0,∞)(F,6)

(B,11)

(0,∞)

(A,5)

{ }, FB I, J,C,

(E,3)

(F,7)

Iteration 2

II J LK

E F HG

B DC

2

4

3

2

5

1

6

6

2

4

4

8

5

3

44

2

2

4

A

4

(0,∞)

(0,∞)

(0,∞)

(0,∞)(F,4)

(A,1)(B,9)(A,2)

(F,5)

KG

(F,6)

Page 10: CMPT 371

10Janice Regan © 2005-1012

T A B C D E F G H I J K L

A A 0 ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞

BEF A 0 A 5 ∞ ∞ A 1 A 2 ∞ ∞ ∞ ∞ ∞ ∞

CGIJK A 0 A 5 AB 11 ∞ A 1 A 2 AF 4 ∞ AE 3 AF 6 AF 7 ∞

Page 11: CMPT 371

6

(0,∞)

Find all minimum cost paths of length 3 hops from the station A

(0,∞)

Janice Regan © 2005-1012 11

(K,9)

(K,11)

{ }I, J,C,

(E,3)

(0,∞)

(C,15)

Iteration 3

II J LK

E F HG

B DC

2

4

3

2

5

16

2

4

4

8

5

3

44

2

2

4

A

4

(A,5)(B,11)

(F,7)(F,6)

(F,4)

(A,1)(C,12)

(A,2)

(i,7)

K,G,

(J,9)(J,10)(K,10)

LH

(G,12)

(G,8)

D

(G,10)

(I,6)

Page 12: CMPT 371

12Janice Regan © 2005-1012

T A B C D E F G H I J K L

A A 0 ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞

BEF A 0 A 5 ∞ ∞ A 1 A 2 ∞ ∞ ∞ ∞ ∞ ∞

CGIJK A 0 A 5 AB 11 ∞ A 1 A 2 AF 4 ∞ AE 3 AF 6 AF 7 ∞

CDHL A 0 A 5 AFG 10 AFG 15 A 1 A 2 AF 4 AFK 11 AE 3 AF 6 AF 7 AFK 9

Page 13: CMPT 371

Janice Regan © 2005-1012 13

{ }

(K,9)

(K,11)

Find all minimum cost paths of length 4 hops from the station A

(E,3)

(G,8)

Iteration 4

II J LK

E F HG

B DC

2

4

3

2

5

1

6

6

2

4

4

8

5

3

44

2

2

4

A

4

(A,5)

(F,7)(F,6)

(F,4)

(A,1)

(C,12)

(A,2)

(H,13)

(H,15)

LH,(D,12)

(D,12)

D,

(G,10)

(L,11)(H,19)

C,

Page 14: CMPT 371

14Janice Regan © 2005-1012

T A B C D E F G H I J K L

A A 0 ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞

BEF A 0 A 5 ∞ ∞ A 1 A 2 ∞ ∞ ∞ ∞ ∞ ∞

CGIJK A 0 A 5 AB 11 ∞ A 1 A 2 AF 4 ∞ AE 3 AF 6 AF 7 ∞

CDHL A 0 A 5 AFG 10 AFG 15 A 1 A 2 AF 4 AFK 11 AE 3 AF 6 AF 7 AFK 9

A 0 A 5 AFG 10 AFG 15 A 1 A 2 AF 4 AFK 11 AE 3 AF 6 AF 7 AFK 9

Page 15: CMPT 371

Janice Regan © 2005-1012 15

Distance Vector Routing Distributed Bellman-Ford algorithm Each station (router) maintains a routing

table Routing table contains one entry for each

station (router) in the network Each entry includes a measure of the

‘distance’ to a particular station (router) ‘distance’ metric may be one of, or a

combination of measures including the following number of hops number of packets queued for transmission delay between stations ( measured using and

ECHO packet which directly measures the transmission time)

Page 16: CMPT 371

16Janice Regan © 2005-1012

Once every T seconds each station i, (router) sends each of its neighbors (station one hop distant) a list, of estimated delays from itself to every station j.

Similarly each station will receive routing information from each of its neighbors every T sec. The routing data received are used to update the

routing table of the station Note: the existing routing table for station i at time t

is not used directly to compute the routing table for station i at time t+T, the ‘distance’ to each neighbor station k, lki, and the delay vectors from each neighbor station j, dij are used

Distance Vector Routing

][min kiijAi

kj ldd

ijd

Page 17: CMPT 371

17Janice Regan © 2005-1012

First Generation Internet Distance Vector Routing (ARPANET) Used the distributed version of the Bellman-Ford algorithm. Network

data updated every 128ms Di delay vector from node i

Si successor node vector sij next node in minimum

delay route from i to j N # of nodes in network lki current estimate of

delay k to I A set of neighbor nodes

Ni

i

i

i

Ni

i

i

i

s

ss

S

d

dd

D2

1

2

1

above iexpression minimizes i

][min

is

ldd

kj

kiijAi

kj

Page 18: CMPT 371

Janice Regan © 2005-101218

Distance Vector Routing : from node J

II J LK

E F HG

B DC

2

4

3

2

5

1

6

6

2

4

4

8

5

44

24

A

4

3

Original network F I J KA A 2 E 3 F 6 F 7B B 4 F 7 F 8 F 9C G 8 F 11 F 12 H 12D G 6 F 9 F 10 H 8E I 5 E 2 I 6 F 8F 0 0 F 3 F 4 F 5G G 2 F 5 F 6 F 7H K 5 J 11 K 3 H 4I I 3 0 0 I 4 J 7J J 4 J 4 0 0 J 3K K 5 J 7 K 3 0 0L K 7 J 9 K 5 L 2

lJF4Delay lJi

lJI4lJK3

2

Page 19: CMPT 371

19Janice Regan © 2005-1012

Calculate new routes at node JT

kNkkK

kiijAi

kj

dddD

ldd

],,,[

][min

21

A A 2 E 5 F 5B A 7 E 10 F 10C G 9 F 13 H 9D G 7 F 11 H 6E A 5 E 2 F 8F 0 0 F 4 F 3G G 3 F 7 F 6H K 3 F 10 H 4I I 4 0 0 F 7J J 2 J 3 J 4K K 3 J 7 0 0L K 6 F 10 L 3

lJF4Measured Delay lJi

lJI4lJK3

Delay vectors received

SF DF SI DISK DK

6 9 8 F 611 14 13 F 1113 17 12 K 1211 15 9 K 99 6 11 I 64 8 6 F 47 11 9 F 77 14 7 K 78 4 10 I 46 7 7 0 07 11 3 K 310 14 6 K 6

DF+IJF DF+4

DI+IJI

DI+4DK+IJK

DK+3

New table for node J

iskj

SJ DJ

Later time, some routes weights have changed

Page 20: CMPT 371

20Janice Regan © 2005-1012

First Generation Internet The first generation internet routing

algorithm was a distributed version of the Bellman Ford algorithm

The distance metric used was queue length on each outgoing node. This is a local measure and does not require information from neighbor nodes

Routing data exchanges occurred every 128ms

Page 21: CMPT 371

Janice Regan © 2005-1012 21

Problems with first generation Algorithm considered only queue length as a measure

of link delay to nearest neighbors, capacity of the link was not considered. This worked reasonably when all links had the same capacity, but as the network grew higher capacity links were introduced.

Processing time was not considered The algorithm responded slowly to congestion and

failure (Count-to-infinity problem) Thrashing occurred when packets followed minimal

congestion route rather than aiming for the destination

Page 22: CMPT 371

Janice Regan © 2005-1012 22

Count to Infinity problem The example of the distributed Bellman

Ford algorithm we considered assumed that all stations in the network already knew of the changes in costs.

In practice when conditions in a network change, the change will take time to propagate across the network.

Good news propagates quickly across a network

Bad news propagates slowly across the network

Page 23: CMPT 371

Janice Regan © 2005-1012 23

Count to Infinity problem: Consider a linear network with 6 stations

A is down initially and all other stations know this A comes up, at the time of the first exchange of routing

information after A comes up B learns that A is alive At the time of the second exchange of routing

information after A comes up C learns that A is alive This pattern continues till the time of the sixth data

exchange after A comes up, when F learns that A is alive. At this point all stations in the network have learned the good news

A B C D E F

Page 24: CMPT 371

Janice Regan © 2005-1012 24

Count to Infinity problem: Linear network with 6 stations (all single hop costs 1)

A is up initially and all other stations know this A goes down, at the time of the first exchange of routing

information after A goes down B hears nothing from A. Since there is no direct path to A, B chooses an indirect path to A through C (which actually goes through B itself, but B doesn’t know this)

The first eight exchanges are illustrated on the next slide.

A B C D E F

Page 25: CMPT 371

25Janice Regan © 2005-1012

Count to Infinity problem: Linear network with 6 stations, single hop costs 1)

1 2 3 4 5

3 2 3 4 5

3 4 3 4 5

5 4 5 4 5

5 6 5 6 5

7 6 7 6 7

7 8 7 8 7

9 8 9 8 9

9 10 9 10 9

A B C D E F

INITIALLY

AFTER 1 EXCHANGE

AFTER 2 EXCHANGES

AFTER 3 EXCHANGES

AFTER 4 EXCHANGES

AFTER 5 EXCHANGES

AFTER 6 EXCHANGES

AFTER 7 EXCHANGES

AFTER 8 EXCHANGES

Page 26: CMPT 371

26Janice Regan © 2005-1012

Count to Infinity problem: Linear network with 6 stations (all single hop

costs 1)

The number of iterations necessary to indicate that the link to 1 is down (cost infinite) is in fact infinite. It is clear that the delay increases as the number of iterations increase, but it is still necessary to ‘count to infinity’ to reach the correct link costs for link A-B down.

A B C D E F

Page 27: CMPT 371

Janice Regan © 2005-1012 27

Poison Reverse Consider router A in a network

Router A’s neighbors are routers B, and C Any entry in A’s routing table will be either

1. learned from B’s routing tabledistance to B + the distance from B to the destination

2. Learned from C’s routing tabledistance to C + the distance from C to the destination

Poison reverse means the routing table that A sends to its neighbors will be different for each neighbor

1. Routes learned from B’s routing table will have costs set to ∞ when A’s table is sent back to B

2. Routes learned from C’s routing table will have costs set to ∞ when A’s table is sent back to C

Page 28: CMPT 371

Janice Regan © 2005-1012 28

Why Poison Reverse Removes the possibility of loops between two neighboring

nodes Does not remove the possibility of longer loopsExample: loop between neighboring nodesRouter B determines the cost to destination X should pass through

router CThis information is sent to router C (poison reverse means that the path

to X has cost ∞)The connection between router C and X has failed, so C is looking for

an alternate route to XWithout poison reverse C could choose to route to X through B not

knowing B’s path through X included CWith poison reverse the cost of the link through B is ∞ so C will choose

any other path in preference and avoid the count to infinity problem

Page 29: CMPT 371

Janice Regan © 2005-1012 29

Second generation internet Distributed Dijkstra (Link State Routing) Developed to correct the problems of the

first generation algorithms. Followed these steps:

Find neighbors (addresses) and measure delay to neighbors

Send a packet containing addresses and delays to neighbors information to all other routers

Receive similar packets from other routers and use the information to construct shortest path to every other router using Dijkstra’s algorithm

Page 30: CMPT 371

Janice Regan © 2005-1012 30

Second generation internet Developed to correct the problems of the

first generation algorithms. Followed these steps:

Find neighbors (addresses) using a HELLO packet

Measure delay to neighbors using an ECHO packet to measure round trip time ( may include queuing time)

Send a packet containing addresses and delays to neighbors information to all other routers every ten seconds using flooding

Receive similar packets from other routers and use the information to construct shortest path to every other router using Dijkstra’s algorithm

Page 31: CMPT 371

Janice Regan © 2005-1012 31

Problems: second generation Flooding caused significant overhead The assumption that the measured packet delay was a

good predictor of future link delay sometimes lead to oscillations.

When two paths connect two subnets oscillation may occur: One path between subnets become congested The second path is chosen for subsequent traffic. All traffic is then routed through the second path causing

congestion on that path and low use on the original path. The original path is chosen for subsequent traffic The original path again becomes congested and the cycle

repeats At any time only one of the two paths is being fully utilized

Page 32: CMPT 371

32Janice Regan © 2005-1012

Third generation internet To correct the shortcomings of the second generation

internet a new distance metric was devised. The measured delay, T, is converted to a utilization

(cost), ρ, using a single server queuing model. The service time, Ts, for a standard is the network wide average packet size divided by the data rate.

The result is smoothed by averaging it with the previous estimate, to give an average utilization at step n U(n)

The link cost is set as a function of the average utilization that is designed to provide a reasonable estimate of cost while avoiding oscillations

)2/()(2 TTTT ss

)]()1([)1( 21 nUnnU

Page 33: CMPT 371

33Janice Regan © 2005-1012

Random Routing Simple and robust. Similar to flooding but reduces the

traffic load created by flooding. Each station randomly chooses one of its neighbors to

send the packet to rather than sending it to all neighbors. For an intermediate station, the station is selected from

nearest neighbors excluding the station the packet originated from

Each nearest neighbor is assigned a probability. The sum of the probabilities for all nearest neighbors is 1. The probability for the ith nearest neighbor is based on

some cost measure, for example data ratesPi= (Data rate of Link i)/( data rates for all nearest neighbors)