0131_09f7/c21 link-state protocols spf algo. 2 henk smit jan1999 summary the basic ideas of...

40
0131_09F7/c2 1 Link-state protocol Link-state protocol SPF algo SPF algo

Upload: anita-lamkins

Post on 14-Dec-2015

225 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: 0131_09F7/c21 Link-state protocols SPF algo. 2 Henk Smit jan1999 Summary The basic ideas of link-state protocols Dijkstra’s Shortest Path First algorithm

0131_09F7/c2 1

Link-state protocolsLink-state protocols

SPF algoSPF algo

Page 2: 0131_09F7/c21 Link-state protocols SPF algo. 2 Henk Smit jan1999 Summary The basic ideas of link-state protocols Dijkstra’s Shortest Path First algorithm

Henk Smit jan1999 2

Summary

• The basic ideas of link-state protocols

• Dijkstra’s Shortest Path First algorithm

Page 3: 0131_09F7/c21 Link-state protocols SPF algo. 2 Henk Smit jan1999 Summary The basic ideas of link-state protocols Dijkstra’s Shortest Path First algorithm

Henk Smit jan1999 3

Summary

• The basic ideas of link-state protocols

• Dijkstra’s Shortest Path First algorithm

Page 4: 0131_09F7/c21 Link-state protocols SPF algo. 2 Henk Smit jan1999 Summary The basic ideas of link-state protocols Dijkstra’s Shortest Path First algorithm

Henk Smit jan1999 4

The basic idea

• In a link-state protocol, the network can be viewed as a jigsaw puzzle

• Each piece of the puzzle holds one router

• Each router creates a packet which represents its own jigsaw piece

• These packets are flooded everywhere

• Use SPF to put the pieces together

Page 5: 0131_09F7/c21 Link-state protocols SPF algo. 2 Henk Smit jan1999 Summary The basic ideas of link-state protocols Dijkstra’s Shortest Path First algorithm

Henk Smit jan1999 5

About link-state protocols

•The jigsaw puzzle

LSP for routerA

LSP for routerB

LSP for routerC

LSP for routerD

to B

to Eto D

to C

to A

to D to C

to BLSP for routerE

to A to B

to A

to E

Page 6: 0131_09F7/c21 Link-state protocols SPF algo. 2 Henk Smit jan1999 Summary The basic ideas of link-state protocols Dijkstra’s Shortest Path First algorithm

Henk Smit jan1999 6

Link-state protocols

• Each router keeps track of its own state

• Send and receive hellos to detect neighbors

• Keep track of IP and CLNS addresses• interface IP prefixes• maybe inter-area or redistributed prefixes

• Each router builds one linkstate packet (LSP) with all own local information

• OSPF builds multiple LSAs for inter-area/externals

Page 7: 0131_09F7/c21 Link-state protocols SPF algo. 2 Henk Smit jan1999 Summary The basic ideas of link-state protocols Dijkstra’s Shortest Path First algorithm

Henk Smit jan1999 7

Link-state protocols

• All routers exchange copies of all LSPs• via a reliable flooding mechanism

• Each router stores all LSPs in a database• separate from the routing table• all routers should have exactly the same LSPDB

• New LSPs sent only when there’s a change• and additionally periodic refreshes• new LSP will overwrite the old LSP

– no partial updates

Page 8: 0131_09F7/c21 Link-state protocols SPF algo. 2 Henk Smit jan1999 Summary The basic ideas of link-state protocols Dijkstra’s Shortest Path First algorithm

Henk Smit jan1999 8

Link-state protocols

• By executing Dijkstra’s SPF algorithm, each router ‘composes the jigsaw puzzle’.

• the topology is calculated as a shortest-path-tree• each router is the root of the SPT it has calculated

• From the SPT the RIBs are calculated

• No routing loops will occur because• all routers have an identical LSPDB• all info in the LSPDB comes directly from the source

– Distance Vector protocols are based on hear-say

Page 9: 0131_09F7/c21 Link-state protocols SPF algo. 2 Henk Smit jan1999 Summary The basic ideas of link-state protocols Dijkstra’s Shortest Path First algorithm

Henk Smit jan1999 9

Each router has the same LSPDBRouterA’s LSPDB

RouterB’s LSPDB

RouterC’s LSPDB

RouterE’s LSPDB

RouterD’s LSPDB

lspA lspB

lspC lspDlspE

lspA lspB

lspC lspDlspE

lspA lspB

lspC lspDlspE

lspA lspB

lspC lspDlspE

