Shortest-Path Routing: Reading: Sections 4.2 and 4.3.4
Shortest-Path Routing: Reading: Sections 4.2 and 4.3.4
Shortest-Path Routing: Reading: Sections 4.2 and 4.3.4
1
Goals of Today’s Lecture
• Path selection
– Minimum-hop and shortest-path routing
– Dijkstra and Bellman-Ford algorithms
• Topology change
– Using beacons to detect topology changes
– Propagating topology or path information
• Routing protocols
– Link state: Open Shortest Path First
– Distance vector: Routing Information Protocol
2
What is Routing?
• A famous quotation from RFC 791
“A name indicates what we seek.
An address indicates where it is.
A route indicates how we get there.”
-- Jon Postel
3
Forwarding vs. Routing
• Forwarding: data plane
–Directing a data packet to an outgoing link
–Individual router using a forwarding table
• Routing: control plane
–Computing paths the packets will follow
–Routers talking amongst themselves
–Individual router creating a forwarding table
4
Why Does Routing Matter?
• End-to-end performance
– Quality of the path affects user performance
– Propagation delay, throughput, and packet loss
2
3 1
1
4
2 1
5
4 3
6
Shortest-Path Problem
• Given: network topology with link costs
– c(x,y): link cost from node x to node y
– Infinity if x and y are not direct neighbors
8
Dijsktra’s Algorithm
1 Initialization:
2 S = {u}
3 for all nodes v
4 if v adjacent to u {
5 D(v) = c(u,v)
6 else D(v) = ∞
7
8 Loop
9 find w not in S with the smallest D(w)
10 add w to S
11 update D(v) for all v adjacent to w and not in S:
12 D(v) = min{D(v), D(w) + c(w,v)}
13 until all nodes in S
9
Dijkstra’s Algorithm Example
2 2
3 1 3 1
1 1
4 4
2 1 2 1
5 5
4 3 4 3
2 2
3 1 3 1
1 1
4 4
2 1 2 1
5 5
4 3 4 3
10
Dijkstra’s Algorithm Example
2 2
3 1 3 1
1 1
4 4
2 1 2 1
5 5
4 3 4 3
2 2
3 1 3 1
1 1
4 4
2 1 2 1
5 5
4 3 4 3
11
Shortest-Path Tree
• Shortest-path tree from u • Forwarding table at u
v 2 y
1 link
3 1
u
x 4 z
v (u,v)
2 1 w (u,w)
5 t
x (u,w)
w4 3
s y (u,v)
z (u,v)
s (u,w)
t (u,w)
12
Link-State Routing
• Each router keeps track of its incident links
– Whether the link is up or down
– The cost on the link
• Example protocols
– Open Shortest Path First (OSPF)
– Intermediate System – Intermediate System (IS-IS)
13
Detecting Topology Changes
• Beaconing
– Periodic “hello” messages in both directions
– Detect a failure after a few missed “hellos”
“hello”
• Performance trade-offs
– Detection speed
– Overhead on link bandwidth and CPU
– Likelihood of false detection
14
Broadcasting the Link State
• Flooding
– Node sends link-state information out its links
– And then the next node sends out all of its links
– … except the one where the information arrived
X A X A
C B D C B D
(a) (b)
X A X A
C B D C B D
(c) (d) 15
Broadcasting the Link State
• Reliable flooding
– Ensure all nodes receive link-state information
– … and that they use the latest version
• Challenges
– Packet loss
– Out-of-order arrival
• Solutions
– Acknowledgments and retransmissions
– Sequence numbers
– Time-to-live for each packet
16
When to Initiate Flooding
• Topology change
– Link or node failure
– Link or node recovery
• Configuration change
– Link cost change
• Periodically
– Refresh the link-state information
– Typically (say) 30 minutes
– Corrects for possible corruption of the data
17
Convergence
• Getting consistent routing information to all nodes
– E.g., all nodes having the same link-state database
2
3 1
1
4
2 1
5
4 3
19
Transient Disruptions
• Inconsistent link-state database
– Some routers know about failure before others
– The shortest paths are no longer consistent
– Can cause transient forwarding loops
2 2
3 1 3 1
1 1
4 4
2 1 2 1
5
4 3 4 3
20
Convergence Delay
• Sources of convergence delay
– Detection latency
– Flooding of link-state information
– Shortest-path computation
– Creating the forwarding table
• Faster flooding
– Flooding immediately
– Sending link-state packets with high-priority
• Faster computation
– Faster processors on the routers
– Incremental Dijkstra algorithm
Area 1 Area 2
area Area 0
border
router
Area 3 Area 4
23
Bellman-Ford Algorithm
• Define distances at each node x
– dx(y) = cost of least-cost path from x to y
Each node:
Iterative, asynchronous:
each local iteration caused by:
• Local link cost change wait for (change in local link
cost or message from neighbor)
• Distance vector update
message from neighbor
26
Distance Vector Example: Step
0
Optimum 1-hop paths
Table for A Table for B
E 3 C
Dst Cst Hop Dst Cst Hop 1
A 0 A A 4 A
F 1
B 4 B B 0 B 2
6
C – C –
1
D – D 3 D 3 D
A 4
E 2 E E –
B
F 6 F F 1 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
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
27
Distance Vector Example: Step
2
Optimum 2-hop paths
Table for A Table for B
E 3 C
Dst Cst Hop Dst Cst Hop 1
A 0 A A 4 A 1
2 F
B 4 B B 0 B
6
C 7 F C 2 F 1
D 7 B D 3 D 3 D
A 4
E 2 E E 4 F
B
F 5 E F 1 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
A 7 F A 7 B A 2 A A 5 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
D 1 D D 0 D D – D 2 C
E 4 F E – E 0 E E 3 E
F 1 F F 2 C F 3 F F 0 F
28
Distance Vector Example: Step
3
Optimum 3-hop paths
Table for A Table for B
E 3 C
Dst Cst Hop Dst Cst Hop 1
A 0 A A 4 A 1
2 F
B 4 B B 0 B
6
C 6 E C 2 F 1
D 7 B D 3 D 3 D
A 4
E 2 E E 4 F
B
F 5 E F 1 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
A 6 F A 7 B A 2 A A 5 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
D 1 D D 0 D D 5 F D 2 C
E 4 F E 5 C E 0 E E 3 E
F 1 F F 2 C F 3 F F 0 F
29
Distance Vector: Link Cost
Changes
Link cost changes: 1
Y
4 1
• Node detects local link cost change
X Z
• Updates the distance table 50
algorithm
terminates
“good
news
travels
fast”
30
Distance Vector: Link Cost
Changes
Link cost changes: 60
• Good news travels fast Y
4 1
• Bad news travels slow - “count to X Z
50
infinity” problem!
algorithm
continues
on!
31
Distance Vector: Poison
Reverse
If Z routes through Y to get to X : 60
• Z tells Y its (Z’s) distance to X is infinite (so Y Y
4 1
won’t route to X via Z) X Z
50
• Still, can have problems when more than 2
routers are involved
algorithm
terminates
32
Routing Information Protocol
(RIP)
• Distance vector protocol
– Nodes send distance vectors every 30 seconds
– … or, when an update causes a change in routing
33
Comparison of LS and DV
algorithms
Message complexity Robustness: what happens
• LS: with n nodes, E links, O(nE) if router malfunctions?
messages sent
LS:
• DV: exchange between – Node can advertise incorrect
neighbors only link cost
– Convergence time varies – Each node computes only its
Speed of Convergence own table
34
Conclusions
• Routing is a distributed algorithm
– React to changes in the topology
– Compute the shortest paths
• Convergence process
– Changing from one topology to another
– Transient periods of inconsistency across routers