Professional Documents
Culture Documents
chapter goals:
v understand principles behind network layer
services:
§ network layer service models
§ forwarding versus routing
§ how a router works
§ routing (path selection)
§ broadcast, multicast
v instantiation, implementation in the Internet
IP destination address in
arriving packet’s header
1
3 2
N = set of routers = { u, v, w, x, y, z }
E = set of links = { (u,v), (u,x), (v,x), (v,w), (x,w), (x,y), (w,y), (w,z), (y,z) }
See also: Edsger Wybe Dijkstra. A note on two problems in connexion with graphs.
Numerische Mathematik, 1:269–271, 1959. Network Layer 4-7
Dijkstra’s algorithm: example
D(v) D(w) D(x) D(y) D(z)
Step N' p(v) p(w) p(x) p(y) p(z)
0 u 7,u 3,u 5,u ∞ ∞
1 uw 6,w 5,u 11,w ∞
2 uwx 6,w 11,w 14,x
3 uwxv 10,v 14,x
4 uwxvy 12,y
5 uwxvyz x
9
notes: 5 7
4
v construct shortest path tree by
tracing predecessor nodes 8
v ties can exist (can be broken u
3 w y z
arbitrarily) 2
3
7 4
v
Network Layer 4-8
Dijkstra’s algorithm, discussion
algorithm complexity: n nodes
v each iteration: need to check all nodes, w, not in N
v n(n+1)/2 comparisons: O(n2)
v more efficient implementations possible: O(nlogn)
oscillations possible:
v e.g., support link cost equals amount of carried traffic
let
dx(y) := cost of least-cost path from x to y
then
dx(y) = minv {c(x,v) + dv(y) }
v 3
w
dv(z) = 5, dx(z) = 3, dw(z) = 3
2 5
u 2 1 z Filling in B-F equation:
3
1 2 du(z) = min { c(u,v) + dv(z),
x y
1 c(u,x) + dx(z),
c(u,w) + dw(z) }
= min {2 + 5,
1 + 3,
5 + 3} = 4
node achieving minimum is next
hop in shortest path, used in forwarding table
Network Layer 4-11
Distance vector algorithm
v Dx(y) = estimate of least cost from x to y
§ x maintains distance vector Dx = [Dx(y): y є N ]
v node x:
§ knows cost to each neighbor v: c(x,v)
§ maintains its neighbours’ distance vectors. For
each neighbour v, x maintains
Dv = [Dv(y): y є N ]
from
y ∞∞ ∞ y 2 0 1
from
z ∞∞ ∞ z 7 1 0
node y cost to
table x y z y
2 1
x ∞ ∞ ∞
x z
from
y 2 0 1 7
z ∞∞ ∞
node z cost to
table x y z
x ∞∞ ∞
from
y ∞∞ ∞
z 7 1 0
time
Network Layer 4-15
Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)} Dx(z) = min{c(x,y) +
= min{2+0 , 7+1} = 2 Dy(z), c(x,z) + Dz(z)}
= min{2+1 , 7+0} = 3
node x cost to cost to cost to
table x y z x y z x y z
x 0 2 7 x 0 2 3 x 0 2 3
from
y ∞∞ ∞ y 2 0 1
from
y 2 0 1
from
z ∞∞ ∞ z 7 1 0 z 3 1 0
y 2 0 1 y 2 0 1 7
from
y 2 0 1
from
z ∞∞ ∞ z 7 1 0 z 3 1 0
from
y 2 0 1 y 2 0 1
from
y ∞∞ ∞
z 7 1 0 z 3 1 0 z 3 1 0
time
Network Layer 4-16
Distance vector: link cost changes
link cost changes: 1
v node detects local link cost change y
4 1
v updates routing info, recalculates x z
distance vector 50
v if DV changes, notify neighbours
t2 : y receives z’s update, updates its distance table. y's least costs
do not change, so y does not send a message to z.