Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
• Determine least cost path from every node to every other node D 7 B B
1
Ways to Compute Shortest Paths Outline
• Centralized
• Collect graph structure in one place
• Use standard graph algorithm • Distance Vector
• Disseminate routing tables
5 6
E 2 E B
F 6 F
• Update(x,y,z)
d ← c(x,z) + d(z,y) # Cost of path from x to y with first hop z
• Idea if d < d(x,y)
• At any time, have cost/next hop of best known path to destination
# Found better path
• Use cost ∞ when no path known
return d,z # Updated cost / next hop
• Initially else
• Only have entries for directly connected nodes
return d(x,y), nexthop(x,y) # Existing cost / next hop
7 8
2
Algorithm Start
Optimum 1-hop paths!
• Bellman-Ford algorithm Table for A Table for B
E! C
Dst Cst Hop Dst Cst Hop 3! 1!
• Repeat A 0 A A 4 A 1!
F!
For every node x B 4 B B 0 B 2!
6!
C ∞ – C ∞ –
For every neighbor z D ∞ – D 3 D
1!
3! D
A 4!
For every destination y E 2 E E ∞ –
B
F 6 F F 1 F
d(x,y) ← Update(x,y,z) Table for C Table for D Table for E Table for F
• Until converge Dst Cst Hop Dst Cst Hop Dst Cst Hop Dst Cst Hop
A ∞ – A ∞ – A 2 A A 6 A
B ∞ – B 3 B B ∞ – B 1 B
C 0 C C 1 C C ∞ – C 1 C
D 1 D D 0 D D ∞ – D ∞ –
E ∞ – E ∞ – E 0 E E 3 E
F 1 F F ∞ – F 3 F F 0 F
9 10
Iteration #1 Iteration #2
Optimum 2-hop paths! Optimum 3-hop paths!
Table for A Table for B Table for A Table for B
E! 3! C E! 3! C
Dst Cst Hop Dst Cst Hop 1! Dst Cst Hop Dst Cst Hop 1!
A 0 A A 4 A 1! A 0 A A 4 A 1!
2! F! 2! F!
B 4 B B 0 B B 4 B B 0 B
6! 6!
C 7 F C 2 F 1! C 6 E C 2 F 1!
D 7 B D 3 D 3! D D 7 B D 3 D 3! D
A 4! A 4!
E 2 E E 4 F E 2 E E 4 F
B B
F 5 E F 1 F F 5 E F 1 F
Table for C Table for D Table for E Table for F Table for C Table for D Table for E Table for F
Dst Cst Hop Dst Cst Hop Dst Cst Hop Dst Cst Hop Dst Cst Hop Dst Cst Hop Dst Cst Hop Dst Cst Hop
A 7 F A 7 B A 2 A A 5 B A 6 F A 7 B A 2 A A 5 B
B 2 F B 3 B B 4 F B 1 B B 2 F B 3 B B 4 F B 1 B
C 0 C C 1 C C 4 F C 1 C C 0 C C 1 C C 4 F C 1 C
D 1 D D 0 D D ∞ – D 2 C D 1 D D 0 D D 5 F D 2 C
E 4 F E ∞ – E 0 E E 3 E E 4 F E 5 C E 0 E E 3 E
F 1 F F 2 C F 3 F F 0 F F 1 F F 2 C F 3 F F 0 F
11 12
3
Distance Vector: Link Cost Distance Vector: Link Cost
Changes Changes
Link cost changes: Link cost changes:
1 60
• Node detects local link cost change Y • Good news travels fast Y
• Updates distance table 4 1 4 1
X • Bad news travels slow - X
• If cost change in least cost path, notify Z Z
50 “count to infinity” problem! 50
neighbors
algorithm algorithm
terminates continues
“good on!
news
travels
fast”
13 14
? ? ?
15 16
4
Poison Reverse Failures Routing Information Protocol (RIP)
Dst
Table for A
Cst Hop Dst
Table for B
Cst Hop Dst
Table for D
Cst Hop Dst
Table for F
Cst Hop
• Earliest IP routing protocol (1982 BSD)
C 7 F C 8 A C 9 B C 1 C
∞!
1!
• Current standard is version 2 (RFC 1723)
Dst
Table for A
Cst Hop Forced! Forced!
Dst
Table for F
Cst Hop
6!
F! C • Features
Update! Update!
C ∞ – C ∞ – A • Every link has cost 1
1!
Table for A
Better! 4!
• “Infinity” = 16
Dst Cst Hop 1!
C 13 D
Route!
D
B • Limits to networks where everything reachable within
Table for B
15 hops
Forced!
Update! Dst Cst Hop • Iterations don’t converge • Sending Updates
C 14 A • “Count to infinity”
• Every router listens for updates on UDP port 520
Forced!
Table for D
• Solution
Update! Dst Cst Hop
• Make “infinity” smaller
• RIP message can contain entries for up to 25 table
C 15 B
• What is upper bound on
entries
Table for A
•!
Dst Cst Hop Forced! •! maximum path length?
Update!
C 19 D •!
17 18
19 20
5
Outline Link State Protocol Concept
21 22
• X Wants to Send X A X A
• Given
Information • Graph with source node s and edge costs c(u,v)
C B D C B D
• Sends on all outgoing • Determine least cost path from s to every node v
(a) (b)
links • Shortest Path First Algorithm
• When Node Y Receives X A X A • Traverse graph in order of least cost from source
Information from Z C B D C B D
• Send on all links other (c) (d)
than Z
23 24
6
Dijkstra’s Algorithm: Concept Dijkstra’s Algorithm: Initially
∞! ∞!
2! E! C ∞! E! 3! C
3! 1! ∞! 1!
5!
Current Path Costs! ! Current Path Costs!
2! F! 2!
2! F! 2!
6! 6!
1! 1!
Source! 0! ∞! Source! 0! ∞!
3! 3! D ∞! 3! D
Node! A 3! Node! A 3!
B Horizon! B
Done!
Unseen! Done! Unseen!
Horizon!
• Node Sets
• Done • Label
• Already have least cost path to it • d(v) = path cost from s to v
• No nodes done
• Horizon: • Path
• Reachable in 1 hop from node in • Keep track of last link in path
• Source in horizon
Done
• Unseen:
• Cannot reach directly from node in
Done
25 26
7
Dijkstra’s Algorithm Dijkstra’s Algorithm
∞! Unseen!
Horizon! ∞! 2! E! 3! C
2! E! 3! C 4! 1!
5! 1!
Current Path Costs!
Current Path Costs! F! 2!
2! 2!
2! F!
6!
6! 1!
1! Source! 0! 6!
Source! 0! ∞! 3! 3! D
3! 3! D Node! A 3!
Node! A 3!
B Horizon!
B Done!
Done!
Unseen!
29 30
5!
2! E! 3!
4! 1!
C • With consistent
F! 2! LSDBs*, all nodes B
2!
6! compute consistent 1
X
1
Source!
Node!
0! 1!
3! 3! D
6! loop-free paths A 3
C
A 3!
B • Can still have 5 2
D
transient loops
Packet from CàA
* Link State Data Base may loop around BDC
if B knows about failure
• Final tree shown in green and C & D do not
31 32
8
OSPF Routing Protocol OSPF Reliable Flooding
33 34
9
Adoption of OSPF Comparison of LS and DV
Algorithms
• RIP viewed as outmoded Message complexity Space requirements:
• LS: with n nodes, E links, • LS maintains entire topology
• Good when networks small and routers had limited O(nE) messages
• DV maintains only neighbor
memory & computational power • DV: exchange between
state
neighbors only
• OSPF Advantages Robustness: router
• Fast convergence when configuration changes Speed of Convergence malfunctions
• LS: Relatively fast
• LS: Node can advertise
• Complex computation, but can
forward before computation incorrect link cost
• may have transient loops • Each node computes its
• DV: convergence time varies own table
• may have routing loops • DV: Node can advertise
• count-to-infinity problem incorrect path cost
• faster with triggered • Each node’s table used by
updates others (error propagates)
37 38
39 40
10
Areas Routing Hierarchy
1 2
• Can result in sub-optimal paths
2.2
1.1 2.1
2.2.2 1 2
2.1 2.2
1.2 2.2.1
1.1
1.2.1 1.2 2.2.1
1.2.1
1.2.2
start
3
end
3.2.1
3
43 44
11
Next Lecture: BGP
45
12