SlideShare a Scribd company logo
1
Shortest-Path Routing
Reading: Sections 4.2 and 4.3.4
COS 461: Computer Networks
Spring 2006 (MW 1:30-2:50 in Friend 109)
Jennifer Rexford
Teaching Assistant: Mike Wawrzoniak
http://www.cs.princeton.edu/courses/archive/spring06/cos461/
2
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
3
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
4
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
5
Why Does Routing Matter?
• End-to-end performance
–Quality of the path affects user performance
–Propagation delay, throughput, and packet loss
• Use of network resources
–Balance of the traffic over the routers and links
–Avoiding congestion by directing traffic to lightly-
loaded links
• Transient disruptions during changes
–Failures, maintenance, and load balancing
–Limiting packet loss and delay during changes
6
Shortest-Path Routing
•Path-selection model
–Destination-based
–Load-insensitive (e.g., static link weights)
–Minimum hop count or sum of link weights
3
2
2
1
1
4
1
4
5
3
7
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
• Compute: least-cost paths to all nodes
– From a given source u to all other nodes
– p(v): predecessor node along path from source to v
3
2
2
1
1
4
1
4
5
3
u
v
p(v)
8
Dijkstra’s Shortest-Path Algorithm
• Iterative algorithm
– After k iterations, know least-cost path to k nodes
• S: nodes whose least-cost path definitively known
– Initially, S = {u} where u is the source node
– Add one node to S in each iteration
• D(v): current cost of path from source to node v
– Initially, D(v) = c(u,v) for all nodes v adjacent to u
– … and D(v) = ∞ for all other nodes v
– Continually update D(v) as shorter paths are learned
9
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
10
Dijkstra’s Algorithm Example
3
2
2
1
1
4
1
4
5
3
3
2
2
1
1
4
1
4
5
3
3
2
2
1
1
4
1
4
5
3
3
2
2
1
1
4
1
4
5
3
11
Dijkstra’s Algorithm Example
3
2
2
1
1
4
1
4
5
3
3
2
2
1
1
4
1
4
5
3
3
2
2
1
1
4
1
4
5
3
3
2
2
1
1
4
1
4
5
3
12
Shortest-Path Tree
• Shortest-path tree from u • Forwarding table at u
3
2
2
1
1
4
1
4
5
3
u
v
w
x
y
z
s
t
v (u,v)
w (u,w)
x (u,w)
y (u,v)
z (u,v)
link
s (u,w)
t (u,w)
13
Link-State Routing
• Each router keeps track of its incident links
– Whether the link is up or down
– The cost on the link
• Each router broadcasts the link state
– To give every router a complete view of the graph
• Each router runs Dijkstra’s algorithm
– To compute the shortest paths
– … and construct the forwarding table
• Example protocols
– Open Shortest Path First (OSPF)
– Intermediate System – Intermediate System (IS-IS)
14
Detecting Topology Changes
• Beaconing
–Periodic “hello” messages in both directions
–Detect a failure after a few missed “hellos”
• Performance trade-offs
–Detection speed
–Overhead on link bandwidth and CPU
–Likelihood of false detection
“hello”
15
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
C B D
(a)
X A
C B D
(b)
X A
C B D
(c)
X A
C B D
(d)
16
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
17
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
18
Convergence
• Getting consistent routing information to all nodes
– E.g., all nodes having the same link-state database
• Consistent forwarding after convergence
– All nodes have the same link-state database
– All nodes forward packets on shortest paths
– The next router on the path forwards to the next hop
3
2
2
1
1
4
1
4
5
3
19
Transient Disruptions
• Detection delay
–A node does not detect a failed link immediately
–… and forwards data packets into a “blackhole”
–Depends on timeout for detecting lost hellos
3
2
2
1
1
4
1
4
5
3
20
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
3
2
2
1
1
4
1
4
5
3
3
2
2
1
1
4
1
4 3
21
Convergence Delay
• Sources of convergence delay
–Detection latency
–Flooding of link-state information
–Shortest-path computation
–Creating the forwarding table
• Performance during convergence period
–Lost packets due to blackholes and TTL expiry
–Looping packets consuming resources
–Out-of-order packets reaching the destination
• Very bad for VoIP, online gaming, and video
22
Reducing Convergence Delay
• Faster detection
– Smaller hello timers
– Link-layer technologies that can detect failures
• Faster flooding
– Flooding immediately
– Sending link-state packets with high-priority
• Faster computation
– Faster processors on the routers
– Incremental Dijkstra algorithm
• Faster forwarding-table update
– Data structures supporting incremental updates
23
Scaling Link-State Routing
• Overhead of link-state routing
– Flooding link-state packets throughout the network
– Running Dijkstra’s shortest-path algorithm
• Introducing hierarchy through “areas”
Area 0
Area 1 Area 2
Area 3 Area 4
area
border
router
24
Bellman-Ford Algorithm
• Define distances at each node x
– dx(y) = cost of least-cost path from x to y
• Update distances based on neighbors
– dx(y) = min {c(x,v) + dv(y)} over all neighbors v
3
2
2
1
1
4
1
4
5
3
u
v
w
x
y
z
s
t du(z) = min{c(u,v) + dv(z),
c(u,w) + dw(z)}
25
Distance Vector Algorithm
• c(x,v) = cost for direct link from x to v
– Node x maintains costs of direct links c(x,v)
• Dx(y) = estimate of least cost from x to y
– Node x maintains distance vector Dx = [Dx(y): y є N ]
• Node x maintains its neighbors’ distance vectors
– For each neighbor v, x maintains Dv = [Dv(y): y є N ]
• Each node v periodically sends Dv to its neighbors
– And neighbors update their own distance vectors
– Dx(y) ← minv{c(x,v) + Dv(y)} for each node y N
∊
• Over time, the distance vector Dx converges
26
Distance Vector Algorithm
Iterative, asynchronous:
each local iteration caused by:
• Local link cost change
• Distance vector update
message from neighbor
Distributed:
• Each node notifies neighbors
only when its DV changes
• Neighbors then notify their
neighbors if necessary
wait for (change in local link
cost or message from neighbor)
recompute estimates
if DV to any destination has
changed, notify neighbors
Each node:
27
Distance Vector Example: Step 0
A
E
F
C
D
B
2
3
6
4
1
1
1
3
Table for A
Dst Cst Hop
A 0 A
B 4 B
C  –
D  –
E 2 E
F 6 F
Table for B
Dst Cst Hop
A 4 A
B 0 B
C  –
D 3 D
E  –
F 1 F
Table for C
Dst Cst Hop
A  –
B  –
C 0 C
D 1 D
E  –
F 1 F
Table for D
Dst Cst Hop
A  –
B 3 B
C 1 C
D 0 D
E  –
F  –
Table for E
Dst Cst Hop
A 2 A
B  –
C  –
D  –
E 0 E
F 3 F
Table for F
Dst Cst Hop
A 6 A
B 1 B
C 1 C
D  –
E 3 E
F 0 F
Optimum 1-hop paths
28
Distance Vector Example: Step 2
Table for A
Dst Cst Hop
A 0 A
B 4 B
C 7 F
D 7 B
E 2 E
F 5 E
Table for B
Dst Cst Hop
A 4 A
B 0 B
C 2 F
D 3 D
E 4 F
F 1 F
Table for C
Dst Cst Hop
A 7 F
B 2 F
C 0 C
D 1 D
E 4 F
F 1 F
Table for D
Dst Cst Hop
A 7 B
B 3 B
C 1 C
D 0 D
E  –
F 2 C
Table for E
Dst Cst Hop
A 2 A
B 4 F
C 4 F
D  –
E 0 E
F 3 F
Table for F
Dst Cst Hop
A 5 B
B 1 B
C 1 C
D 2 C
E 3 E
F 0 F
Optimum 2-hop paths
A
E
F
C
D
B
2
3
6
4
1
1
1
3
29
Distance Vector Example: Step 3
Table for A
Dst Cst Hop
A 0 A
B 4 B
C 6 E
D 7 B
E 2 E
F 5 E
Table for B
Dst Cst Hop
A 4 A
B 0 B
C 2 F
D 3 D
E 4 F
F 1 F
Table for C
Dst Cst Hop
A 6 F
B 2 F
C 0 C
D 1 D
E 4 F
F 1 F
Table for D
Dst Cst Hop
A 7 B
B 3 B
C 1 C
D 0 D
E 5 C
F 2 C
Table for E
Dst Cst Hop
A 2 A
B 4 F
C 4 F
D 5 F
E 0 E
F 3 F
Table for F
Dst Cst Hop
A 5 B
B 1 B
C 1 C
D 2 C
E 3 E
F 0 F
Optimum 3-hop paths
A
E
F
C
D
B
2
3
6
4
1
1
1
3
30
Distance Vector: Link Cost Changes
Link cost changes:
• Node detects local link cost change
• Updates the distance table
• If cost change in least cost path, notify neighbors
X Z
1
4
50
Y
1
algorithm
terminates
“good
news
travels
fast”
31
Distance Vector: Link Cost Changes
Link cost changes:
• Good news travels fast
• Bad news travels slow - “count to
infinity” problem!
X Z
1
4
50
Y
60
algorithm
continues
on!
32
Distance Vector: Poison Reverse
If Z routes through Y to get to X :
• Z tells Y its (Z’s) distance to X is infinite (so Y
won’t route to X via Z)
• Still, can have problems when more than 2
routers are involved
X Z
1
4
50
Y
60
algorithm
terminates
33
Routing Information Protocol (RIP)
• Distance vector protocol
– Nodes send distance vectors every 30 seconds
– … or, when an update causes a change in routing
• Link costs in RIP
– All links have cost 1
– Valid distances of 1 through 15
– … with 16 representing infinity
– Small “infinity”  smaller “counting to infinity” problem
• RIP is limited to fairly small networks
– E.g., used in the Princeton campus network
34
Comparison of LS and DV algorithms
Message complexity
• LS: with n nodes, E links, O(nE)
messages sent
• DV: exchange between
neighbors only
– Convergence time varies
Speed of Convergence
• LS: O(n2
) algorithm requires
O(nE) messages
• DV: convergence time varies
– May be routing loops
– Count-to-infinity problem
Robustness: what happens
if router malfunctions?
LS:
– Node can advertise incorrect
link cost
– Each node computes only its
own table
DV:
– DV node can advertise
incorrect path cost
– Each node’s table used by
others (error propagates)
35
Conclusions
• Routing is a distributed algorithm
– React to changes in the topology
– Compute the shortest paths
• Two main shortest-path algorithms
– Dijkstra  link-state routing (e.g., OSPF and IS-IS)
– Bellman-Ford  distance vector routing (e.g., RIP)
• Convergence process
– Changing from one topology to another
– Transient periods of inconsistency across routers
• Next time: policy-based path-vector routing
– Reading: Section 4.3.3

