SlideShare a Scribd company logo
1 of 31
Download to read offline
Internet Technology
08. Routing
Paul Krzyzanowski
Rutgers University
Spring 2016
1
March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
Routing algorithm goal
2
switch
LAN
LAN
router
router
Routing algorithm: given routers connected with links,
what is a good (best?) path from a source to a destination router
good = least cost
cost = time or money
1st hop router =
source router
last hop router =
destination router
March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
Routing graphs, neighbors, and cost
3
2
1
3
3
1
1
2
5
5
u
v w
z
y
x
Graph G = (N, E) N = set of nodes (routers)
E = set of edges (links)
Each edge = pair of connected nodes in N
Node y is a neighbor of node x if (x, y) ∈ E
Cost Each edge has a value representing the cost of the link
c(x, y) = cost of edge between nodes x & y
if (x, y) ∉ E, then c(x, y) = ∞
We will assume c(x, y) = c(y, x)
2
March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
Path cost, least-cost path, & shortest path
4
2
1
3
3
1
1
2
5
5
u
v w
z
y
x
A path in a graph G = (N, E) is a sequence of nodes (x1, x2, …, xp)
such that each of the pairs (x1, x2), (x2, x3), …, (xp-1, xp) are edges in E.
The cost of a path is the sum of edge costs: c(x1, x2), c(x2, x3), …, c(xp-1, xp)
There could be multiple paths between two nodes, each with a different cost.
One or more of these is a least-cost path.
Example: the least-cost path between u and w is (u, x, y, w) ⇒ c(u, x, y, w) = 3
If all edges have the same cost, then least-cost path = shortest path
2
March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
Algorithm classifications
Global routing algorithms
– Compute the least-cost path using complete knowledge of the network
– The algorithm knows the connectivity between all nodes & costs
– Centralized algorithm
– These are link-state (LS) algorithms
Decentralized routing algorithms
– No node has complete information about the costs of all links
– A node initially knows only its direct links
– Iterative process: calculate & exchange info with neighbors
• Eventually calculate the least-cost path to a destination
– Distance-Vector (DV) algorithm
5
March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
Additional algorithm classifications
• Static routing algorithms
– Routes change very slowly over time
• Dynamic routing algorithms
– Change routing paths as network traffic loads or topology change
• Load-sensitive algorithms
– Link costs vary to reflect the current level of congestion
• Load-insensitive algorithms
– Ignore current or recent levels of congestion
6
March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
Link-State (LS): Dijkstra’s Algorithm
• Assumption:
Entire network topology & link costs are known
– Each node broadcasts link-state packets to all other nodes
– All nodes have an identical, complete view of the network
• Compute least-cost path from one node to all other nodes
in the network
• Iterative algorithm
– After k iterations, least-cost paths are known to k nodes
7
March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
Dijkstra’s Algorithm
8
D(v):
cost of least-cost path from source to v
p(v):
previous node (neighbor of v) along the
least-cost path to v
N’:
subset of nodes for which we found the
least-cost path
2
1
3
3
1
1
2
5
5
u
v w
z
y
x
Initialize:
N’ = current node
N’ = { u }
for all nodes v
if v is a neighbor of u
D(v) = c(u, v)
else
D(v) = ∞
step N’ D(v), p(v) D(w), p(w) D(x),p(x) D(y),p(y) D(z),p(z)
0 u 2,u 5,u 1,u ∞ ∞
2
March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
Dijkstra’s Algorithm
9
D(v):
cost of least-cost path from source to v
p(v):
previous node (neighbor of v) along the
least-cost path to v
N’:
subset of nodes for which we found the
least-cost path
2
1
3
3
1
1
2
5
5
u
v w
z
y
x
Loop until N’ = N:
Find a node n not in N’ such that D(n) is
a minimum
→ Node x has minimum D(n)
add n to N’
N’ = {u, x}
for each neighbor m of n not in N’:
for each neighbor of node x
D(m) = min( D(m), D(n) + c(n, m) )
new cost = old cost or cost through x
if D(m) changed, set p(m) = n
step N’ D(v), p(v) D(w), p(w) D(x),p(x) D(y),p(y) D(z),p(z)
0 u 2,u 5,u 1,u ∞ ∞
1 ux 2,u 4,x 2,x ∞
Skip: u ∈ N’
Cost to v is
not better
through x
2
Cost to w
is better
through x
We now
have a
path to y
Ignore x;
it is in N’
March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
Least cost path
Dijkstra’s Algorithm
10
D(v):
cost of least-cost path from source to v
p(v):
previous node (neighbor of v) along the
least-cost path to v
N’:
subset of nodes for which we found the
least-cost path
2
1
3
3
1
1
2
5
5
u
v w
z
y
x
Loop until N’ = N:
find n not in N’ such that D(n) is a
minimum
→ Nodes v & y have minimum D(n)
Pick any one: we choose y
add n to N’
N’ = {u, x, y}
for each neighbor m of n not in N’:
for each neighbor of node y
D(m) = min( D(m), D(n) + c(n, m) )
new cost = old cost or cost through x
if D(m) changed, set p(m) = n
step N’ D(v), p(v) D(w), p(w) D(x),p(x) D(y),p(y) D(z),p(z)
0 u 2,u 5,u 1,u ∞ ∞
1 ux 2,u 4,x 2,x ∞
2 uxy 2,u 3,y 4,y
2
Cost to w
is even
better
through y
We now
have a
path to z
March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
Skip: x and y
are in N’
Least cost path
Dijkstra’s Algorithm
11
D(v):
cost of least-cost path from source to v
p(v):
previous node (neighbor of v) along the
least-cost path to v
N’:
subset of nodes for which we found the
least-cost path
2
1
3
3
1
1
2
5
5
u
v w
z
y
x
Loop until N’ = N:
find n not in N’ such that D(n) is a
minimum
→ Node v has minimum D(n)
add n to N’
N’ = {u, x, y, v}
for each neighbor m of n not in N’:
for each neighbor of node v
D(m) = min( D(m), D(n) + c(n,m) )
new cost = old cost or cost through x
if D(m) changed, set p(m) = n
step N’ D(v), p(v) D(w), p(w) D(x),p(x) D(y),p(y) D(z),p(z)
0 u 2,u 5,u 1,u ∞ ∞
1 ux 2,u 4,x 2,x ∞
2 uxy 2,u 3,y 4,y
3 uxyv 3,y 4,y
2
No improvement
(2+3) ≮ 3
No change: z is
not a neighbor
March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
Dijkstra’s Algorithm
12
D(v):
cost of least-cost path from source to v
p(v):
previous node (neighbor of v) along the
least-cost path to v
N’:
subset of nodes for which we found the
least-cost path
2
1
3
3
1
1
2
5
5
u
v w
z
y
x
Loop until N’ = N:
find n not in N’ such that D(n) is a
minimum
→ Node w has minimum D(n)
add n to N’
N’ = {u, x, y, v, w}
for each neighbor m of n not in N’:
for each neighbor of node w
D(m) = min( D(m), D(n) + c(n,m) )
new cost = old cost or cost through x
if D(m) changed, set p(m) = n
step N’ D(v), p(v) D(w), p(w) D(x),p(x) D(y),p(y) D(z),p(z)
0 u 2,u 5,u 1,u ∞ ∞
1 ux 2,u 4,x 2,x ∞
2 uxy 2,u 3,y 4,y
3 uxyv 3,y 4,y
4 uxyvw 4,y
2
No improvement
(3+5) ≮ 4
March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
Dijkstra’s Algorithm
13
D(v):
cost of least-cost path from source to v
p(v):
previous node (neighbor of v) along the
least-cost path to v
N’:
subset of nodes for which we found the
least-cost path
2
1
3
3
1
1
2
5
5
u
v w
z
y
x
Loop until N’ = N:
find n not in N’ such that D(n) is a
minimum
→ Node z is the only one left!
add n to N’
N’ = {u, x, y, v, w, z}
for each neighbor m of n not in N’:
There are no neighbors not in N’!
We’re done
step N’ D(v), p(v) D(w), p(w) D(x),p(x) D(y),p(y) D(z),p(z)
0 u 2,u 5,u 1,u ∞ ∞
1 ux 2,u 4,x 2,x ∞
2 uxy 2,u 3,y 4,y
3 uxyv 3,y 4,y
4 uxyvw 4,y
5 uxyvwz
2
March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
Dijkstra’s Algorithm
14
D(v):
cost of least-cost path from source to v
p(v):
previous node (neighbor of v) along the
least-cost path to v
N’:
subset of nodes for which we found the
least-cost path
2
1
3
3
1
1
2
5
5
u
v w
z
y
x
N’ = N:
All nodes are in N’
For each node, we have the total
cost from the source and the
predecessor along that path.
We can look up the predecessor to
find its predecessor
E.g., least-cost path from u → y
is u → x → y
2
step N’ D(v), p(v) D(w), p(w) D(x),p(x) D(y),p(y) D(z),p(z)
0 u 2,u 5,u 1,u ∞ ∞
1 ux 2,u 4,x 2,x ∞
2 uxy 2,u 3,y 4,y
3 uxyv 3,y 4,y
4 uxyvw 4,y
5 uxyvwz (1) y is w’s
predecessor
(2) x is y’s
predecessor
March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
(3) u is x’s
predecessor
Dijkstra’s Algorithm
15
D(v):
cost of least-cost path from source to v
p(v):
previous node (neighbor of v) along the
least-cost path to v
N’:
subset of nodes for which we found the
least-cost path
2
1
3
3
1
1
2
5
5
u
v w
z
y
x
We can create a forwarding table
that stores the next hop on the
least-cost route
Forwarding
table for
node u
2
step N’ D(v), p(v) D(w), p(w) D(x),p(x) D(y),p(y) D(z),p(z)
0 u 2,u 5,u 1,u ∞ ∞
1 ux 2,u 4,x 2,x ∞
2 uxy 2,u 3,y 4,y
3 uxyv 3,y 4,y
4 uxyvw 4,y
5 uxyvwz
Destination Link
v uv
w ux
x ux
y ux
z ux
March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
Dijkstra’s Algorithm
Computational cost
– 1st iteration: search n nodes to find the minimum cost node
– 2nd iteration: search n-1 nodes
– 3rd iteration: search n-2 nodes
– nth iteration: search 1 node
– Total of n iterations = n + (n - 1) + (n - 2) + … 1 = (𝑛 − 𝑖)
𝑛
𝑖=0
• We need to search n(n+1)/2 nodes
– Complexity = O(n2)
16
March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
If link cost = load carried on the link
• Link costs are not symmetric
– c(u, v) = c(v, u) only if the same
load flows in both directions
• Example loads
– Load of 1 comes into z for w
– Load of 1 comes into x for w
– Load of e comes into y for w
• When LS is run
– y determines (y→z→w) cost is 1
compared to (y→x→w) cost, which is 1+e
– x determines that x→y→z→w is a lower-cost path
Oscillations with congestion-based routing
17
0
z x
w
y
0
0
1 1+e
e
1
1
e
Initial routing
March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
• After route updates, LS is run again
• x, y, and z detect 0-cost path counterclockwise
Oscillations with congestion-based routing
18
0
z x
w
y
0
1
0
1
2+e
1
1
1
e
Counterclockwise routing
1
z x
w
y
1+e
0
2+e 0
0
1
1
e
Clockwise routing
March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
1
z x
w
y
1+e
0
2+e 0
0
1
1
e
Clockwise routing
0
z x
w
y
0
1
0 2+e
1
1
1
e
Counterclockwise routing
• After route updates, LS is run yet again
• x, y, and z now detect 0-cost path clockwise
Oscillations with congestion-based routing
19
1
March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
Avoiding oscillations
• Ensure that not all routers run the LS algorithm at the
same time
– Avoid synchronized routers by randomizing the time when a router
advertises its link state
20
March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
Distance-Vector Routing Algorithm
• Initial assumption
– Each router (node) knows the cost to reach its directly-connected neighbors
• Iterative, asynchronous, distributed algorithm
– Multiple iterations
• Each iteration caused by local link cost change or distance vector update message
from neighbor
– Asynchronous
• Does not require lockstep synchronization
– Distributed
• Each node receives information from one or more directly attached neighbors
• Notifies neighbors only when its distance-vector changes
21
March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
Bellman-Ford Equation
• What it says
– If x is not directly connected to y, it needs to first hop to some neighbor v
– The lowest cost is
(the cost of the first hop to v) + (the lowest cost from v to y)
= c(x, v) + dv(y)
– the least cost path from x to y, dx(y), is the minimum of the lowest cost of
all of x’s neighbors
dx(y) = minv{ c(x, v) + dv(y) }
• The value of v that satisfies the equation is the forwarding table entry
in x’s router for destination y
22
March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
x
y
v'
v’’
c(x,v’)
c(x,v’’)
dv’ (y)
dv’’ (y)
Distance-Vector Routing Algorithm
• At each node x we store:
– c(x, v) = cost for the direct link from x to v for each neighbor v
– Dx(y) = estimate of the cost of the least-cost path from x to y
– Distance Vector is the set of Dx(y) for all nodes y in N
Dx = [ Dx(y): y ∈ N ]
– Distance vectors received from its neighbors
Dv = [ Dv(y): y ∈ N ]
• Each node v periodically sends its distance vector, Dv to its neighbors
– When a node receives a distance vector, it saves it and updates its own distance
vector using the Bellman-Ford equation
Dx(y) = minv{ c(x, v) + Dv(y) } for each node y ∈ N
– If this results in a change to x’s DV, it sends the new DV to its neighbors
Each cost estimate Dx(y) converges to the actual least-cost Dx(y)
23
Least-cost estimates from x to all other nodes y
Set of least-cost estimates from each neighbor v to each node y
March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
Distance-Vector Example
24
2 1
7
y
x z
cost to
from
x y z
x 0 2 7
y ∞ ∞ ∞
z ∞ ∞ ∞
Node x DV table
cost to
from
x y z
x ∞ ∞ ∞
y 2 0 1
z ∞ ∞ ∞
Node y DV table
cost to
from
x y z
x ∞ ∞ ∞
y ∞ ∞ ∞
z 7 1 0
Node z DV table
March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
Distance-Vector Example
25
2 1
7
y
x z
cost to
from
x y z
x 0 2 7
y ∞ ∞ ∞
z ∞ ∞ ∞
Node x DV table
cost to
from
x y z
x ∞ ∞ ∞
y 2 0 1
z ∞ ∞ ∞
Node y DV table
cost to
from
x y z
x ∞ ∞ ∞
y ∞ ∞ ∞
z 7 1 0
Node z DV table
cost to
from
x y z
x 0 2 7
y ∞ ∞ ∞
z ∞ ∞ ∞
Node x DV table
cost to
from
x y z
x 0 2 7
y 2 0 1
z ∞ ∞ ∞
Node y DV table
cost to
from
x y z
x 0 2 7
y ∞ ∞ ∞
z 7 1 0
Node z DV table
Node x sends its DV {0, 2, 7} to nodes y and z
c(y, x) = 2 c(z, x) = 7
March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
Distance-Vector Example
26
2 1
7
y
x z
cost to
from
x y z
x 0 2 7
y ∞ ∞ ∞
z ∞ ∞ ∞
Node x DV table
cost to
from
x y z
x 0 2 7
y 2 0 1
z ∞ ∞ ∞
Node y DV table
cost to
from
x y z
x 0 2 7
y ∞ ∞ ∞
z 7 1 0
Node z DV table
cost to
from
x y z
x 0 2 3
y 2 0 1
z 7 1 0
Node x DV table
cost to
from
x y z
x 0 2 7
y 2 0 1
z 7 1 0
Node y DV table
cost to
from
x y z
x 0 2 7
y 2 0 1
z 3 1 0
Node z DV table
Node y sends its DV {2, 0, 1} to nodes x and z
Node z sends its DV {7, 1, 0} to nodes x and y
c(x, y) = 2 c(z, y) = 1
From y: c(y,z) is 1
c(x, z) = c(x, y) + c(y,z) =
= 2 + 1 = 3
Less than old value, 7
March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
From y: c(y,x) is 2
c(z, x) = c(z,y) + c(y,x) =
= 1 + 2 = 3
Less than old value, 7
Every update to a
node’s DV also
updates the
forwarding table
Distance-Vector Example
27
2 1
7
y
x z
cost to
from
x y z
x 0 2 3
y 2 0 1
z 7 1 0
Node x DV table
cost to
from
x y z
x 0 2 7
y 2 0 1
z 7 1 0
Node y DV table
cost to
from
x y z
x 0 2 7
y 2 0 1
z 3 1 0
Node z DV table
cost to
from
x y z
x 0 2 3
y 2 0 1
z 3 1 0
Node x DV table
cost to
from
x y z
x 0 2 3
y 2 0 1
z 3 1 0
Node y DV table
cost to
from
x y z
x 0 2 3
y 2 0 1
z 3 1 0
Node z DV table
Node x sends its DV {0, 2, 7} to nodes y and z
Node y’s vector did not change – it stays quiet
Node z sends its DV {2, 0, 1} to nodes x and y
We converged. Everyone has the same view of the network. Nobody has updates to send.
March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
Link cost changes
• The DV algorithm remains quiet once it converges
– … until some link cost changes
• If a node detects link cost change between itself and a neighbor
– It updates its distance vector
– If there is a change in the cost of any least-cost path
it informs its neighbors of the new distance vector
– Each neighbor computes a new least cost
• If the value changed from its previous value, it sends its DV to its neighbors
• Recompute until values converge
March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski 28
Link loss
29
Suppose we lose the link to C: c(B,C) = ∞
B will send an update to A but A thinks its cost to C is 3
B will think there is a route to C: B→A→C with a cost of (c(B,A) + 3) = 4
1 2
Distance to
C =3
Distance to
C =2
A B C
1 ∞
Distance to
C =3
Distance to
C =4
A B C
Update (A,C)=3
1 ∞
Distance to
C =5
Distance to
C =4
A B C
Update (B,C)=4
This continues ad infinitum!
We created a
Routing Loop
March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
Mitigation: Poison Reverse
• If A routes through B to get to C
– A will advertise to B that its distance is infinity
– B will then never attempt to route through A
• This does not work with loops involving 3 or more nodes!
• Other approaches
– Limit size of network by setting a hop (cost) limit
– Send full path information in route advertisement
• Perform explicit queries for loops
30
March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
The end
31
March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski

