You are on page 1of 25

Lecture 29: Control Plane – Routing Algorithms CE213: Computer Communications & Networks

CE213: Computer Communications and Networking

Dr. Rashid Jillani

✓ Routing Algorithms

Reference Material: Computer Networking: A Top-Down Approach, 8th Edition by Kurose and Ross, Section 5.1, 5.2, 5.2.2

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 29: Control Plane – Routing Algorithms CE213: Computer Communications & Networks

Network layer: “control plane” roadmap


▪ introduction
▪ routing protocols
▪ link state
▪ distance vector
▪ intra-ISP routing: OSPF
▪ routing among ISPs: BGP ▪ network management,
▪ SDN control plane configuration
▪ Internet Control Message • SNMP
Protocol • NETCONF/YANG

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 29: Control Plane – Routing Algorithms CE213: Computer Communications & Networks

Distance vector algorithm


Based on Bellman-Ford (BF) equation (dynamic programming):
Bellman-Ford equation

Let Dx(y): cost of least-cost path from x to y.


Then:
Dx(y) = minv { cx,v + Dv(y) }

v’s estimated least-cost-path cost to y


min taken over all neighbors v of x direct cost of link from x to v
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 29: Control Plane – Routing Algorithms CE213: Computer Communications & Networks

Bellman-Ford Example
Suppose that u’s neighboring nodes, x,v,w, know that for destination z:
Dv(z) = 5 Dw(z) = 3 Bellman-Ford equation says:
5
Du(z) = min { cu,v + Dv(z),
3 w
v 5 cu,x + Dx(z),
2
u 2 1 z cu,w + Dw(z) }
3
1 2
= min {2 + 5,
x 1
y 1 + 3,
5 + 3} = 4
Dx(z) = 3
node achieving minimum (x) is
next hop on estimated least-
cost path to destination (z)
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 29: Control Plane – Routing Algorithms CE213: Computer Communications & Networks

Distance vector algorithm


key idea:
▪ from time-to-time, each node sends its own distance vector estimate
to neighbors
▪ when x receives new DV estimate from any neighbor, it updates its
own DV using B-F equation:
Dx(y) ← minv{cx,v + Dv(y)} for each node y ∊ N

▪ under minor, natural conditions, the estimate Dx(y) converge to the


actual least cost dx(y)

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 29: Control Plane – Routing Algorithms CE213: Computer Communications & Networks

Distance vector algorithm:


each node: iterative, asynchronous: each local
iteration caused by:
wait for (change in local link ▪ local link cost change
cost or msg from neighbor) ▪ DV update message from neighbor

recompute DV estimates using distributed, self-stopping: each


node notifies neighbors only when
DV received from neighbor its DV changes
▪ neighbors then notify their
if DV to any destination has neighbors – only if necessary
changed, notify neighbors ▪ no notification received, no
actions taken!

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 29: Control Plane – Routing Algorithms CE213: Computer Communications & Networks

Distance vector: example


DV in a:
Da(a)=0
Da(b) = 8
Da(c) = ∞ a b c
Da(d) = 1 8 1
Da(e) = ∞
t=0 Da(f) = ∞
1 1
Da(g) = ∞
Da(h) = ∞
▪ All nodes have
Da(i) = ∞
distance estimates
to nearest A few asymmetries:
d e f ▪ missing link
neighbors (only) 1 1
▪ larger cost
▪ All nodes send
their local
distance vector to 1 1 1
their neighbors

g h i
1 1

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 29: Control Plane – Routing Algorithms CE213: Computer Communications & Networks

Distance vector example: iteration

a b c
8 1

t=1 1 1
All nodes:
▪ receive distance
vectors from
neighbors d e f
▪ compute their new 1 1
local distance
vector
▪ send their new 1 1 1
local distance
vector to neighbors

g h i
1 1

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 29: Control Plane – Routing Algorithms CE213: Computer Communications & Networks

Distance vector example: iteration

a
compute compute
b compute
c
8 1

t=1 1 1
All nodes:
▪ receive distance
vectors from
neighbors d
compute compute
e compute
f
▪ compute their new 1 1
local distance
vector
▪ send their new 1 1 1
local distance
vector to neighbors

g
compute h
compute compute
i
1 1

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 29: Control Plane – Routing Algorithms CE213: Computer Communications & Networks

Distance vector example: iteration

a b c
8 1

t=1 1 1
All nodes:
▪ receive distance
vectors from
neighbors d e f
▪ compute their new 1 1
local distance
vector
▪ send their new 1 1 1
local distance
vector to neighbors

g h i
1 1

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 29: Control Plane – Routing Algorithms CE213: Computer Communications & Networks

