Professional Documents
Culture Documents
Communication Networks
EE-357 -TE-54
By Dr Mir Yasir Umair
Assistant Professor, MCS, NUST
Network Layer
Routing Algorithms
Chapter 4: outline
4.1 introduction 4.5 routing algorithms
4.2 virtual circuit and datagram networks o link state
o distance vector
4.3 what’s inside a router
o hierarchical routing
4.4 IP: Internet Protocol
4.6 routing in the Internet
o datagram format
o RIP
o IPv4 addressing
o OSPF
o ICMP
o BGP
o IPv6
4.7 broadcast and multicast
routing
IP destination address in
arriving packet’s header
1
3 2
v 3 w
2 5
u 2 1 z
3
1 2
x 1
y
graph: G = (N,E)
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) }
notes: 5 7
4
❖ construct shortest path tree by
tracing predecessor nodes 8
❖ ties can exist (can be broken u
3 w y z
arbitrarily) 2
3
7 4
v
Network Layer 4-11
Dijkstra’s algorithm: another example
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
v 3 w
2 5
u 2 1 z
3
1 2
x 1
y
v w
u z
x y
1
A 1+e A A A
2+e 0 0 2+e 2+e 0
D 0 0 B D 1+e 1 B D B D 1+e 1 B
0 0
0 e 0 0
C 0 1 0
1 C C 1+e C
1
e
given these costs, given these costs, given these costs,
initially find new routing…. find new routing…. find new routing….
resulting in new costs resulting in new costs resulting in new costs
Network Layer 4-14
Practice Question
let
dx(y) := cost of least-cost path from x to y
then
dx(y) = min
v
{c(x,v) + dv(y) }
from
from
y ∞∞ ∞ y 2 0 1
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-22
Dx(z) = min{c(x,y) +
Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(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
from
y ∞∞ ∞ y 2 0 1
from
y 2 0 1
z ∞∞ ∞ z 7 1 0 z 3 1 0
node y cost to cost to cost to
table x y z x y z x y z y
2 1
x ∞ ∞ ∞ x 0 2 7 x 0 2 3 x z
from
from
y 2 0 1 y 2 0 1 7
from
y 2 0 1
z ∞∞ ∞ z 7 1 0 z 3 1 0
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
Network Layer 4-23
Distance vector: link cost changes
link cost changes: 1
❖ node detects local link cost change y
4 1
❖ updates routing info, recalculates x z
distance vector 50
❖ if DV changes, notify neighbors
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.
3c
x
3a
3b
AS3 2c other
1c 2a networks
other 1a 2b
networks 1b AS2
AS1 1d
Network Layer 4-32
Example: choosing among multiple ASes
• now suppose AS1 learns from inter-AS protocol that subnet
x is reachable from AS3 and from AS2.
• to configure forwarding table, router 1d must determine
which gateway it should forward packets towards for dest x
o this is also job of inter-AS routing protocol!
3c
x
3a
3b
AS3 2c other
1c 2a networks
other 1a 2b
networks 1b AS2
AS1 1d
?
Network Layer 4-33
Example: choosing among multiple ASes
• now suppose AS1 learns from inter-AS protocol that subnet
x is reachable from AS3 and from AS2.
• to configure forwarding table, router 1d must determine
towards which gateway it should forward packets for dest x
o this is also job of inter-AS routing protocol!
• hot potato routing: send packet towards closest of two
routers.