More Related Content

Similar to 08-routing-1-slides.pdf

Bellman Ford Routing Algorithm-Computer Networks
Bellman Ford Routing Algorithm-Computer NetworksBellman Ford Routing Algorithm-Computer Networks
Bellman Ford Routing Algorithm-Computer NetworksSimranJain63
 
Algorithm Design and Complexity - Course 10
Algorithm Design and Complexity - Course 10Algorithm Design and Complexity - Course 10
Algorithm Design and Complexity - Course 10Traian Rebedea
 
Link Prediction in the Real World
Link Prediction in the Real WorldLink Prediction in the Real World
Link Prediction in the Real WorldBalaji Ganesan
 
bellman-ford Theorem.ppt
bellman-ford Theorem.pptbellman-ford Theorem.ppt
bellman-ford Theorem.pptSaimaShaheen14
 
04 greedyalgorithmsii 2x2
04 greedyalgorithmsii 2x204 greedyalgorithmsii 2x2
04 greedyalgorithmsii 2x2MuradAmn
 
Module 3- transport_layer .pptx
Module 3- transport_layer           .pptxModule 3- transport_layer           .pptx
Module 3- transport_layer .pptxhariprasad279825
 
Social network analysis
Social network analysisSocial network analysis
Social network analysisStefanie Zhao
 
