1 Comnet 2010 Communication Networks Recitation 6 Routing

Preview:

Citation preview

1Comnet 2010

Communication NetworksCommunication Networks

Recitation 6Recitation 6

RoutingRouting

2Comnet 2010

Routing Problem: Routing Problem: find an find an Optimal PathOptimal Path

R5

5

A

R1

R2

R4

R3

R6

R7

R8

B

5

4010

2010

4 10

10

55

6

15

40

3Comnet 2010

Distance Vector (RIP)Distance Vector (RIP)

• Each node maintains a table:Each node maintains a table:• (Destination, Cost, NextHop)(Destination, Cost, NextHop)

• Each node sends updates to (and Each node sends updates to (and receives updates from) its directly receives updates from) its directly connected neighborsconnected neighbors– periodically (on the order of several periodically (on the order of several

seconds)seconds)– whenever its table changes (called whenever its table changes (called

triggered update)triggered update)

4Comnet 2010

DV UpdatesDV Updates

• Each update is a list of pairs:Each update is a list of pairs:• (Destination, Cost)(Destination, Cost)

• Update local table if receive a “better” routeUpdate local table if receive a “better” route– smaller costsmaller cost– came from next-hopcame from next-hop

• Refresh existing routes; delete if they time outRefresh existing routes; delete if they time out

• Convergence rateConvergence rate

5Comnet 2010

RIP Table ProcessingRIP Table Processing• RIP routing tables managed by RIP routing tables managed by application-application-

levellevel process called routed (daemon) process called routed (daemon)• Advertisements sent in UDP packets, Advertisements sent in UDP packets,

periodically repeatedperiodically repeated

6Comnet 2010

Example - initial distancesExample - initial distances

A

B

E

C

D

Info atnode

A

B

C

D

A B C

0 7 ~

7 0 1~ 1 0

~ ~ 2

7

1

1

2

28

Distance to node

D

~

~2

0

E 1 8 ~ 2

1

8~

2

0

E

7Comnet 2010

E receives D’s routesE receives D’s routes

A

B

E

C

D

Info atnode

A

B

C

D

A B C

0 7 ~

7 0 1~ 1 0

~ ~ 2

7

1

1

2

28

Distance to node

D

~

~2

0

E 1 8 ~ 2

1

8~

2

0

E

8Comnet 2010

E updates cost to CE updates cost to C

A

B

E

C

D

Info atnode

A

B

C

D

A B C

0 7 ~

7 0 1~ 1 0

~ ~ 2

7

1

1

2

28

Distance to node

D

~

~2

0

E 1 8 4 2

1

8~

2

0

E

9Comnet 2010

A receives B’s routesA receives B’s routes

A

B

E

C

D

Info atnode

A

B

C

D

A B C

0 7 ~

7 0 1~ 1 0

~ ~ 2

7

1

1

2

28

Distance to node

D

~

~2

0

E 1 8 4 2

1

8~

2

0

E

10Comnet 2010

A updates cost to CA updates cost to C

A

B

E

C

D

Info atnode

A

B

C

D

A B C

0 7 8

7 0 1~ 1 0

~ ~ 2

7

1

1

2

28

Distance to node

D

~

~2

0

E 1 8 4 2

1

8~

2

0

E

11Comnet 2010

A receives E’s routesA receives E’s routes

A

B

E

C

D

Info atnode

A

B

C

D

A B C

0 7 8

7 0 1~ 1 0

~ ~ 2

7

1

1

2

28

Distance to node

D

~

~2

0

E 1 8 4 2

1

8~

2

0

E

12Comnet 2010

A updates cost to C and DA updates cost to C and D

A

B

E

C

D

Info atnode

A

B

C

D

A B C

0 7 5

7 0 1~ 1 0

~ ~ 2

7

1

1

2

28

Distance to node

D

3

~2

0

E 1 8 4 2

1

8~

2

0

E

13Comnet 2010

Final distancesFinal distances

A

B C

D

Info atnode

A

B

C

D

A B C

0 6 5

6 0 15 1 0

3 3 2

7

1

1

2

28

Distance to node

D

3

32

0

E 1 5 4 2

1

54

2

0

E

E

14Comnet 2010

Final distances after link Final distances after link failurefailure

A

B C

D

Info atnode

A

B

C

D

A B C

0 7 8

7 0 1