Distance vector example: iteration

a b c
8 1

t=2 1 1
All nodes:
▪ receive distance
vectors from
neighbors d e f
▪ compute their new 1 1
local distance
vector
▪ send their new 1 1 1
local distance
vector to neighbors

g h i
1 1

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 29: Control Plane – Routing Algorithms CE213: Computer Communications & Networks

Distance vector example: iteration

compute
a compute
b compute
c
2 1

t=2 1 1
All nodes:
▪ receive distance
vectors from
neighbors compute
d compute
e compute
f
▪ compute their new 1 1
local distance
vector
▪ send their new 1 1 1
local distance
vector to neighbors

g
compute compute
h compute
i
8 1

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 29: Control Plane – Routing Algorithms CE213: Computer Communications & Networks

Distance vector example: iteration

a b c
8 1

t=2 1 1
All nodes:
▪ receive distance
vectors from
neighbors d e f
▪ compute their new 1 1
local distance
vector
▪ send their new 1 1 1
local distance
vector to neighbors

g h i
1 1

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 29: Control Plane – Routing Algorithms CE213: Computer Communications & Networks

Distance vector example: iteration

…. and so on

Let’s next take a look at the iterative computations at nodes

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 29: Control Plane – Routing Algorithms CE213: Computer Communications & Networks
DV in b: DV in c:
Distance vector example: computation Db(a) = 8 Db(f) = ∞ Dc(a) = ∞
Db(c) = 1 Db(g) = ∞ Dc(b) = 1
Db(d) = ∞ Db(h) = ∞ Dc(c) = 0
DV in a: Dc(d) = ∞
Db(e) = 1 Db(i) = ∞
Da(a)=0
Dc(e) = ∞
Da(b) = 8
Dc(f) = ∞
Da(c) = ∞ a b c Dc(g) = ∞
Da(d) = 1 8 1
Dc(h) = ∞
Da(e) = ∞
Dc(i) = ∞
t=1 Da(f) = ∞
1 1
Da(g) = ∞
▪ b receives DVs Da(h) = ∞ DV in e:
from a, c, e Da(i) = ∞ De(a) = ∞
De(b) = 1
d e f De(c) = ∞
1 1 De(d) = 1
De(e) = 0
De(f) = 1
1 1 1 De(g) = ∞
De(h) = 1
De(i) = ∞