Single source shortes path in dag
Single source shortes path in dagSingle source shortes path in dag
Single source shortes path in dagKiran K
 
Chap10 slides
Chap10 slidesChap10 slides
Chap10 slidesHJ DS
 
Digital Distance Geometry
Digital Distance GeometryDigital Distance Geometry
Digital Distance Geometryppd1961
 

Similar to 08-routing-1-slides.pdf (20)

Bellman Ford Routing Algorithm-Computer Networks
Bellman Ford Routing Algorithm-Computer NetworksBellman Ford Routing Algorithm-Computer Networks
Bellman Ford Routing Algorithm-Computer Networks
 
Deepwalk vs Node2vec
Deepwalk vs Node2vecDeepwalk vs Node2vec
Deepwalk vs Node2vec
 
Algorithm Design and Complexity - Course 10
Algorithm Design and Complexity - Course 10Algorithm Design and Complexity - Course 10
Algorithm Design and Complexity - Course 10
 
Link Prediction in the Real World
Link Prediction in the Real WorldLink Prediction in the Real World
Link Prediction in the Real World
 
Deepwalk vs Node2vec
Deepwalk vs Node2vecDeepwalk vs Node2vec
Deepwalk vs Node2vec
 
04 greedyalgorithmsii
04 greedyalgorithmsii04 greedyalgorithmsii
04 greedyalgorithmsii
 
