Net Routing 1
Net Routing 1
Srinidhi Varadarajan
Routing
Routing protocol
Goal: determine “good” path 5
(sequence of routers) thru 3
network from source to dest. B C 5
2
A 2 1 F
3
Graph abstraction for 1 2
D E
routing algorithms: 1
z graph nodes are
routers z “good” path:
z graph edges are – typically means
physical links minimum cost path
– link cost: delay, $ cost,
or congestion level
– other def’s possible
Routing Algorithm classification
Global or decentralized Static or dynamic?
information?
Global:
Static:
z all routers have complete z routes change slowly
topology, link cost info over time
z “link state” algorithms
Dynamic:
Decentralized:
z router knows physically- z routes change more
connected neighbors, link quickly
costs to neighbors
– periodic update
z iterative process of
computation, exchange of – in response to link
info with neighbors cost changes
z “distance vector”
algorithms
A Link-State Routing Algorithm
Dijkstra’s algorithm Notation:
z net topology, link costs z c(i,j): link cost from node i
known to all nodes to j. cost infinite if not
– accomplished via “link direct neighbors
state broadcast”
z D(v): current value of cost
– all nodes have same of path from source to
info dest. V
z computes least cost paths
from one node (‘source”) z p(v): predecessor node
to all other nodes along path from source to
v, that is next v
– gives routing table for
that node z N: set of nodes whose
z iterative: after k iterations, least cost path definitively
know least cost path to k known
dest.’s
Dijsktra’s Algorithm
1 Initialization:
2 N = {A}
3 for all nodes v
4 if v adjacent to A
5 then D(v) = c(A,v)
6 else D(v) = infty
7
8 Loop
9 find w not in N such that D(w) is a minimum
10 add w to N
11 update D(v) for all v adjacent to w and not in N:
12 D(v) = min( D(v), D(w) + c(w,v) )
13 /* new cost to v is either old cost to v or known
14 shortest path cost to w plus cost from w to v */
15 until all nodes in N
Dijkstra’s algorithm: example
Step start N D(B),p(B) D(C),p(C) D(D),p(D) D(E),p(E) D(F),p(F)
0 A 2,A 5,A 1,A infinity infinity
1 AD 2,A 4,D 2,D infinity
2 ADE 2,A 3,E 4,E
3 ADEB 3,E 4,E
4 ADEBC 4,E
5 ADEBCF
5
3
B C 5
2
A 2 1 F
3
1 2
D E
1
Dijkstra’s algorithm, discussion
Algorithm computational complexity: n nodes
z each iteration: need to check all nodes, w, not in N
z n*(n+1)/2 comparisons: O(n2)
z more efficient implementations possible:
– O(nlogn): Use a heap (sorted) to maintain interim table
Oscillations possible:
z e.g., link cost = amount of carried traffic
1 A A A A
1+e 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 1 1+e 0 e
1
C C C C
1
e
… recompute … recompute … recompute
initially
routing
Link State: Reliable Flooding
z Link State routers exchange information using
Link State Packets (LSP).
z LSP contains
– id of the node that created the LSP
– cost of the link to each directly connected neighbor
– sequence number (SEQNO)
– time-to-live (TTL) for this packet
z Reliable flooding
– store most recent LSP from each node
– forward LSP to all nodes but one that sent it
– generate new LSP periodically
• increment SEQNO
– start SEQNO at 0 when reboot
– decrement TTL of each stored LSP
• discard when TTL=0
Distance Vector Routing Algorithm
iterative:
z continues until no Distance Table data structure
nodes exchange info. z each node has its own
z self-terminating: no z row for each possible
“signal” to stop destination
asynchronous: z column for each directly-
z nodes need not attached neighbor to node
exchange info/iterate
in lock step!
distributed:
z each node
communicates only
with directly-attached
neighbors
Distance Table: example
B 1 C E
cost to destination via
7 D () A B D
A 8 2
1 A 1 14 5
E D
2
B 7 8 5
destination
E D
D (C,D) = c(E,D) + minw {D (C,w)}
= 2+2 = 4 C 6 9 4
E D
D (A,D) = c(E,D) + min {D (A,w)}
w D 4 11 2
= 2+3 = 5 loop!
E B
D (A,B) = c(E,B) + minw{D (A,w)}
= 8+6 = 14
loop!
Distance table gives routing table
cost to destination via
E Outgoing link
D () A B D to use, cost
A 1 14 5 A A,1
B 7 8 5
destination
B D,5
destination
C 6 9 4 C D,4
D 4 11 2 D D,4
“good algorithm
news terminates
travels
fast”
Distance Vector: link cost changes
Link cost changes:
60
z good news travels fast Y
z bad news travels slow - 4 1
“count to infinity” X Z
50
problem!
algorithm
continues
on!
Distance Vector: poisoned reverse
If Z routes through Y to get to X : 60
Y
z Z tells Y its (Z’s) distance to X is 4 1
infinite (so Y won’t route to X via Z) X Z
50
z Does not work on larger loops
algorithm
terminates
Comparison of LS and DV algorithms
Message complexity Robustness: what happens if
z LS: with n nodes, with an router malfunctions?
average of l links/node, each LS:
node sends O(nl). Total – node can advertise
messages O(n2l) incorrect link cost
z DV: exchange between – each node computes only
its own table
neighbors only
DV:
– convergence time varies
– DV node can advertise
– may be routing loops incorrect path cost
– count-to-infinity problem – each node’s table used by
others
• error propagate thru
network
Hierarchical Routing
Our routing study thus far -idealization
z all routers identical
z network “flat”
… not true in practice
Policy:
z Inter-AS: admin wants control over how its traffic is
routed and who routes through its net.
z Intra-AS: single admin, so no policy decisions
needed
Scale:
z hierarchical routing saves table size, reduced update
traffic
Performance:
z Intra-AS: can focus on performance
z Inter-AS: policy may dominate over performance
Intra-AS and Inter-AS routing
C.b Gateways:
B.a
•perform inter-AS
A.a routing amongst
b A.c c themselves
a C a
b •perform intra-AS
a B
routers with other
d c routers in their
A b
AS
network layer
inter-AS, intra-AS link layer
routing in
gateway A.c physical layer
Intra-AS and Inter-AS routing
Inter-AS
C.b routing
between B.a
A.a A and B Host
b A.c c h2
a C a
b
a B
Host d c Intra-AS routing
h1 b
A within AS B
Intra-AS routing
within AS A
Routing in the Internet
z The Global Internet consists of Autonomous
Systems (AS) interconnected with each
other:
– Stub AS: small corporation
– Multihomed AS: large corporation (no transit)
– Transit AS: provider
z Two-level routing:
– Intra-AS: administrator is responsible for choice
– Inter-AS: unique standard
Internet AS Hierarchy
Intra-AS border (exterior gateway) routers
C
Destination Network Next Router Num. of hops to dest.
w A 2
y B 2
z B 7
x -- 1
…. …. ....
Routing table in D
RIP: Link Failure and Recovery
If no advertisement heard after 180 sec -->
neighbor/link declared dead
– routes via neighbor invalidated
– new advertisements sent to neighbors
– neighbors in turn send out new
advertisements (if tables changed)
– link failure info quickly propagates to
entire net
– poison reverse used to prevent ping-pong
loops (infinite distance = 16 hops)
RIP Table processing
z Recommended
– End-To-End Routing Behavior in the Internet,
V. Paxson, SIGCOMM 1996.
ftp://ftp.ee.lbl.gov/papers/routing.SIGCOMM.ps
.Z