g h i
1 1

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 29: Control Plane – Routing Algorithms CE213: Computer Communications & Networks
DV in b: DV in c:
Distance vector example: computation Db(a) = 8 Db(f) = ∞ Dc(a) = ∞
Db(c) = 1 Db(g) = ∞ Dc(b) = 1
Db(d) = ∞ Db(h) = ∞ Dc(c) = 0
DV in a: Dc(d) = ∞
Db(e) = 1 Db(i) = ∞
Da(a)=0
Dc(e) = ∞
Da(b) = 8
Dc(f) = ∞
Da(c) = ∞ a b c Dc(g) = ∞
Da(d) = 1 8 compute 1
Dc(h) = ∞
Da(e) = ∞
Dc(i) = ∞
t=1 Da(f) = ∞
1 1
Da(g) = ∞
▪ b receives DVs Da(h) = ∞ DV in e:
from a, c, e, Da(i) = ∞ De(a) = ∞
computes: e
De(b) = 1
d e f De(c) = ∞
1
Db(a) = min{cb,a+Da(a), cb,c +Dc(a), cb,e+De(a)} = min{8,∞,∞} =8 1 De(d) = 1
Db(c) = min{cb,a+Da(c), cb,c +Dc(c), c b,e +De(c)} = min{∞,1,∞} = 1 De(e) = 0
Db(d) = min{cb,a+Da(d), cb,c +Dc(d), c b,e +De(d)} = min{9,2,∞} = 2 De(f) = 1
1 1 1 De(g) = ∞
Db(e) = min{cb,a+Da(e), cb,c +Dc(e), c b,e +De(e)} = min{∞,∞,1} = 1
De(h) = 1
Db(f) = min{cb,a+Da(f), cb,c +Dc(f), c b,e +De(f)} = min{∞,∞,2} = 2
DV in b:
De(i) = ∞
Db(g) = min{cb,a+Da(g), cb,c +Dc(g), c b,e+De(g)} = min{∞, ∞, ∞} = ∞ Db(a) = 8 Db(f) =2
g h D (c) = 1 Db(g)
i =∞
1 ∞, 2} = 2
Db(h) = min{cb,a+Da(h), cb,c +Dc(h), c b,e+De(h)} = min{∞, 1Db(d) = 2 Db(h) = 2
b
Db(i) = min{cb,a+Da(i), cb,c +Dc(i), c b,e+De(i)} = min{∞, ∞, ∞} = ∞ Db(e) = 1 Db(i) = ∞
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 29: Control Plane – Routing Algorithms CE213: Computer Communications & Networks
DV in b: DV in c:
Distance vector example: computation Db(a) = 8 Db(f) = ∞ Dc(a) = ∞
Db(c) = 1 Db(g) = ∞ Dc(b) = 1
Db(d) = ∞ Db(h) = ∞ Dc(c) = 0
DV in a: Dc(d) = ∞
Db(e) = 1 Db(i) = ∞
Da(a)=0
Dc(e) = ∞
Da(b) = 8
Dc(f) = ∞
Da(c) = ∞ a b c Dc(g) = ∞
Da(d) = 1 8 1
Dc(h) = ∞
Da(e) = ∞
Dc(i) = ∞
t=1 Da(f) = ∞
1 1
Da(g) = ∞
▪ c receives DVs Da(h) = ∞ DV in e:
from b Da(i) = ∞ De(a) = ∞
De(b) = 1
d e f De(c) = ∞
1 1 De(d) = 1
De(e) = 0
De(f) = 1
1 1 1 De(g) = ∞
De(h) = 1
De(i) = ∞

g h i
1 1

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 29: Control Plane – Routing Algorithms CE213: Computer Communications & Networks
DV in b: DV in c:
Distance vector example: computation Db(a) = 8 Db(f) = ∞ Dc(a) = ∞
Db(c) = 1 Db(g) = ∞ Dc(b) = 1
Db(d) = ∞ Db(h) = ∞ Dc(c) = 0
Db(e) = 1 Db(i) = ∞ Dc(d) = ∞
Dc(e) = ∞
Dc(f) = ∞
a b c
compute Dc(g) = ∞
8 1
Dc(h) = ∞
Dc(i) = ∞
t=1 1 1
▪ c receives DVs
from b computes:

d b(a}} = 1 + 8 = 9
Dc(a) = min{cc,b+D e f
DV in c:
Dc(b) = min{cc,b+Db(b)} = 1 + 0 = 1
Dc(a) = 9
Dc(d) = min{cc,b+Db(d)} = 1+ ∞ = ∞ Dc(b) = 1
Dc(e) = min{cc,b+Db(e)} = 1 + 1 = 2 Dc(c) = 0
Dc(d) = 2
Dc(f) = min{cc,b+Db(f)} = 1+ ∞ = ∞
Dc(e) = ∞
Dc(g) = min{cc,b+Db(g)} = 1+ ∞ = ∞ * Check out the online interactive
Dc(f) = ∞ exercises for more examples:
Dc(h) = min{cbc,bg+Db(h)} = 1+ ∞ = ∞ h Dc(g) = ∞ i http://gaia.cs.umass.edu/kurose_ross/interactive/
Dc(i) = min{cc,b+Db(i)} = 1+ ∞ = ∞ Dc(h) = ∞
Dc(i) = ∞
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 29: Control Plane – Routing Algorithms CE213: Computer Communications & Networks
DV in b:
Distance vector example: computation Db(a) = 8 Db(f) = ∞
DV in d: Db(c) = 1 Db(g) = ∞
Dc(a) = 1
Db(d) = ∞ Db(h) = ∞ DV in e:
Db(e) = 1 Db(i) = ∞
Dc(b) = ∞ De(a) = ∞
Dc(c) = ∞ De(b) = 1
Dc(d) = 0 a b c De(c) = ∞
Dc(e) = 1 8 1 De(d) = 1
Dc(f) = ∞ De(e) = 0
t=1 Dc(g) = 1
1
Q: what is new DV computed in e at
1t=1?
De(f) = 1
De(g) = ∞
Dc(h) = ∞
▪ e receives DVs Dc(i) = ∞ De(h) = 1
from b, d, f, h De(i) = ∞
DV in h: d compute
e
1
f DV in f:
Dc(a) = ∞ 1
Dc(b) = ∞ Dc(a) = ∞
Dc(c) = ∞ Dc(b) = ∞
Dc(d) = ∞ Dc(c) = ∞
1 1 1 Dc(d) = ∞
Dc(e) = 1
Dc(f) = ∞ Dc(e) = 1
Dc(g) = 1 Dc(f) = 0
Dc(h) = 0 Dc(g) = ∞
g h i Dc(h) = ∞
Dc(i) = 1 1 1
Dc(i) = 1
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 29: Control Plane – Routing Algorithms CE213: Computer Communications & Networks

Distance vector: state information diffusion


Iterative communication, computation steps diffuses information through network:
t=0 c’s state at t=0 is at c only
a b c
8 1
c’s state at t=0 has propagated to b, and
t=1 may influence distance vector computations
up to 1 hop away, i.e., at b 1 1 t=1
t=2
c’s state at t=0 may now influence distance
t=2 vector computations up to 2 hops away, i.e.,
d e f
at b and now at a, e as well 1 1

c’s state at t=0 may influence distance vector


t=3
computations up to 3 hops away, i.e., at d, f, h 1 1 1 t=3

c’s state at t=0 may influence distance vector


t=4 g
computations up to 4 hops away, i.e., at g, i 1
h 1
i
t=4
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 29: Control Plane – Routing Algorithms CE213: Computer Communications & Networks

Distance vector: link cost changes


1
link cost changes: y
4 1
▪ node detects local link cost change x z
50
▪ updates routing info, recalculates local DV
▪ if DV changes, notify neighbors

t0 : y detects link-cost change, updates its DV, informs its neighbors.


“good news t1 : z receives update from y, updates its DV, computes new least cost
travels fast” to x , sends its neighbors its DV.
t2 : y receives z’s update, updates its DV. y’s least costs do not
change, so y does not send a message to z.

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 29: Control Plane – Routing Algorithms CE213: Computer Communications & Networks

Distance vector: link cost changes


60
link cost changes: y
4 1
▪ node detects local link cost change x z
50
▪ “bad news travels slow” – count-to-infinity problem:
• y sees direct link to x has new cost 60, but z has said it has a path at cost of 5. So
y computes “my new cost to x will be 6, via z); notifies z of new cost of 6 to x.
• z learns that path to x via y has new cost 6, so z computes “my new cost to
x will be 7 via y), notifies y of new cost of 7 to x.
• y learns that path to x via z has new cost 7, so y computes “my new cost to
x will be 8 via y), notifies z of new cost of 8 to x.
• z learns that path to x via y has new cost 8, so z computes “my new cost to
x will be 9 via y), notifies y of new cost of 9 to x.