Dijkstra
DijkstraDijkstra
Dijkstra
 
d
dd
d
 
bellman-ford Theorem.ppt
bellman-ford Theorem.pptbellman-ford Theorem.ppt
bellman-ford Theorem.ppt
 
04 greedyalgorithmsii 2x2
04 greedyalgorithmsii 2x204 greedyalgorithmsii 2x2
04 greedyalgorithmsii 2x2
 
Module 3- transport_layer .pptx
Module 3- transport_layer           .pptxModule 3- transport_layer           .pptx
Module 3- transport_layer .pptx
 
Bellmanford
BellmanfordBellmanford
Bellmanford
 
12_Graph.pptx
12_Graph.pptx12_Graph.pptx
12_Graph.pptx
 
Dijkstra.ppt
Dijkstra.pptDijkstra.ppt
Dijkstra.ppt
 
Social network analysis
Social network analysisSocial network analysis
Social network analysis
 
Single source shortes path in dag
Single source shortes path in dagSingle source shortes path in dag
Single source shortes path in dag
 
Dijkstra c
Dijkstra cDijkstra c
Dijkstra c
 
1535 graph algorithms
1535 graph algorithms1535 graph algorithms
1535 graph algorithms
 
Chap10 slides
Chap10 slidesChap10 slides
Chap10 slides
 
Digital Distance Geometry
Digital Distance GeometryDigital Distance Geometry
Digital Distance Geometry
 

Recently uploaded

Downtown Call Girls O5O91O128O Pakistani Call Girls in Downtown
Downtown Call Girls O5O91O128O Pakistani Call Girls in DowntownDowntown Call Girls O5O91O128O Pakistani Call Girls in Downtown
Downtown Call Girls O5O91O128O Pakistani Call Girls in Downtowndajasot375
 
SHIVNA SAHITYIKI APRIL JUNE 2024 Magazine
SHIVNA SAHITYIKI APRIL JUNE 2024 MagazineSHIVNA SAHITYIKI APRIL JUNE 2024 Magazine
SHIVNA SAHITYIKI APRIL JUNE 2024 MagazineShivna Prakashan
 
Pragati Maidan Call Girls : ☎ 8527673949, Low rate Call Girls
Pragati Maidan Call Girls : ☎ 8527673949, Low rate Call GirlsPragati Maidan Call Girls : ☎ 8527673949, Low rate Call Girls
Pragati Maidan Call Girls : ☎ 8527673949, Low rate Call Girlsashishs7044
 
The First Date by Daniel Johnson (Inspired By True Events)
The First Date by Daniel Johnson (Inspired By True Events)The First Date by Daniel Johnson (Inspired By True Events)
The First Date by Daniel Johnson (Inspired By True Events)thephillipta
 
Roadrunner Lodge, Motel/Residence, Tucumcari NM
Roadrunner Lodge, Motel/Residence, Tucumcari NMRoadrunner Lodge, Motel/Residence, Tucumcari NM
Roadrunner Lodge, Motel/Residence, Tucumcari NMroute66connected
 
Retail Store Scavanger Hunt - Foundation College Park
Retail Store Scavanger Hunt - Foundation College ParkRetail Store Scavanger Hunt - Foundation College Park
Retail Store Scavanger Hunt - Foundation College Parkjosebenzaquen
 
Olivia Cox. intertextual references.pptx
Olivia Cox. intertextual references.pptxOlivia Cox. intertextual references.pptx
Olivia Cox. intertextual references.pptxLauraFagan6
 
Low Rate Call Girls in Laxmi Nagar Delhi Call 9990771857
Low Rate Call Girls in Laxmi Nagar Delhi Call 9990771857Low Rate Call Girls in Laxmi Nagar Delhi Call 9990771857
Low Rate Call Girls in Laxmi Nagar Delhi Call 9990771857delhimodel235
 
FULL ENJOY - 9953040155 Call Girls in Mahipalpur | Delhi
FULL ENJOY - 9953040155 Call Girls in Mahipalpur | DelhiFULL ENJOY - 9953040155 Call Girls in Mahipalpur | Delhi
FULL ENJOY - 9953040155 Call Girls in Mahipalpur | DelhiMalviyaNagarCallGirl
 
Jagat Puri Call Girls : ☎ 8527673949, Low rate Call Girls
Jagat Puri Call Girls : ☎ 8527673949, Low rate Call GirlsJagat Puri Call Girls : ☎ 8527673949, Low rate Call Girls
Jagat Puri Call Girls : ☎ 8527673949, Low rate Call Girlsashishs7044
 
Mandi House Call Girls : ☎ 8527673949, Low rate Call Girls
Mandi House Call Girls : ☎ 8527673949, Low rate Call GirlsMandi House Call Girls : ☎ 8527673949, Low rate Call Girls
Mandi House Call Girls : ☎ 8527673949, Low rate Call Girlsashishs7044
 
FULL ENJOY - 9953040155 Call Girls in Gtb Nagar | Delhi
FULL ENJOY - 9953040155 Call Girls in Gtb Nagar | DelhiFULL ENJOY - 9953040155 Call Girls in Gtb Nagar | Delhi
FULL ENJOY - 9953040155 Call Girls in Gtb Nagar | DelhiMalviyaNagarCallGirl
 