More Related Content

Similar to Data Communications and Networks Network Layer (20)

PPT
Computer Networks Distance Vector Routing lecture10.ppt
vengaimarbhan1
 
PDF
routing
radhika477746
 
PPT
Routing
Saima Azam
 
PPTX
Network Layer
reshmadayma
 
PPT
module10-rip (1).ppt
Rakesh Dhiman
 
PPTX
Computer Networking Michaelmas/Lent Term M/W/F 11:00-12:00 LT1 in Gates Buil...
moaminmarey2001
 
PPTX
Distance Vector & Link state Routing Algorithm
MOHIT AGARWAL
 
PPTX
routing algorithm
AnusuaBasu
 
PDF
IRJET- Survey on Adaptive Routing Algorithms
IRJET Journal
 
PPTX
Computer networks for cse Unit-3 (1).pptx
pkumarnptl
 
PDF
Routing Protocols notes document .pptx.pdf
stefanrowlings
 
PDF
P5 - Routing Protocols
Kurniawan Dwi Irianto
 
PPTX
numeric network in the world of heart then ay iks jsns
kassemKhalil1
 
PPTX
Network layer. pptx
MiniT2
 
PPTX
Network layer of osi model .pptx
MiniT2
 
PPTX
Routing algorithm
Siva Priya
 