8 1 0

10 3 2

7

1

1

2

28

Distance to node

D

10

3

2

0

E 1 8 9 11

1

8

9

11

0

E

E

15Comnet 2010

View from a nodeView from a node

A

B

E

C

D

dest

A

B

C

D

A B D

1 14 5

7 8 56 9 4

4 11 2

7

1

1

2

28

Next hop

E’s routing table

16Comnet 2010

The bouncing effectThe bouncing effect

A

25

1

1

B

C

B

C 21

dest costA

C 11

dest cost

A

B 12

dest cost

17Comnet 2010

C sends routes to BC sends routes to B

A

25 1

B

C

B

C 21

dest costA

C 1~

dest cost

A

B 12

dest cost

18Comnet 2010

B updates distance to AB updates distance to A

A

25 1

B

C

B

C 21

dest costA

C 13

dest cost

A

B 12

dest cost

19Comnet 2010

B sends routes to CB sends routes to C

A

25 1

B

C

B

C 21

dest costA

C 13

dest cost

A

B 14

dest cost

20Comnet 2010

How are these loops caused?How are these loops caused?

• Observation 1:Observation 1:– B’s metric B’s metric increasesincreases

• Observation 2:Observation 2:– C picks B as next hop to AC picks B as next hop to A– But, the But, the implicit pathimplicit path from C to A includes from C to A includes

itself!itself!

21Comnet 2010

SolutionsSolutions

• Split horizon/Poisoned reverseSplit horizon/Poisoned reverse– B does not advertise route to C or B does not advertise route to C or

advertises it with infinite distance (16)advertises it with infinite distance (16)

• Works for two node loopsWorks for two node loops– does not work for loops with more nodesdoes not work for loops with more nodes

22Comnet 2010

Example where Split Horizon failsExample where Split Horizon fails

1

11

1

A B

C

D

• When link breaks, C marks When link breaks, C marks D as unreachable and D as unreachable and reports that to A and Breports that to A and B

• Suppose A learns it first. A Suppose A learns it first. A now thinks best path to D is now thinks best path to D is through B. A reports a route through B. A reports a route of cost=3 to C.of cost=3 to C.

• C thinks D is reachable C thinks D is reachable through A at cost 4 and through A at cost 4 and reports that to B.reports that to B.

• B reports a cost 5 to A who B reports a cost 5 to A who reports new cost to C.reports new cost to C.

• etc...etc...

23Comnet 2010

Link State (OSPF)Link State (OSPF)• Link State ProtocolLink State Protocol

– OSPF routing table has detailed OSPF routing table has detailed information about each link : cost, information about each link : cost, reliability, etc.reliability, etc.

– This allows OSPF routers to This allows OSPF routers to optimize routingoptimize routing

Link

24Comnet 2010

Link State UpdatesLink State Updates

• Routers send to Routers send to all nodesall nodes (not just neighbors) (not just neighbors) information about directly connected links.information about directly connected links.

• Each router calculates shortest cost path to all Each router calculates shortest cost path to all others (Dijkstra).others (Dijkstra).

• At each step of the algorithm, router adds the At each step of the algorithm, router adds the next shortest (i.e. lowest-cost) path to the tree. next shortest (i.e. lowest-cost) path to the tree.

• Finds spanning tree routed on source router.Finds spanning tree routed on source router.

25Comnet 2010

Djikstra’s algorithm - step 1Djikstra’s algorithm - step 1

0

10

5

2 3

1

9

7

2

4 6

26Comnet 2010

Djikstra’s algorithm - step 2Djikstra’s algorithm - step 2

0

10

5

10

5

2 3

1

9

7

2

4 6

27Comnet 2010

Djikstra’s algorithm - step 3Djikstra’s algorithm - step 3

0

8

5

14

7

10

5

2 3

1

9

7

2

4 6

28Comnet 2010

Djikstra’s algorithm - step 4Djikstra’s algorithm - step 4

0

8

5

13

7

10

5

2 3

1

9

7

2

4 6

29Comnet 2010

Djikstra’s algorithm - step 5Djikstra’s algorithm - step 5

0

8

5

9

7

10

5

2 3

1

9

7

2

4 6

30Comnet 2010

Djikstra’s algorithm - finalDjikstra’s algorithm - final

0

8

5

9

7

10

5

2 3

1

9

7

2

4 6