Bur Dubai Call Girls O58993O4O2 Call Girls in Bur Dubai
Bur Dubai Call Girls O58993O4O2 Call Girls in Bur DubaiBur Dubai Call Girls O58993O4O2 Call Girls in Bur Dubai
Bur Dubai Call Girls O58993O4O2 Call Girls in Bur Dubaidajasot375
 
Lucknow 💋 Virgin Call Girls Lucknow | Book 8923113531 Extreme Naughty Call Gi...
Lucknow 💋 Virgin Call Girls Lucknow | Book 8923113531 Extreme Naughty Call Gi...Lucknow 💋 Virgin Call Girls Lucknow | Book 8923113531 Extreme Naughty Call Gi...
Lucknow 💋 Virgin Call Girls Lucknow | Book 8923113531 Extreme Naughty Call Gi...anilsa9823
 
Bridge Fight Board by Daniel Johnson dtjohnsonart.com
Bridge Fight Board by Daniel Johnson dtjohnsonart.comBridge Fight Board by Daniel Johnson dtjohnsonart.com
Bridge Fight Board by Daniel Johnson dtjohnsonart.comthephillipta
 
How Can You Get Dubai Call Girls +971564860409 Call Girls Dubai?
How Can You Get Dubai Call Girls +971564860409 Call Girls Dubai?How Can You Get Dubai Call Girls +971564860409 Call Girls Dubai?
How Can You Get Dubai Call Girls +971564860409 Call Girls Dubai?kexey39068
 
Greater Noida Call Girls : ☎ 8527673949, Low rate Call Girls
Greater Noida Call Girls : ☎ 8527673949, Low rate Call GirlsGreater Noida Call Girls : ☎ 8527673949, Low rate Call Girls
Greater Noida Call Girls : ☎ 8527673949, Low rate Call Girlsashishs7044
 
Alex and Chloe by Daniel Johnson Storyboard
Alex and Chloe by Daniel Johnson StoryboardAlex and Chloe by Daniel Johnson Storyboard
Alex and Chloe by Daniel Johnson Storyboardthephillipta
 
Burari Call Girls : ☎ 8527673949, Low rate Call Girls
Burari Call Girls : ☎ 8527673949, Low rate Call GirlsBurari Call Girls : ☎ 8527673949, Low rate Call Girls
Burari Call Girls : ☎ 8527673949, Low rate Call Girlsashishs7044
 

Recently uploaded (20)

Downtown Call Girls O5O91O128O Pakistani Call Girls in Downtown
Downtown Call Girls O5O91O128O Pakistani Call Girls in DowntownDowntown Call Girls O5O91O128O Pakistani Call Girls in Downtown
Downtown Call Girls O5O91O128O Pakistani Call Girls in Downtown
 
SHIVNA SAHITYIKI APRIL JUNE 2024 Magazine
SHIVNA SAHITYIKI APRIL JUNE 2024 MagazineSHIVNA SAHITYIKI APRIL JUNE 2024 Magazine
SHIVNA SAHITYIKI APRIL JUNE 2024 Magazine
 
Pragati Maidan Call Girls : ☎ 8527673949, Low rate Call Girls
Pragati Maidan Call Girls : ☎ 8527673949, Low rate Call GirlsPragati Maidan Call Girls : ☎ 8527673949, Low rate Call Girls
Pragati Maidan Call Girls : ☎ 8527673949, Low rate Call Girls
 
The First Date by Daniel Johnson (Inspired By True Events)
The First Date by Daniel Johnson (Inspired By True Events)The First Date by Daniel Johnson (Inspired By True Events)
The First Date by Daniel Johnson (Inspired By True Events)
 
Dxb Call Girls # +971529501107 # Call Girls In Dxb Dubai || (UAE)
Dxb Call Girls # +971529501107 # Call Girls In Dxb Dubai || (UAE)Dxb Call Girls # +971529501107 # Call Girls In Dxb Dubai || (UAE)
Dxb Call Girls # +971529501107 # Call Girls In Dxb Dubai || (UAE)
 
Roadrunner Lodge, Motel/Residence, Tucumcari NM
Roadrunner Lodge, Motel/Residence, Tucumcari NMRoadrunner Lodge, Motel/Residence, Tucumcari NM
Roadrunner Lodge, Motel/Residence, Tucumcari NM
 
Retail Store Scavanger Hunt - Foundation College Park
Retail Store Scavanger Hunt - Foundation College ParkRetail Store Scavanger Hunt - Foundation College Park
Retail Store Scavanger Hunt - Foundation College Park
 
Olivia Cox. intertextual references.pptx
Olivia Cox. intertextual references.pptxOlivia Cox. intertextual references.pptx
Olivia Cox. intertextual references.pptx
 
Low Rate Call Girls in Laxmi Nagar Delhi Call 9990771857
Low Rate Call Girls in Laxmi Nagar Delhi Call 9990771857Low Rate Call Girls in Laxmi Nagar Delhi Call 9990771857
Low Rate Call Girls in Laxmi Nagar Delhi Call 9990771857
 
FULL ENJOY - 9953040155 Call Girls in Mahipalpur | Delhi
FULL ENJOY - 9953040155 Call Girls in Mahipalpur | DelhiFULL ENJOY - 9953040155 Call Girls in Mahipalpur | Delhi
FULL ENJOY - 9953040155 Call Girls in Mahipalpur | Delhi
 
Jagat Puri Call Girls : ☎ 8527673949, Low rate Call Girls
Jagat Puri Call Girls : ☎ 8527673949, Low rate Call GirlsJagat Puri Call Girls : ☎ 8527673949, Low rate Call Girls
Jagat Puri Call Girls : ☎ 8527673949, Low rate Call Girls
 
Mandi House Call Girls : ☎ 8527673949, Low rate Call Girls
Mandi House Call Girls : ☎ 8527673949, Low rate Call GirlsMandi House Call Girls : ☎ 8527673949, Low rate Call Girls
Mandi House Call Girls : ☎ 8527673949, Low rate Call Girls
 
FULL ENJOY - 9953040155 Call Girls in Gtb Nagar | Delhi
FULL ENJOY - 9953040155 Call Girls in Gtb Nagar | DelhiFULL ENJOY - 9953040155 Call Girls in Gtb Nagar | Delhi
FULL ENJOY - 9953040155 Call Girls in Gtb Nagar | Delhi
 
Bur Dubai Call Girls O58993O4O2 Call Girls in Bur Dubai
Bur Dubai Call Girls O58993O4O2 Call Girls in Bur DubaiBur Dubai Call Girls O58993O4O2 Call Girls in Bur Dubai
Bur Dubai Call Girls O58993O4O2 Call Girls in Bur Dubai
 