PDF
Dc ch11 : routing in switched networks
Syaiful Ahdan
 
PPT
Routing.pptbbbbbbbbbbbbbbbbbbbbbnbbnbbbbnbb
nijjilnarula1
 
PDF
DCCN Network Layer congestion control TCP
Sreedhar Chowdam
 
PPT
Network layer
TharuniDiddekunta
 
Computer Networks Distance Vector Routing lecture10.ppt
vengaimarbhan1
 
routing
radhika477746
 
Routing
Saima Azam
 
Network Layer
reshmadayma
 
module10-rip (1).ppt
Rakesh Dhiman
 
Computer Networking Michaelmas/Lent Term M/W/F 11:00-12:00 LT1 in Gates Buil...
moaminmarey2001
 
Distance Vector & Link state Routing Algorithm
MOHIT AGARWAL
 
routing algorithm
AnusuaBasu
 
IRJET- Survey on Adaptive Routing Algorithms
IRJET Journal
 
Computer networks for cse Unit-3 (1).pptx
pkumarnptl
 
Routing Protocols notes document .pptx.pdf
stefanrowlings
 
P5 - Routing Protocols
Kurniawan Dwi Irianto
 
numeric network in the world of heart then ay iks jsns
kassemKhalil1
 
Network layer. pptx
MiniT2
 