lspA lspB

lspC lspDlspE

Page 10: 0131_09F7/c21 Link-state protocols SPF algo. 2 Henk Smit jan1999 Summary The basic ideas of link-state protocols Dijkstra’s Shortest Path First algorithm

Henk Smit jan1999 10

Summary

• The basic ideas of link-state protocols

• Dijkstra’s Shortest Path First algorithm

• Pseudonodes and Network LSAs

• Flooding

• Scaling link-state protocols by using areas• inter-area routing is IS-IS

Page 11: 0131_09F7/c21 Link-state protocols SPF algo. 2 Henk Smit jan1999 Summary The basic ideas of link-state protocols Dijkstra’s Shortest Path First algorithm

Henk Smit jan1999 11

Shortest Path First algorithm

• Also called Dijkstra’s algorithm

• The goal is to find the topology in the form of a shortest path tree (SPT)

• From the SPT we build routing tables

• Complexity is independent from position of computing router in the network

• makes LS protocols less useful for hub-and-spoke• use distance-vector with default routes and filters

Page 12: 0131_09F7/c21 Link-state protocols SPF algo. 2 Henk Smit jan1999 Summary The basic ideas of link-state protocols Dijkstra’s Shortest Path First algorithm

Henk Smit jan1999 12

Shortest Path First algorithm

• SPF complexity is O(n log n)

• Theoretical complexity depends on sorting• ISIS uses quick array sort

– causes link metric limitation of 63

• CPU usage in real life depends on other stuff• number of links is important• number of IP routes, stability of adjacencies, etc• flooding is probably more important for scaling

Page 13: 0131_09F7/c21 Link-state protocols SPF algo. 2 Henk Smit jan1999 Summary The basic ideas of link-state protocols Dijkstra’s Shortest Path First algorithm

Henk Smit jan1999 13

Shortest Path First algorithm

• We maintain three lists (or sets)• Unknown list

• all nodes start on this list

• TENTative list• all nodes we are currently examining• also called candidate list

• PATHS list• all nodes to which we have calculated final paths• also called known list

Page 14: 0131_09F7/c21 Link-state protocols SPF algo. 2 Henk Smit jan1999 Summary The basic ideas of link-state protocols Dijkstra’s Shortest Path First algorithm

Henk Smit jan1999 14

Shortest Path First algorithm

• We execute N steps• typically N is the number of nodes in the network

• At each step we move one node to PATHS• During the first step we move ourself to PATHS• During the next steps we find the node that has the

shortest path amongst all nodes on TENT, and move it from TENT to PATHS

• At each step we find all neighbors reachable from that node and move them to the TENT list

Page 15: 0131_09F7/c21 Link-state protocols SPF algo. 2 Henk Smit jan1999 Summary The basic ideas of link-state protocols Dijkstra’s Shortest Path First algorithm

Henk Smit jan1999 15

Shortest Path First algorithm

• Special actions• after each step we clean up the TENT list• if a node is directly connected to us, search the

first-hop info in the adjacency database• if a node is not directly connected to us, copy the

first-hop info from the parent(s)• for each node on TENT, maintain the cost to get

there from the root, and the first-hop info• if parallel paths, maintain multiple first-hops

Page 16: 0131_09F7/c21 Link-state protocols SPF algo. 2 Henk Smit jan1999 Summary The basic ideas of link-state protocols Dijkstra’s Shortest Path First algorithm

Henk Smit jan1999 16

A network

rtrWRtrR

rtrD

rtrC

rtrA

rtrB

rtrQ

rtrS

rtrK

rtrFrtrZ

4

5

4

5

12

2

2

5

5

12

7 3

53

4

3

2

8

2

3

3

3

Page 17: 0131_09F7/c21 Link-state protocols SPF algo. 2 Henk Smit jan1999 Summary The basic ideas of link-state protocols Dijkstra’s Shortest Path First algorithm

Henk Smit jan1999 17

The link-state database

LSP KIS: 4 SIS: 2 F

LSP SIS: 4 QIS: 5 WIS: 4 K

LSP WIS: 3 RIS: 3 AIS: 12 FIS: 5 SIS: 2 Q

LSP RIS: 3 DIS: 7 AIS: 3 WIS: 2 BIS: 12 F

LSP BIS: 2 CIS: 2 RIS: 5 FIS: 5 F

LSP DIS: 3 AIS: 8 CIS: 3 RIS: 4 A

LSP FIS: 5 BIS: 12 RIS: 5 BIS: 12 WIS: 2 K