Lucknow 💋 Virgin Call Girls Lucknow | Book 8923113531 Extreme Naughty Call Gi...
Lucknow 💋 Virgin Call Girls Lucknow | Book 8923113531 Extreme Naughty Call Gi...Lucknow 💋 Virgin Call Girls Lucknow | Book 8923113531 Extreme Naughty Call Gi...
Lucknow 💋 Virgin Call Girls Lucknow | Book 8923113531 Extreme Naughty Call Gi...
 
Bridge Fight Board by Daniel Johnson dtjohnsonart.com
Bridge Fight Board by Daniel Johnson dtjohnsonart.comBridge Fight Board by Daniel Johnson dtjohnsonart.com
Bridge Fight Board by Daniel Johnson dtjohnsonart.com
 
How Can You Get Dubai Call Girls +971564860409 Call Girls Dubai?
How Can You Get Dubai Call Girls +971564860409 Call Girls Dubai?How Can You Get Dubai Call Girls +971564860409 Call Girls Dubai?
How Can You Get Dubai Call Girls +971564860409 Call Girls Dubai?
 
Greater Noida Call Girls : ☎ 8527673949, Low rate Call Girls
Greater Noida Call Girls : ☎ 8527673949, Low rate Call GirlsGreater Noida Call Girls : ☎ 8527673949, Low rate Call Girls
Greater Noida Call Girls : ☎ 8527673949, Low rate Call Girls
 
Alex and Chloe by Daniel Johnson Storyboard
Alex and Chloe by Daniel Johnson StoryboardAlex and Chloe by Daniel Johnson Storyboard
Alex and Chloe by Daniel Johnson Storyboard
 
Burari Call Girls : ☎ 8527673949, Low rate Call Girls
Burari Call Girls : ☎ 8527673949, Low rate Call GirlsBurari Call Girls : ☎ 8527673949, Low rate Call Girls
Burari Call Girls : ☎ 8527673949, Low rate Call Girls
 