Network layer of osi model .pptx
MiniT2
 
Routing algorithm
Siva Priya
 
Dc ch11 : routing in switched networks
Syaiful Ahdan
 
Routing.pptbbbbbbbbbbbbbbbbbbbbbnbbnbbbbnbb
nijjilnarula1
 
DCCN Network Layer congestion control TCP
Sreedhar Chowdam
 
Network layer
TharuniDiddekunta
 

Recently uploaded (20)

PPTX
Green Building & Energy Conservation ppt
Sagar Sarangi
 
PDF
MAD Unit - 1 Introduction of Android IT Department
JappanMavani
 
PPTX
Product Development & DevelopmentLecture02.pptx
zeeshanwazir2
 
PDF
Zilliz Cloud Demo for performance and scale
Zilliz
 
PPTX
artificial intelligence applications in Geomatics
NawrasShatnawi1
 
PPTX
Introduction to Neural Networks and Perceptron Learning Algorithm.pptx
Kayalvizhi A
 
PPTX
The Role of Information Technology in Environmental Protectio....pptx
nallamillisriram
 
PPTX
Damage of stability of a ship and how its change .pptx
ehamadulhaque
 
PDF
Ethics and Trustworthy AI in Healthcare – Governing Sensitive Data, Profiling...
AlqualsaDIResearchGr
 
PPT
PPT2_Metal formingMECHANICALENGINEEIRNG .ppt
Praveen Kumar
 
PPTX
Day2 B2 Best.pptx
helenjenefa1
 
PPTX
VITEEE 2026 Exam Details , Important Dates
SonaliSingh127098
 