LSP AIS: 3 DIS: 4 DIS: 7 RIS: 3 WIS: 5 QIS: 5 Q

LSP QIS: 5 AIS: 5 AIS: 2 WIS: 4 S

LSP ZIS: 3 CIS: 3 D

LSP CIS: 2 BIS: 8 D

Page 18: 0131_09F7/c21 Link-state protocols SPF algo. 2 Henk Smit jan1999 Summary The basic ideas of link-state protocols Dijkstra’s Shortest Path First algorithm

Henk Smit jan1999 18

The adjacency database

Neighbor Interface CostrtrD serial0 3rtrD serial1 4rtrR serial2 7rtrW serial3 3rtrQ serial4 5rtrQ serial5 5

Page 19: 0131_09F7/c21 Link-state protocols SPF algo. 2 Henk Smit jan1999 Summary The basic ideas of link-state protocols Dijkstra’s Shortest Path First algorithm

Henk Smit jan1999 19

Shortest Path First example

• Initial situation

• TENT: empty• PATHS: empty• Unknown: A B C D F K Q R S W Z

Page 20: 0131_09F7/c21 Link-state protocols SPF algo. 2 Henk Smit jan1999 Summary The basic ideas of link-state protocols Dijkstra’s Shortest Path First algorithm

Henk Smit jan1999 20

Shortest Path First example

• First iteration• Move ourself (rtrA) to PATHS• Move neighbors of rtrA to TENT

• find first-hop info in adjacency database

• TENT: D cost 3 via S0, R cost 7 via S2, W cost 3 via S3, Q cost 5 via S4 or S5

• PATHS: A• Unknown: B C F K S Z

Page 21: 0131_09F7/c21 Link-state protocols SPF algo. 2 Henk Smit jan1999 Summary The basic ideas of link-state protocols Dijkstra’s Shortest Path First algorithm

Henk Smit jan1999 21

PATHS and TENT

rtrWRtrR

rtrD

rtrC

rtrA

rtrB

rtrQ

rtrS

rtrK

rtrFrtrZ

4

5

4

5

12

2

2

5

5

12

7 3

53

4

3

2

8

2

3

3

3

Page 22: 0131_09F7/c21 Link-state protocols SPF algo. 2 Henk Smit jan1999 Summary The basic ideas of link-state protocols Dijkstra’s Shortest Path First algorithm

Henk Smit jan1999 22

Shortest Path First example

• Second iteration• Move rtrD to PATHS• Move neighbors of rtrD to TENT

• rtrC and rtrR, found better path to rtrR, ignore rtrA

• TENT: W cost 3 via S3, Q cost 5 via S4/S5,C cost 11 via S0, R cost 6 via S0

• PATHS: A, D cost 3 via S0• Unknown: B F K S Z

Page 23: 0131_09F7/c21 Link-state protocols SPF algo. 2 Henk Smit jan1999 Summary The basic ideas of link-state protocols Dijkstra’s Shortest Path First algorithm

Henk Smit jan1999 23

PATHS and TENT

rtrWRtrR

rtrD

rtrC

rtrA

rtrB

rtrQ

rtrS

rtrK

rtrFrtrZ

4

5

4

5

12

2

2

5

5

12

7 3

53

4

3

2

8

2

3

3

3

Page 24: 0131_09F7/c21 Link-state protocols SPF algo. 2 Henk Smit jan1999 Summary The basic ideas of link-state protocols Dijkstra’s Shortest Path First algorithm

Henk Smit jan1999 24

Shortest Path First example

• Third iteration• Move rtrW to PATHS, neighbors of rtrW to TENT

• F and S, found more equal-cost paths to R and Q

• TENT: Q cost 5 via S4/S5/S3, C cost 11 via S0, R cost 6 via S0/S3, S cost 8 via S3,F cost 15 via S3

• PATHS: A, D cost 3 via S0, W cost 3 via S3• Unknown: B K Z

Page 25: 0131_09F7/c21 Link-state protocols SPF algo. 2 Henk Smit jan1999 Summary The basic ideas of link-state protocols Dijkstra’s Shortest Path First algorithm

Henk Smit jan1999 25

PATHS and TENT

rtrWRtrR

rtrD

rtrC

rtrA

rtrB

rtrQ

rtrS

rtrK

rtrFrtrZ

4

5

4

5

12

2

2

5

5

12

7 3

53

4

3

2

8

2

3

3

3