08-routing-1-slides.pdf

  • 1. Internet Technology 08. Routing Paul Krzyzanowski Rutgers University Spring 2016 1 March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
  • 2. Routing algorithm goal 2 switch LAN LAN router router Routing algorithm: given routers connected with links, what is a good (best?) path from a source to a destination router good = least cost cost = time or money 1st hop router = source router last hop router = destination router March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
  • 3. Routing graphs, neighbors, and cost 3 2 1 3 3 1 1 2 5 5 u v w z y x Graph G = (N, E) N = set of nodes (routers) E = set of edges (links) Each edge = pair of connected nodes in N Node y is a neighbor of node x if (x, y) ∈ E Cost Each edge has a value representing the cost of the link c(x, y) = cost of edge between nodes x & y if (x, y) ∉ E, then c(x, y) = ∞ We will assume c(x, y) = c(y, x) 2 March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
  • 4. Path cost, least-cost path, & shortest path 4 2 1 3 3 1 1 2 5 5 u v w z y x A path in a graph G = (N, E) is a sequence of nodes (x1, x2, …, xp) such that each of the pairs (x1, x2), (x2, x3), …, (xp-1, xp) are edges in E. The cost of a path is the sum of edge costs: c(x1, x2), c(x2, x3), …, c(xp-1, xp) There could be multiple paths between two nodes, each with a different cost. One or more of these is a least-cost path. Example: the least-cost path between u and w is (u, x, y, w) ⇒ c(u, x, y, w) = 3 If all edges have the same cost, then least-cost path = shortest path 2 March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
  • 5. Algorithm classifications Global routing algorithms – Compute the least-cost path using complete knowledge of the network – The algorithm knows the connectivity between all nodes & costs – Centralized algorithm – These are link-state (LS) algorithms Decentralized routing algorithms – No node has complete information about the costs of all links – A node initially knows only its direct links – Iterative process: calculate & exchange info with neighbors • Eventually calculate the least-cost path to a destination – Distance-Vector (DV) algorithm 5 March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
  • 6. Additional algorithm classifications • Static routing algorithms – Routes change very slowly over time • Dynamic routing algorithms – Change routing paths as network traffic loads or topology change • Load-sensitive algorithms – Link costs vary to reflect the current level of congestion • Load-insensitive algorithms – Ignore current or recent levels of congestion 6 March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
  • 7. Link-State (LS): Dijkstra’s Algorithm • Assumption: Entire network topology & link costs are known – Each node broadcasts link-state packets to all other nodes – All nodes have an identical, complete view of the network • Compute least-cost path from one node to all other nodes in the network • Iterative algorithm – After k iterations, least-cost paths are known to k nodes 7 March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
  • 8. Dijkstra’s Algorithm 8 D(v): cost of least-cost path from source to v p(v): previous node (neighbor of v) along the least-cost path to v N’: subset of nodes for which we found the least-cost path 2 1 3 3 1 1 2 5 5 u v w z y x Initialize: N’ = current node N’ = { u } for all nodes v if v is a neighbor of u D(v) = c(u, v) else D(v) = ∞ step N’ D(v), p(v) D(w), p(w) D(x),p(x) D(y),p(y) D(z),p(z) 0 u 2,u 5,u 1,u ∞ ∞ 2 March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
  • 9. Dijkstra’s Algorithm 9 D(v): cost of least-cost path from source to v p(v): previous node (neighbor of v) along the least-cost path to v N’: subset of nodes for which we found the least-cost path 2 1 3 3 1 1 2 5 5 u v w z y x Loop until N’ = N: Find a node n not in N’ such that D(n) is a minimum → Node x has minimum D(n) add n to N’ N’ = {u, x} for each neighbor m of n not in N’: for each neighbor of node x D(m) = min( D(m), D(n) + c(n, m) ) new cost = old cost or cost through x if D(m) changed, set p(m) = n step N’ D(v), p(v) D(w), p(w) D(x),p(x) D(y),p(y) D(z),p(z) 0 u 2,u 5,u 1,u ∞ ∞ 1 ux 2,u 4,x 2,x ∞ Skip: u ∈ N’ Cost to v is not better through x 2 Cost to w is better through x We now have a path to y Ignore x; it is in N’ March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski Least cost path
  • 10. Dijkstra’s Algorithm 10 D(v): cost of least-cost path from source to v p(v): previous node (neighbor of v) along the least-cost path to v N’: subset of nodes for which we found the least-cost path 2 1 3 3 1 1 2 5 5 u v w z y x Loop until N’ = N: find n not in N’ such that D(n) is a minimum → Nodes v & y have minimum D(n) Pick any one: we choose y add n to N’ N’ = {u, x, y} for each neighbor m of n not in N’: for each neighbor of node y D(m) = min( D(m), D(n) + c(n, m) ) new cost = old cost or cost through x if D(m) changed, set p(m) = n step N’ D(v), p(v) D(w), p(w) D(x),p(x) D(y),p(y) D(z),p(z) 0 u 2,u 5,u 1,u ∞ ∞ 1 ux 2,u 4,x 2,x ∞ 2 uxy 2,u 3,y 4,y 2 Cost to w is even better through y We now have a path to z March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski Skip: x and y are in N’ Least cost path
  • 11. Dijkstra’s Algorithm 11 D(v): cost of least-cost path from source to v p(v): previous node (neighbor of v) along the least-cost path to v N’: subset of nodes for which we found the least-cost path 2 1 3 3 1 1 2 5 5 u v w z y x Loop until N’ = N: find n not in N’ such that D(n) is a minimum → Node v has minimum D(n) add n to N’ N’ = {u, x, y, v} for each neighbor m of n not in N’: for each neighbor of node v D(m) = min( D(m), D(n) + c(n,m) ) new cost = old cost or cost through x if D(m) changed, set p(m) = n step N’ D(v), p(v) D(w), p(w) D(x),p(x) D(y),p(y) D(z),p(z) 0 u 2,u 5,u 1,u ∞ ∞ 1 ux 2,u 4,x 2,x ∞ 2 uxy 2,u 3,y 4,y 3 uxyv 3,y 4,y 2 No improvement (2+3) ≮ 3 No change: z is not a neighbor March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
  • 12. Dijkstra’s Algorithm 12 D(v): cost of least-cost path from source to v p(v): previous node (neighbor of v) along the least-cost path to v N’: subset of nodes for which we found the least-cost path 2 1 3 3 1 1 2 5 5 u v w z y x Loop until N’ = N: find n not in N’ such that D(n) is a minimum → Node w has minimum D(n) add n to N’ N’ = {u, x, y, v, w} for each neighbor m of n not in N’: for each neighbor of node w D(m) = min( D(m), D(n) + c(n,m) ) new cost = old cost or cost through x if D(m) changed, set p(m) = n step N’ D(v), p(v) D(w), p(w) D(x),p(x) D(y),p(y) D(z),p(z) 0 u 2,u 5,u 1,u ∞ ∞ 1 ux 2,u 4,x 2,x ∞ 2 uxy 2,u 3,y 4,y 3 uxyv 3,y 4,y 4 uxyvw 4,y 2 No improvement (3+5) ≮ 4 March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
  • 13. Dijkstra’s Algorithm 13 D(v): cost of least-cost path from source to v p(v): previous node (neighbor of v) along the least-cost path to v N’: subset of nodes for which we found the least-cost path 2 1 3 3 1 1 2 5 5 u v w z y x Loop until N’ = N: find n not in N’ such that D(n) is a minimum → Node z is the only one left! add n to N’ N’ = {u, x, y, v, w, z} for each neighbor m of n not in N’: There are no neighbors not in N’! We’re done step N’ D(v), p(v) D(w), p(w) D(x),p(x) D(y),p(y) D(z),p(z) 0 u 2,u 5,u 1,u ∞ ∞ 1 ux 2,u 4,x 2,x ∞ 2 uxy 2,u 3,y 4,y 3 uxyv 3,y 4,y 4 uxyvw 4,y 5 uxyvwz 2 March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
  • 14. Dijkstra’s Algorithm 14 D(v): cost of least-cost path from source to v p(v): previous node (neighbor of v) along the least-cost path to v N’: subset of nodes for which we found the least-cost path 2 1 3 3 1 1 2 5 5 u v w z y x N’ = N: All nodes are in N’ For each node, we have the total cost from the source and the predecessor along that path. We can look up the predecessor to find its predecessor E.g., least-cost path from u → y is u → x → y 2 step N’ D(v), p(v) D(w), p(w) D(x),p(x) D(y),p(y) D(z),p(z) 0 u 2,u 5,u 1,u ∞ ∞ 1 ux 2,u 4,x 2,x ∞ 2 uxy 2,u 3,y 4,y 3 uxyv 3,y 4,y 4 uxyvw 4,y 5 uxyvwz (1) y is w’s predecessor (2) x is y’s predecessor March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski (3) u is x’s predecessor
  • 15. Dijkstra’s Algorithm 15 D(v): cost of least-cost path from source to v p(v): previous node (neighbor of v) along the least-cost path to v N’: subset of nodes for which we found the least-cost path 2 1 3 3 1 1 2 5 5 u v w z y x We can create a forwarding table that stores the next hop on the least-cost route Forwarding table for node u 2 step N’ D(v), p(v) D(w), p(w) D(x),p(x) D(y),p(y) D(z),p(z) 0 u 2,u 5,u 1,u ∞ ∞ 1 ux 2,u 4,x 2,x ∞ 2 uxy 2,u 3,y 4,y 3 uxyv 3,y 4,y 4 uxyvw 4,y 5 uxyvwz Destination Link v uv w ux x ux y ux z ux March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
  • 16. Dijkstra’s Algorithm Computational cost – 1st iteration: search n nodes to find the minimum cost node – 2nd iteration: search n-1 nodes – 3rd iteration: search n-2 nodes – nth iteration: search 1 node – Total of n iterations = n + (n - 1) + (n - 2) + … 1 = (𝑛 − 𝑖) 𝑛 𝑖=0 • We need to search n(n+1)/2 nodes – Complexity = O(n2) 16 March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
  • 17. If link cost = load carried on the link • Link costs are not symmetric – c(u, v) = c(v, u) only if the same load flows in both directions • Example loads – Load of 1 comes into z for w – Load of 1 comes into x for w – Load of e comes into y for w • When LS is run – y determines (y→z→w) cost is 1 compared to (y→x→w) cost, which is 1+e – x determines that x→y→z→w is a lower-cost path Oscillations with congestion-based routing 17 0 z x w y 0 0 1 1+e e 1 1 e Initial routing March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
  • 18. • After route updates, LS is run again • x, y, and z detect 0-cost path counterclockwise Oscillations with congestion-based routing 18 0 z x w y 0 1 0 1 2+e 1 1 1 e Counterclockwise routing 1 z x w y 1+e 0 2+e 0 0 1 1 e Clockwise routing March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
  • 19. 1 z x w y 1+e 0 2+e 0 0 1 1 e Clockwise routing 0 z x w y 0 1 0 2+e 1 1 1 e Counterclockwise routing • After route updates, LS is run yet again • x, y, and z now detect 0-cost path clockwise Oscillations with congestion-based routing 19 1 March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
  • 20. Avoiding oscillations • Ensure that not all routers run the LS algorithm at the same time – Avoid synchronized routers by randomizing the time when a router advertises its link state 20 March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
  • 21. Distance-Vector Routing Algorithm • Initial assumption – Each router (node) knows the cost to reach its directly-connected neighbors • Iterative, asynchronous, distributed algorithm – Multiple iterations • Each iteration caused by local link cost change or distance vector update message from neighbor – Asynchronous • Does not require lockstep synchronization – Distributed • Each node receives information from one or more directly attached neighbors • Notifies neighbors only when its distance-vector changes 21 March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
  • 22. Bellman-Ford Equation • What it says – If x is not directly connected to y, it needs to first hop to some neighbor v – The lowest cost is (the cost of the first hop to v) + (the lowest cost from v to y) = c(x, v) + dv(y) – the least cost path from x to y, dx(y), is the minimum of the lowest cost of all of x’s neighbors dx(y) = minv{ c(x, v) + dv(y) } • The value of v that satisfies the equation is the forwarding table entry in x’s router for destination y 22 March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski x y v' v’’ c(x,v’) c(x,v’’) dv’ (y) dv’’ (y)
  • 23. Distance-Vector Routing Algorithm • At each node x we store: – c(x, v) = cost for the direct link from x to v for each neighbor v – Dx(y) = estimate of the cost of the least-cost path from x to y – Distance Vector is the set of Dx(y) for all nodes y in N Dx = [ Dx(y): y ∈ N ] – Distance vectors received from its neighbors Dv = [ Dv(y): y ∈ N ] • Each node v periodically sends its distance vector, Dv to its neighbors – When a node receives a distance vector, it saves it and updates its own distance vector using the Bellman-Ford equation Dx(y) = minv{ c(x, v) + Dv(y) } for each node y ∈ N – If this results in a change to x’s DV, it sends the new DV to its neighbors Each cost estimate Dx(y) converges to the actual least-cost Dx(y) 23 Least-cost estimates from x to all other nodes y Set of least-cost estimates from each neighbor v to each node y March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
  • 24. Distance-Vector Example 24 2 1 7 y x z cost to from x y z x 0 2 7 y ∞ ∞ ∞ z ∞ ∞ ∞ Node x DV table cost to from x y z x ∞ ∞ ∞ y 2 0 1 z ∞ ∞ ∞ Node y DV table cost to from x y z x ∞ ∞ ∞ y ∞ ∞ ∞ z 7 1 0 Node z DV table March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
  • 25. Distance-Vector Example 25 2 1 7 y x z cost to from x y z x 0 2 7 y ∞ ∞ ∞ z ∞ ∞ ∞ Node x DV table cost to from x y z x ∞ ∞ ∞ y 2 0 1 z ∞ ∞ ∞ Node y DV table cost to from x y z x ∞ ∞ ∞ y ∞ ∞ ∞ z 7 1 0 Node z DV table cost to from x y z x 0 2 7 y ∞ ∞ ∞ z ∞ ∞ ∞ Node x DV table cost to from x y z x 0 2 7 y 2 0 1 z ∞ ∞ ∞ Node y DV table cost to from x y z x 0 2 7 y ∞ ∞ ∞ z 7 1 0 Node z DV table Node x sends its DV {0, 2, 7} to nodes y and z c(y, x) = 2 c(z, x) = 7 March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
  • 26. Distance-Vector Example 26 2 1 7 y x z cost to from x y z x 0 2 7 y ∞ ∞ ∞ z ∞ ∞ ∞ Node x DV table cost to from x y z x 0 2 7 y 2 0 1 z ∞ ∞ ∞ Node y DV table cost to from x y z x 0 2 7 y ∞ ∞ ∞ z 7 1 0 Node z DV table cost to from x y z x 0 2 3 y 2 0 1 z 7 1 0 Node x DV table cost to from x y z x 0 2 7 y 2 0 1 z 7 1 0 Node y DV table cost to from x y z x 0 2 7 y 2 0 1 z 3 1 0 Node z DV table Node y sends its DV {2, 0, 1} to nodes x and z Node z sends its DV {7, 1, 0} to nodes x and y c(x, y) = 2 c(z, y) = 1 From y: c(y,z) is 1 c(x, z) = c(x, y) + c(y,z) = = 2 + 1 = 3 Less than old value, 7 March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski From y: c(y,x) is 2 c(z, x) = c(z,y) + c(y,x) = = 1 + 2 = 3 Less than old value, 7 Every update to a node’s DV also updates the forwarding table
  • 27. Distance-Vector Example 27 2 1 7 y x z cost to from x y z x 0 2 3 y 2 0 1 z 7 1 0 Node x DV table cost to from x y z x 0 2 7 y 2 0 1 z 7 1 0 Node y DV table cost to from x y z x 0 2 7 y 2 0 1 z 3 1 0 Node z DV table cost to from x y z x 0 2 3 y 2 0 1 z 3 1 0 Node x DV table cost to from x y z x 0 2 3 y 2 0 1 z 3 1 0 Node y DV table cost to from x y z x 0 2 3 y 2 0 1 z 3 1 0 Node z DV table Node x sends its DV {0, 2, 7} to nodes y and z Node y’s vector did not change – it stays quiet Node z sends its DV {2, 0, 1} to nodes x and y We converged. Everyone has the same view of the network. Nobody has updates to send. March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
  • 28. Link cost changes • The DV algorithm remains quiet once it converges – … until some link cost changes • If a node detects link cost change between itself and a neighbor – It updates its distance vector – If there is a change in the cost of any least-cost path it informs its neighbors of the new distance vector – Each neighbor computes a new least cost • If the value changed from its previous value, it sends its DV to its neighbors • Recompute until values converge March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski 28
  • 29. Link loss 29 Suppose we lose the link to C: c(B,C) = ∞ B will send an update to A but A thinks its cost to C is 3 B will think there is a route to C: B→A→C with a cost of (c(B,A) + 3) = 4 1 2 Distance to C =3 Distance to C =2 A B C 1 ∞ Distance to C =3 Distance to C =4 A B C Update (A,C)=3 1 ∞ Distance to C =5 Distance to C =4 A B C Update (B,C)=4 This continues ad infinitum! We created a Routing Loop March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
  • 30. Mitigation: Poison Reverse • If A routes through B to get to C – A will advertise to B that its distance is infinity – B will then never attempt to route through A • This does not work with loops involving 3 or more nodes! • Other approaches – Limit size of network by setting a hop (cost) limit – Send full path information in route advertisement • Perform explicit queries for loops 30 March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski
  • 31. The end 31 March 21, 2016 CS 352 © 2013-2016 Paul Krzyzanowski