▪ see text for solutions. Distributed algorithms are tricky!
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 29: Control Plane – Routing Algorithms CE213: Computer Communications & Networks

Comparison of LS and DV algorithms


message complexity robustness: what happens if router
LS: n routers, O(n2) messages sent malfunctions, or is compromised?
DV: exchange between neighbors; LS:
convergence time varies • router can advertise incorrect link cost
• each router computes only its own
speed of convergence table
LS: O(n2) algorithm, O(n2) messages DV:
• may have oscillations
• DV router can advertise incorrect path
DV: convergence time varies cost (“I have a really low-cost path to
• may have routing loops everywhere”): black-holing
• count-to-infinity problem
• each router’s DV is used by others:
error propagate thru network
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 29: Control Plane – Routing Algorithms CE213: Computer Communications & Networks

Distance vector: another example


cost to cost to
Dx() x y z x y z
x 0 2 7 x 0 2 3

from
from
y ∞∞ ∞ y 2 0 1 Dx(z) = min{cx,y+ Dy(z), cx,z+ Dz(z)}
z ∞∞ ∞ z 7 1 0
= min{2+1 , 7+0} = 3

cost to y
Dy() x y z 2 1
Dx(y) = min{cx,y + Dy(y), cx,z+ Dz(y)}
x ∞ ∞ ∞ = min{2+0 , 7+1} = 2 x z
7
from

y 2 0 1
z ∞∞ ∞

cost to
Dz() x y z
x ∞∞ ∞
from

y ∞∞ ∞
z 7 1 0
time
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 29: Control Plane – Routing Algorithms CE213: Computer Communications & Networks

Distance vector: another example


cost to cost to cost to
Dx() x y z x y z x y z
x 0 2 7 x 0 2 3 x 0 2 3

from
from
y ∞∞ ∞ y 2 0 1

from
y 2 0 1
z ∞∞ ∞ z 7 1 0 z 3 1 0

cost to cost to cost to y


Dy() x y z x y z x y z 2 1
x ∞ ∞ ∞ x 0 2 7 x 0 2 3
x z
7
from

y 2 0 1 from y 2 0 1

from
y 2 0 1
z ∞∞ ∞ z 7 1 0 z 3 1 0

cost to cost to cost to


Dz() x y z x y z x y z
x ∞∞ ∞ x 0 2 7 x 0 2 3
from

from
y 2 0 1 y 2 0 1
from

y ∞∞ ∞
z 7 1 0 z 3 1 0 z 3 1 0
time
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi

You might also like