Page 26: 0131_09F7/c21 Link-state protocols SPF algo. 2 Henk Smit jan1999 Summary The basic ideas of link-state protocols Dijkstra’s Shortest Path First algorithm

Henk Smit jan1999 26

Shortest Path First example

• Fourth iteration• Move rtrQ to PATHS, neighbors of rtrQ to TENT

• found worse path (9 vs 8) to S. A W already known

• TENT: C cost 11 via S0, R cost 6 via S0/S3,S cost 8 via S3, F cost 15 via S3

• PATHS: A, D cost 3 via S0, W cost 3 via S3,Q cost 5 via S4/S5/S3

• Unknown: B K Z

Page 27: 0131_09F7/c21 Link-state protocols SPF algo. 2 Henk Smit jan1999 Summary The basic ideas of link-state protocols Dijkstra’s Shortest Path First algorithm

Henk Smit jan1999 27

PATHS and TENT

rtrWRtrR

rtrD

rtrC

rtrA

rtrB

rtrQ

rtrS

rtrK

rtrFrtrZ

4

5

4

5

12

2

2

5

5

12

7 3

53

4

3

2

8

2

3

3

3

Page 28: 0131_09F7/c21 Link-state protocols SPF algo. 2 Henk Smit jan1999 Summary The basic ideas of link-state protocols Dijkstra’s Shortest Path First algorithm

Henk Smit jan1999 28

Shortest Path First example

• Fifth iteration• Move rtrR to PATHS, neighbors of rtrR to TENT

• new path to B, worse to F. A D W already known

• TENT: C cost 11 via S0, S cost 8 via S3,F cost 15 via S3, B cost 8 via S0/S3

• PATHS: A, D cost 3 via S0, W cost 3 via S3,Q cost 5 via S4/S5/S3,R cost 6 via S0/S3

• Unknown: K Z

Page 29: 0131_09F7/c21 Link-state protocols SPF algo. 2 Henk Smit jan1999 Summary The basic ideas of link-state protocols Dijkstra’s Shortest Path First algorithm

Henk Smit jan1999 29

PATHS and TENT

rtrWRtrR

rtrD

rtrC

rtrA

rtrB

rtrQ

rtrS

rtrK

rtrFrtrZ

4

5

4

5

12

2

2

5

5

12

7 3

53

4

3

2

8

2

3

3

3

Page 30: 0131_09F7/c21 Link-state protocols SPF algo. 2 Henk Smit jan1999 Summary The basic ideas of link-state protocols Dijkstra’s Shortest Path First algorithm

Henk Smit jan1999 30

Shortest Path First example

• Sixth iteration• Move rtrS to PATHS, neighbors of rtrS to TENT

• new path to K. Q W already known

• TENT: C cost 11 via S0, F cost 15 via S3,B cost 8 via S0/S3, K cost 12 via S3

• PATHS: A, D cost 3 via S0, W cost 3 via S3,Q cost 5 via S4/S5/S3,R cost 6 via S0/S3, S cost 8 via S3

• Unknown: Z

Page 31: 0131_09F7/c21 Link-state protocols SPF algo. 2 Henk Smit jan1999 Summary The basic ideas of link-state protocols Dijkstra’s Shortest Path First algorithm

Henk Smit jan1999 31

PATHS and TENT

rtrWRtrR

rtrD

rtrC

rtrA

rtrB

rtrQ

rtrS

rtrK

rtrFrtrZ

4

5

4

5

12

2

2

5

5

12

7 3

53

4

3

2

8

2

3

3

3

Page 32: 0131_09F7/c21 Link-state protocols SPF algo. 2 Henk Smit jan1999 Summary The basic ideas of link-state protocols Dijkstra’s Shortest Path First algorithm

Henk Smit jan1999 32

Shortest Path First example

• Seventh iteration• Move rtrB to PATHS, neighbors of rtrB to TENT

• better paths to C (10 vs 11) and F (13 vs 15)

• TENT: C cost 10 via S0/S3,F cost 13 via S0/S3, K cost 12 via S3

• PATHS: A, D cost 3 via S0, W cost 3 via S3,Q cost 5 via S4/S5/S3,R cost 6 via S0/S3, S cost 8 via S3,B cost 8 via S0/S3

• Unknown: Z

Page 33: 0131_09F7/c21 Link-state protocols SPF algo. 2 Henk Smit jan1999 Summary The basic ideas of link-state protocols Dijkstra’s Shortest Path First algorithm

Henk Smit jan1999 33

PATHS and TENT

rtrWRtrR

rtrD

