CS 5565
Network Architecture and
Protocols
Lecture 18
Godmar Back
Announcements
• Project 2A due Apr 4
• Project 2B due in 2 parts:
CS 5565 Spring 2012
Routing Algorithms
Routing Algorithm Classification
Global or decentralized
information?
Global:
• all routers have complete
topology, link cost info
• “link state” algorithms
Decentralized:
• router knows physicallyconnected neighbors, link
costs to neighbors
• iterative process of
computation, exchange of
info with neighbors
• “distance vector” algorithms
Static or dynamic?
Static:
• routes change slowly over
time
Dynamic:
• routes change more quickly
– periodic update
– in response to link cost
changes
Note: Global/decentralized classification
does not say where routing computation
is performed, it says what information
one has when computing routes
CS 5565 Spring 2012
Link State Routing
• Routers periodically broadcast link state
information
– link state messages or LSA (link state advertisement)
– broadcast via sequence-number controlled flooding
• All routers acquire complete connectivity + link
cost information of entire network
• Each router computes routing table from that
obtained topology
– Dijkstra’s shortest path to other routers, from
computing router this becomes forwarding table
CS 5565 Spring 2012
Distance Vector Algorithm (1)
Bellman-Ford Equation (dynamic programming)
Define
dx(y) := cost of least-cost path from x to y
Then
dx(y) = min {c(x,v) + dv(y) }
where min is taken over all neighbors of x
CS 5565 Spring 2012
Bellman-Ford Example (2)
5
2
u
v
2
1
3
w
3
Clearly, dv(z) = 5, dx(z) = 3, dw(z) = 3
5
1
z
B-F equation says:
du(z) = min { c(u,v) + dv(z),
c(u,x) + dx(z),
1
c(u,w) + dw(z) }
= min {2 + 5,
1 + 3,
5 + 3} = 4
Node that achieves minimum is next
hop in shortest path ➜ forwarding table
x
y
2
CS 5565 Spring 2012
Distance Vector Algorithm (3)
• Dx(y) = estimate of least cost from x to y
• Distance vector: Dx = [Dx(y): y N ]
• Node x knows cost to each neighbor v:
c(x,v)
• Node x maintains Dx = [Dx(y): y N ]
• Node x also maintains its neighbors’
distance vectors (at least temporarily)
– For each neighbor v, x maintains
Dv = [Dv(y): y N ]
CS 5565 Spring 2012
Distance Vector Algorithm (4)
Basic Idea:
• Each node periodically sends its own distance
vector estimate to neighbors
• When a node x receives new DV estimate from
neighbor, it updates its own DV using B-F
equation:
Dx(y) ← minv{c(x,v) + Dv(y)}
for each node y ∊ N
• Under minor, natural conditions, the estimate
Dx(y) converges to actual least cost dx(y)
CS 5565 Spring 2012
Distance Vector Algorithm (5)
Iterative,
asynchronous: each
local iteration caused
by:
• local link cost change
• DV update message
from neighbor
Each node:
wait for (change in local link
cost of msg from neighbor)
recompute estimates
Distributed:
• each node notifies
neighbors only when its
DV changes
– neighbors then notify
their neighbors if
necessary
if DV to any dest has
changed, notify neighbors
CS 5565 Spring 2012
Example DV Routing
0
1
2
3
1
2
5
1
-
4
CS 5565 Spring 2012
2
4
1
5
1
2
5
4
1
-
1
Example (cont’d)
-
1
2
5
-
1
2
3
-
1
2
3
1
-
4
1
-
3
5
1
-
3
4
2
4
-
1
2
3
-
1
2
3
-
1
5
1
-
3
5
1
-
3
4
1
-
1
2
4
5
1
time
Dx(y) ← minv{c(x,v) + Dv(y)}
for each node y ∊ N
CS 5565 Spring 2012
Example (cont’d)
• Converged after
3 iterations
0
1
2
3
0
1
2
3
1
1
3
4
2
2
3
1
3
3
4
1
-
• What if link cost changes?
CS 5565 Spring 2012
Distance Vector: Link Cost Changes
Link cost changes:
• node detects local link cost change
• updates routing info, recalculates
distance vector
• if DV changes, notify neighbors
“good
news
travels
fast”
1
x
4
y
50
1
z
At time t0, y detects the link-cost change, updates its DV,
and informs its neighbors.
At time t1, z receives the update from y and updates its table.
It computes a new least cost to x and sends its neighbors its DV.
At time t2, y receives z’s update and updates its distance table.
y’s least costs do not change and hence y does not send any
message to z.
CS 5565 Spring 2012
Count-To-Infinity
51 50
-
4
5
51 4
-
1
50 5
1
-
Before change:
-
51 50
-
51 50
60
x
-
4
51 50
y
1
z
50
-
51 50
x
60
50
51
-
1
6
-
1
51
-
1
8
-
1
y
5
1
-
50
1
-
7
1
-
50
1
-
z
1
y to x
via z
CS 5565 Spring 2012
z to x
via y
y to x
via z
Distance Vector: Link Cost Changes
Link cost changes:
• good news travels fast
• bad news travels slow - “count to infinity”
problem!
• 44 iterations before algorithm stabilizes
Poisoned 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)
• will this completely solve count to infinity
problem?
CS 5565 Spring 2012
60
x
4
y
50
1
z
Poisoned Reverse
After change:
-
51 50
-
60
51 50
51
-
1
5
1
-
-
51 50
x
-
y
4
1
z
50
51 50
-
51 50
x
60
50
51
-
1
6
-
1
51
-
1
51
-
1
y
5
1
-
50
1
-
50
1
-
50
1
-
z
1
y to x
via z
Don’t tell
z dist to x
CS 5565 Spring 2012
z to x
via x
Comparison of LS and DV algorithms
Message complexity
• LS: with n nodes, E links,
O(nE) msgs sent
• DV: exchange between
neighbors only
– convergence time varies
Speed of Convergence
• LS: O(n2) algorithm requires
O(nE) msgs
– may have oscillations
• 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
CS 5565 Spring 2012
• error propagates thru
network
Hierarchical Routing
Our routing study thus far - idealization
• all routers identical
• network “flat”
… not true in practice
scale: with 200 million
destinations:
• can’t store all dest’s in
routing tables!
• routing table exchange
would swamp links!
administrative autonomy
• internet = network of
networks
• each network admin may
want to control routing in its
own network
CS 5565 Spring 2012
Hierarchical Routing
• aggregate routers into Gateway router
regions, “autonomous
• Direct link to router in
systems” (AS)
another AS
• routers in same AS run
same routing protocol
– “intra-AS” routing
protocol
– routers in different AS
may run different intraAS routing protocols
• Example:
CS 5565 Spring 2012
– [AS1312]
Interconnected ASes
3c
3a
3b
AS3
1a
2a
1c
1d
1b
Intra-AS
Routing
algorithm
2c
AS2
AS1
Inter-AS
Routing
algorithm
2b
• Forwarding table is
configured by both
intra- and inter-AS
routing algorithm
Forwarding
table
CS 5565 Spring 2012
– Intra-AS sets entries for
internal dests
– Inter-AS & Intra-AS sets
entries for external dests
Inter-AS tasks
• Suppose router in AS1
receives datagram for
which dest is outside of
AS1
– Router should forward
packet towards one of
the gateway routers, but
which one?
AS1 needs:
1. to learn which dests are
reachable through AS2 and
which through AS3
2. to propagate this reachability
info to all routers in AS1
Job of inter-AS routing!
3c
3a
3b
AS3
1a
1c
1d
2c
2a
1b
AS2
AS1
CS 5565 Spring 2012
2b
Inter-AS tasks (cont’d)
• Suppose router in AS1
receives datagram for
which dest is outside of
AS1
Scenario 1
Destination x is reachable
through single AS
Inter-AS must propagate this
Least cost path to 1c
information
inside AS
is interface l, add (x,
– Router should forward
packet towards one of
the gateway routers, but
which one?
AS3
advertises
route to x
3c
3a
3b
AS3
1c
1a
1b AS1
1d
l) to routing table
2a
2c
2b
AS2 in AS1:
Spread
use gateway 1c
to get to x
CS 5565 Spring 2012
AS2 does not
advertise
route to x
Hot Potato Routing
• Suppose router in AS1
receives datagram for
which dest is outside of
AS1
– Router should forward
packet towards one of
the gateway routers, but
which one?
Scenario 2:
Destination is reachable through
multiple AS:
Hot potato routing: send packet
towards closest of two
routers
3c
3a
3b
AS3
1a
1c
1d
2c
2a
1b
AS2
AS1
CS 5565 Spring 2012
2b
Hot Potato Routing
• Suppose router in AS1
receives datagram for
which dest is outside of
AS1
Scenario 2:
Destination is reachable through
multiple AS:
Hot potato routing: send packet
1b is closer than 1c,
towards
closest of two
interface k leads to
routers
1b, so add (x, k) to
– Router should forward
packet towards one of
the gateway routers, but
routing table
which one?
AS3
advertises
route to x
3c
3a
2c
3b
2a
AS3
2b
1c
AS2 in AS1:
Spread
1a
1b AS1 1c and 1b lead to
1d
x
CS 5565 Spring 2012
AS2
advertises
route to x
Summary
• Routing algorithms:
– Link State
– Distance Vector
• Hierarchical Routing
– AS: autonomous systems
• Next: application to Internet/IP
CS 5565 Spring 2012
© Copyright 2026 Paperzz