PDF
International Journal of Information Technology Convergence and services (IJI...
ijitcsjournal4
 
PPTX
Heart Bleed Bug - A case study (Course: Cryptography and Network Security)
Adri Jovin
 
PDF
Basic_Concepts_in_Clinical_Biochemistry_2018كيمياء_عملي.pdf
AdelLoin
 
DOCX
CS-802 (A) BDH Lab manual IPS Academy Indore
thegodhimself05
 
PPTX
Shinkawa Proposal to meet Vibration API670.pptx
AchmadBashori2
 
PDF
Set Relation Function Practice session 24.05.2025.pdf
DrStephenStrange4
 
PPTX
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
DOC
MRRS Strength and Durability of Concrete
CivilMythili
 
Green Building & Energy Conservation ppt
Sagar Sarangi
 
MAD Unit - 1 Introduction of Android IT Department
JappanMavani
 
Product Development & DevelopmentLecture02.pptx
zeeshanwazir2
 
Zilliz Cloud Demo for performance and scale
Zilliz
 
artificial intelligence applications in Geomatics
NawrasShatnawi1
 
Introduction to Neural Networks and Perceptron Learning Algorithm.pptx
Kayalvizhi A
 
The Role of Information Technology in Environmental Protectio....pptx
nallamillisriram
 
Damage of stability of a ship and how its change .pptx
ehamadulhaque
 
Ethics and Trustworthy AI in Healthcare – Governing Sensitive Data, Profiling...
AlqualsaDIResearchGr
 
PPT2_Metal formingMECHANICALENGINEEIRNG .ppt
Praveen Kumar
 
Day2 B2 Best.pptx
helenjenefa1
 
VITEEE 2026 Exam Details , Important Dates
SonaliSingh127098
 
International Journal of Information Technology Convergence and services (IJI...
ijitcsjournal4
 
Heart Bleed Bug - A case study (Course: Cryptography and Network Security)
Adri Jovin
 
Basic_Concepts_in_Clinical_Biochemistry_2018كيمياء_عملي.pdf
AdelLoin
 
CS-802 (A) BDH Lab manual IPS Academy Indore
thegodhimself05
 
Shinkawa Proposal to meet Vibration API670.pptx
AchmadBashori2
 
Set Relation Function Practice session 24.05.2025.pdf
DrStephenStrange4
 
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
MRRS Strength and Durability of Concrete
CivilMythili
 
Ad

Data Communications and Networks Network Layer

  • 1. 1 Shortest-Path Routing Reading: Sections 4.2 and 4.3.4 COS 461: Computer Networks Spring 2006 (MW 1:30-2:50 in Friend 109) Jennifer Rexford Teaching Assistant: Mike Wawrzoniak http://www.cs.princeton.edu/courses/archive/spring06/cos461/
  • 2. 2 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
  • 3. 3 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
  • 4. 4 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
  • 5. 5 Why Does Routing Matter? • End-to-end performance –Quality of the path affects user performance –Propagation delay, throughput, and packet loss • Use of network resources –Balance of the traffic over the routers and links –Avoiding congestion by directing traffic to lightly- loaded links • Transient disruptions during changes –Failures, maintenance, and load balancing –Limiting packet loss and delay during changes
  • 6. 6 Shortest-Path Routing •Path-selection model –Destination-based –Load-insensitive (e.g., static link weights) –Minimum hop count or sum of link weights 3 2 2 1 1 4 1 4 5 3
  • 7. 7 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 • Compute: least-cost paths to all nodes – From a given source u to all other nodes – p(v): predecessor node along path from source to v 3 2 2 1 1 4 1 4 5 3 u v p(v)
  • 8. 8 Dijkstra’s Shortest-Path Algorithm • Iterative algorithm – After k iterations, know least-cost path to k nodes • S: nodes whose least-cost path definitively known – Initially, S = {u} where u is the source node – Add one node to S in each iteration • D(v): current cost of path from source to node v – Initially, D(v) = c(u,v) for all nodes v adjacent to u – … and D(v) = ∞ for all other nodes v – Continually update D(v) as shorter paths are learned
  • 9. 9 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
  • 12. 12 Shortest-Path Tree • Shortest-path tree from u • Forwarding table at u 3 2 2 1 1 4 1 4 5 3 u v w x y z s t v (u,v) w (u,w) x (u,w) y (u,v) z (u,v) link s (u,w) t (u,w)
  • 13. 13 Link-State Routing • Each router keeps track of its incident links – Whether the link is up or down – The cost on the link • Each router broadcasts the link state – To give every router a complete view of the graph • Each router runs Dijkstra’s algorithm – To compute the shortest paths – … and construct the forwarding table • Example protocols – Open Shortest Path First (OSPF) – Intermediate System – Intermediate System (IS-IS)
  • 14. 14 Detecting Topology Changes • Beaconing –Periodic “hello” messages in both directions –Detect a failure after a few missed “hellos” • Performance trade-offs –Detection speed –Overhead on link bandwidth and CPU –Likelihood of false detection “hello”
  • 15. 15 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 C B D (a) X A C B D (b) X A C B D (c) X A C B D (d)
  • 16. 16 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
  • 17. 17 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
  • 18. 18 Convergence • Getting consistent routing information to all nodes – E.g., all nodes having the same link-state database • Consistent forwarding after convergence – All nodes have the same link-state database – All nodes forward packets on shortest paths – The next router on the path forwards to the next hop 3 2 2 1 1 4 1 4 5 3
  • 19. 19 Transient Disruptions • Detection delay –A node does not detect a failed link immediately –… and forwards data packets into a “blackhole” –Depends on timeout for detecting lost hellos 3 2 2 1 1 4 1 4 5 3
  • 20. 20 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 3 2 2 1 1 4 1 4 5 3 3 2 2 1 1 4 1 4 3
  • 21. 21 Convergence Delay • Sources of convergence delay –Detection latency –Flooding of link-state information –Shortest-path computation –Creating the forwarding table • Performance during convergence period –Lost packets due to blackholes and TTL expiry –Looping packets consuming resources –Out-of-order packets reaching the destination • Very bad for VoIP, online gaming, and video
  • 22. 22 Reducing Convergence Delay • Faster detection – Smaller hello timers – Link-layer technologies that can detect failures • Faster flooding – Flooding immediately – Sending link-state packets with high-priority • Faster computation – Faster processors on the routers – Incremental Dijkstra algorithm • Faster forwarding-table update – Data structures supporting incremental updates
  • 23. 23 Scaling Link-State Routing • Overhead of link-state routing – Flooding link-state packets throughout the network – Running Dijkstra’s shortest-path algorithm • Introducing hierarchy through “areas” Area 0 Area 1 Area 2 Area 3 Area 4 area border router
  • 24. 24 Bellman-Ford Algorithm • Define distances at each node x – dx(y) = cost of least-cost path from x to y • Update distances based on neighbors – dx(y) = min {c(x,v) + dv(y)} over all neighbors v 3 2 2 1 1 4 1 4 5 3 u v w x y z s t du(z) = min{c(u,v) + dv(z), c(u,w) + dw(z)}
  • 25. 25 Distance Vector Algorithm • c(x,v) = cost for direct link from x to v – Node x maintains costs of direct links c(x,v) • Dx(y) = estimate of least cost from x to y – Node x maintains distance vector Dx = [Dx(y): y є N ] • Node x maintains its neighbors’ distance vectors – For each neighbor v, x maintains Dv = [Dv(y): y є N ] • Each node v periodically sends Dv to its neighbors – And neighbors update their own distance vectors – Dx(y) ← minv{c(x,v) + Dv(y)} for each node y N ∊ • Over time, the distance vector Dx converges
  • 26. 26 Distance Vector Algorithm Iterative, asynchronous: each local iteration caused by: • Local link cost change • Distance vector update message from neighbor Distributed: • Each node notifies neighbors only when its DV changes • Neighbors then notify their neighbors if necessary wait for (change in local link cost or message from neighbor) recompute estimates if DV to any destination has changed, notify neighbors Each node:
  • 27. 27 Distance Vector Example: Step 0 A E F C D B 2 3 6 4 1 1 1 3 Table for A Dst Cst Hop A 0 A B 4 B C  – D  – E 2 E F 6 F Table for B Dst Cst Hop A 4 A B 0 B C  – D 3 D E  – F 1 F Table for C Dst Cst Hop A  – B  – C 0 C D 1 D E  – F 1 F Table for D Dst Cst Hop A  – B 3 B C 1 C D 0 D E  – F  – Table for E Dst Cst Hop A 2 A B  – C  – D  – E 0 E F 3 F Table for F Dst Cst Hop A 6 A B 1 B C 1 C D  – E 3 E F 0 F Optimum 1-hop paths
  • 28. 28 Distance Vector Example: Step 2 Table for A Dst Cst Hop A 0 A B 4 B C 7 F D 7 B E 2 E F 5 E Table for B Dst Cst Hop A 4 A B 0 B C 2 F D 3 D E 4 F F 1 F Table for C Dst Cst Hop A 7 F B 2 F C 0 C D 1 D E 4 F F 1 F Table for D Dst Cst Hop A 7 B B 3 B C 1 C D 0 D E  – F 2 C Table for E Dst Cst Hop A 2 A B 4 F C 4 F D  – E 0 E F 3 F Table for F Dst Cst Hop A 5 B B 1 B C 1 C D 2 C E 3 E F 0 F Optimum 2-hop paths A E F C D B 2 3 6 4 1 1 1 3
  • 29. 29 Distance Vector Example: Step 3 Table for A Dst Cst Hop A 0 A B 4 B C 6 E D 7 B E 2 E F 5 E Table for B Dst Cst Hop A 4 A B 0 B C 2 F D 3 D E 4 F F 1 F Table for C Dst Cst Hop A 6 F B 2 F C 0 C D 1 D E 4 F F 1 F Table for D Dst Cst Hop A 7 B B 3 B C 1 C D 0 D E 5 C F 2 C Table for E Dst Cst Hop A 2 A B 4 F C 4 F D 5 F E 0 E F 3 F Table for F Dst Cst Hop A 5 B B 1 B C 1 C D 2 C E 3 E F 0 F Optimum 3-hop paths A E F C D B 2 3 6 4 1 1 1 3
  • 30. 30 Distance Vector: Link Cost Changes Link cost changes: • Node detects local link cost change • Updates the distance table • If cost change in least cost path, notify neighbors X Z 1 4 50 Y 1 algorithm terminates “good news travels fast”
  • 31. 31 Distance Vector: Link Cost Changes Link cost changes: • Good news travels fast • Bad news travels slow - “count to infinity” problem! X Z 1 4 50 Y 60 algorithm continues on!
  • 32. 32 Distance Vector: Poison Reverse If Z routes through Y to get to X : • Z tells Y its (Z’s) distance to X is infinite (so Y won’t route to X via Z) • Still, can have problems when more than 2 routers are involved X Z 1 4 50 Y 60 algorithm terminates
  • 33. 33 Routing Information Protocol (RIP) • Distance vector protocol – Nodes send distance vectors every 30 seconds – … or, when an update causes a change in routing • Link costs in RIP – All links have cost 1 – Valid distances of 1 through 15 – … with 16 representing infinity – Small “infinity”  smaller “counting to infinity” problem • RIP is limited to fairly small networks – E.g., used in the Princeton campus network
  • 34. 34 Comparison of LS and DV algorithms Message complexity • LS: with n nodes, E links, O(nE) messages sent • DV: exchange between neighbors only – Convergence time varies Speed of Convergence • LS: O(n2 ) algorithm requires O(nE) messages • DV: convergence time varies – May be routing loops – Count-to-infinity problem Robustness: what happens if router malfunctions? LS: – Node can advertise incorrect link cost – Each node computes only its own table DV: – DV node can advertise incorrect path cost – Each node’s table used by others (error propagates)
  • 35. 35 Conclusions • Routing is a distributed algorithm – React to changes in the topology – Compute the shortest paths • Two main shortest-path algorithms – Dijkstra  link-state routing (e.g., OSPF and IS-IS) – Bellman-Ford  distance vector routing (e.g., RIP) • Convergence process – Changing from one topology to another – Transient periods of inconsistency across routers • Next time: policy-based path-vector routing – Reading: Section 4.3.3