rtrC

rtrA

rtrB

rtrQ

rtrS

rtrK

rtrFrtrZ

4

5

4

5

12

2

2

5

5

12

7 3

53

4

3

2

8

2

3

3

3

Page 34: 0131_09F7/c21 Link-state protocols SPF algo. 2 Henk Smit jan1999 Summary The basic ideas of link-state protocols Dijkstra’s Shortest Path First algorithm

Henk Smit jan1999 34

Shortest Path First example

• Eigth iteration• Move rtrC to PATHS, neighbors of rtrC to TENT

• B and D already known

• TENT: F cost 13 via S0/S3, K cost 12 via S3• PATHS: A, D cost 3 via S0, W cost 3 via S3,

Q cost 5 via S4/S5/S3,R cost 6 via S0/S3, S cost 8 via S3,B cost 8 via S0/S3, C cost 10 via S0/S3

• Unknown: Z

Page 35: 0131_09F7/c21 Link-state protocols SPF algo. 2 Henk Smit jan1999 Summary The basic ideas of link-state protocols Dijkstra’s Shortest Path First algorithm

Henk Smit jan1999 35

PATHS and TENT

rtrWRtrR

rtrD

rtrC

rtrA

rtrB

rtrQ

rtrS

rtrK

rtrFrtrZ

4

5

4

5

12

2

2

5

5

12

7 3

53

4

3

2

8

2

3

3

3

Page 36: 0131_09F7/c21 Link-state protocols SPF algo. 2 Henk Smit jan1999 Summary The basic ideas of link-state protocols Dijkstra’s Shortest Path First algorithm

Henk Smit jan1999 36

Shortest Path First example

• Ninth iteration• Move rtrK to PATHS, neighbors of rtrK to TENT

• found worse path to F (14 vs 13), S already known

• TENT: F cost 13 via S0/S3• PATHS: A, D cost 3 via S0, W cost 3 via S3,

Q cost 5 via S4/S5/S3,R cost 6 via S0/S3, S cost 8 via S3,B cost 8 via S0/S3, C cost 10 via S0/S3,K cost 12 via S3

• Unknown: Z

Page 37: 0131_09F7/c21 Link-state protocols SPF algo. 2 Henk Smit jan1999 Summary The basic ideas of link-state protocols Dijkstra’s Shortest Path First algorithm

Henk Smit jan1999 37

PATHS and TENT

rtrWRtrR

rtrD

rtrC

rtrA

rtrB

rtrQ

rtrS

rtrK

rtrFrtrZ

4

5

4

5

12

2

2

5

5

12

7 3

53

4

3

2

8

2

3

3

3

Page 38: 0131_09F7/c21 Link-state protocols SPF algo. 2 Henk Smit jan1999 Summary The basic ideas of link-state protocols Dijkstra’s Shortest Path First algorithm

Henk Smit jan1999 38

Shortest Path First example

• Tenth iteration• Move rtrF to PATHS, neighbors of rtrK to TENT

• all neighbors already known, no changes to TENT

• TENT: empty• PATHS: A, D cost 3 via S0, W cost 3 via S3,

Q cost 5 via S4/S5/S3,R cost 6 via S0/S3, S cost 8 via S3,B cost 8 via S0/S3, C cost 10 via S0/S3,K cost 12 via S3, F cost 13 via S0/S3

• Unknown: Z

Page 39: 0131_09F7/c21 Link-state protocols SPF algo. 2 Henk Smit jan1999 Summary The basic ideas of link-state protocols Dijkstra’s Shortest Path First algorithm

Henk Smit jan1999 39

PATHS and TENT

rtrWRtrR

rtrD

rtrC

rtrA

rtrB

rtrQ

rtrS

rtrK

rtrFrtrZ

4

5

4

5

12

2

2

5

5

12

7 3

53

4

3

2

8

2

3

3

3

Page 40: 0131_09F7/c21 Link-state protocols SPF algo. 2 Henk Smit jan1999 Summary The basic ideas of link-state protocols Dijkstra’s Shortest Path First algorithm

Henk Smit jan1999 40

Shortest Path First example

• Done !• iteration stops because TENT is empty• we obviously didn’t find a path to Z• we can now calculate routing tables

• result: D cost 3 via S0, W cost 3 via S3,Q cost 5 via S4/S5/S3,R cost 6 via S0/S3, S cost 8 via S3,B cost 8 via S0/S3, C cost 10 via S0/S3,K cost 12 via S3, F cost 13 via S0/S3