This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Routing 4-1
Introduction To Computer Networks
-89מבוא לרשתות תקשורת 350
(Routing)ניתוב פרופ' אמיר הרצברג
Chapter 4, Network LayerComputer Networking: A Top Down Approach Featuring the Internet, 3rd edition. Jim Kurose, Keith RossAddison-Wesley, July 2005. ** Group purchase ?? **
three important functions: path determination: route
taken by packets from source to dest. Routing algorithms
call setup: some network architectures require router call setup along path before data flows
forwarding: move packets from router’s input to appropriate router output
networkdata linkphysical
networkdata linkphysical
networkdata linkphysical
networkdata linkphysical
networkdata linkphysical
networkdata linkphysical
networkdata linkphysical
networkdata linkphysical
application
transportnetworkdata linkphysical
application
transportnetworkdata linkphysical
ThisLecture
IP
Routing 4-4
Network service modelQ: What service model for
“channel” transporting packets from sender to receiver?
Two main service abstractions:
Datagram vs. Virtual Circuit
A1: Datagram: best effort only
• IP service
A2: Virtual Circuit… any of: • loss-free delivery• congestion feedback to sender• in-order delivery• guaranteed bandwidth• no jitter• Like phone
Routing 4-5
Virtual Circuits (VC) Service
call setup before data can flow, teardown after Packets carry VC identifier (not destination host ID) every router/switch on source-dest path maintains
“state” for connections transport-layer connection only involved two end systems
link, router resources (bandwidth, buffers) may be allocated to VC for circuit-like performance, guaranteed bandwidth/delay
“like telephone circuit” performance-wise network actions along source-to-dest path
Routing 4-6
Virtual circuits: signaling protocols used to setup, maintain and teardown VC
Teardown may initiate at either end – or any router along VC Exercise: design simple VC protocol
used in ATM, frame-relay, SNA, X.25 Also `premium` Internet services (RSVP, MPLS)
application
transportnetworkdata linkphysical
application
transportnetworkdata linkphysical
1. Initiate call 2. incoming call
3. Accept call4. Call connected5. Data flow begins 6. Receive data
Routing 4-7
Datagram networks: the Internet model no call setup at network layer routers: no state about end-to-end connections
no network-level concept of “connection”
packets forwarded using destination host address packets in same connection may take different paths
application
transportnetworkdata linkphysical
application
transportnetworkdata linkphysical
1. Send data 2. Receive data
Routing 4-8
Datagram or VC network: why?
Datagram (IP) data exchange among
computers “elastic” service, no
strict timing req. “smart” end systems
(computers) can adapt, perform
control, error recovery simple inside network,
complexity at “edge” many link types
different characteristics uniform service difficult
VC (ATM, MPLS) evolved from telephony “dumb” end systems
telephones complexity in network
human conversation: strict timing, reliability
requirements
Guaranteed service
Routing 4-9
Routing: Agenda Network layer services: datagram vs. virtual
changes in costs, topology) periodically in response to change
in cost / topology / faults/ recoveries
Routing 4-12
Link-State Routing: Shortest Path AlgorithmsGlobal, Static Link-State Source Routing: Link state is fixed: c)i,j(, cost from i to j (∞ if no link)
Known to each source (A) [E.g. with Flood (PI) or PIF – later] Source routing: find path from each source A to all other
nodes
Single Source Shortest Paths Tree Problem: Given graph G=(V,E), source node AV Find shortest-paths tree TG for A; for each node v:
DA)v(: cost of shortest path from source A to v• We simplify and write D(v) for DA(v)
All paths in T are shortest length: D(v)=∑(u,w)path(A,v)c(u,w) NOT Minimum Spanning Tree (Exercise: show why!) Not same tree for all sources (why?)
Routing 4-13
Dijsktra’s AlgorithmBuilds shortest-paths tree T iterativelyAfter k iterations, T contains k links (and k+1 nodes)
Given graph G=(V,E), source node AV, and link cost function c(x,y)0
let T ={ A }Let D(x)={0 if x=A, ∞ otherwise)while (T does not contain all nodes) { find edge (x,y)E with x in T and y not in T minimizing D(x)+c(x,y) add (x,y) to T D(y)=D(x)+c(x,y) }Output T, D
This usually holds… Why needed?Alg for negative costs?
Routing 4-14
Dijkstra’s algorithm: example
Step012345
NodesA
ADADE
ADEBADEBC
ADEBCF
D)B(222
D)C(5433
D)D(1
D)E(infinity
2
D)F(infinityinfinity
444
A
ED
CB
F
2
2
13
1
1
2
53
5
Routing 4-15
Dijkstra’s algorithm, discussionAlgorithm complexity: n nodes, static link costs each iteration: need to check all nodes, w, not in T n*(n+1)/2 comparisons: O(n2) more efficient implementations (e.g. heap): O(nlogn)
Dynamic costs (e.g. c(i,j)=|traffic(i,j)|) may oscillate: B,C,D send to A (1,e,1 units), each use Dijkstra Initial, sensible state: DA, CBA Oscillate between: BCDA, DCBA !!
A
D
C
B1 1+e
e0
e
1 1
0 0
A
D
C
B2+e 0
001+e1
A
D
C
B0 2+e
1+e10 0
A
D
C
B2+e 0
e01+e1
initially… recompute
routing… recompute … recompute
Routing 4-16
OSPF (Open Shortest Path First)
“Open”: publicly available, standard routing protocol
Link State algorithm LS packet (`advertisement`) flooding Topology map at each node Route computation using Dijkstra’s
algorithm
Routing 4-17
OSPF Flooding Each node x sends Link State Packet (LSP)
periodically / on link state change, with: ID of x, list of direct neighbors and costs Sequence number (64 bit, assume to never wrap around) Time to live
Sequence number used to identify *newer* LSP An older LSP is discarded What if a router crash and sequence number reset to 0?
Receiving node floods LSP to all its neighbors Except neighbor where the LSP came from
Reliability via acknowledgement and retransmission Variant of PI (Propagation of Information) protocol
In recitation: PI, PIF (Prop. of Info. w/ Feedback)
Routing 4-18
OSPF “advanced” features
Multiple cost metrics For different Type Of Service [TOS] E.g., satellite: high bandwidth, but high latency
“signal” to stop restart upon changeAsynchronous: nodes need not
exchange info/iterate in lock step!
Distributed: each node
communicates only with directly-attached neighbors
Distance Table data structure
each node has its own table row for each possible
destination column for each neighbor example: in node X, for dest. Y
via neighbor Z:
D )Y,Z(X
distance from X toY, via Z as next hop
c)X,Z( + min {D )Y,w(}Z
w
=
=
Routing 4-21
Distance Table: example
A
E D
CB7
8
1
2
1
2
D )(
A
B
C
D
A
1
7
6
4
B
14
8
9
11
D
5
5
4
2
Ecost to destination via
dest
inat
ion
D )C,D(E
c)E,D( + min {D )C,w(}D
w== 2+2 = 4
D )A,D(E
c)E,D( + min {D )A,w(}D
w== 2+3 = 5
D )A,B(E
c)E,B( + min {D )A,w(}B
w== 8+6 = 14
loop!
loop!
Routing 4-22
Distance table gives routing table
D )(
A
B
C
D
A
1
7
6
4
B
14
8
9
11
D
5
5
4
2
Ecost to destination via
dest
inat
ion
A
B
C
D
A,1
D,5
D,4
D,4
Outgoing link to use, cost
dest
inat
ion
Distance table Routing table
Routing 4-23
Distance Vector Routing: overview
Iterative, asynchronous: each local iteration caused by:
local link cost change message from neighbor:
its least cost path change from neighbor
Distributed: each node notifies
neighbors only when its least cost path to any destination changes neighbors then notify
their neighbors if necessary
wait for )change in local link cost or msg from neighbor(
recompute distance table
if least cost path to any dest
has changed, notify neighbors
Each node:
Routing 4-24
Distance Vector Algorithm at node x:Initialization: for all nodes y and all neighbors v: DX)y,v( = {c)x,v( for y=v, else ∞}
On Detect_cost_of_link to neighbor v (i.e. c(x,v)) changes by d /* change cost to all dest's via neighbor v by d */ /* note: d could be positive or negative */ for all destinations y: DX(y,v) = DX(y,v) + d
On Rcv <y, D> from neighbor v: /* shortest path from v to some y has changed */ /* v sent a new value for its minWDV(y,w) */ DX(y,v) = c(x,v) + D
Every T seconds (or always, if T=0): If DX(y)=minWDX(y,w) changed (for any destination y), then send <y, DX(y)> to all neighbors
Routing 4-25
Distance Vector Algorithm: example
X Z12
7
Y
D )Y,Z(X
c)X,Z( + min {D )Y,w(}w=
= 7+1 = 8
Z
D )Z,Y(X
c)X,Y( + min {D )Z,w(}w=
= 2+1 = 3
Y
Routing 4-26
Distance Vector Algorithm: example
X Z12
7
Y
Routing 4-27
Distance Vector: link cost changesLink cost changes: node detects local link cost
change updates distance table if cost change in least cost path,
notify neighbors Example when DX)y,v( reduced:
X Z14
50
Y1
algorithmterminates(converges – no activity)
“goodnews travelsfast”(and noloops)
Routing 4-28
Distance Vector: Convergence If network stabilizes, then DV eventually outputs shortest paths (and halts)
Assuming FIFO, max delay Δ, min weight w [why?] Consider single, fixed target node y; DY(y)=0 Let x(0)=y, x(0), x(1),…x(n) be the nodes by order of min-
distance from y Claim: for all i (0≤i≤n), eventually Dx(i)(y)=D(i), the min-
distance from x(i) to y. Proof: by induction on i. Trivially holds for i=0 (i.e. x(0)=y). Assume from time t, there are no new `detect cost change`
events, and x(0)…x(i) stabilized to D(i). We prove the claim holds for i+1 as well. For every j>i, eventually Dx(j)(y)D(i+1) [why?] Then, eventually x(i+1) receives D(j) from x(j), s.t. j≤i and
D(i)=D(j)+c(x(j),x(i))… Claim follows! But… convergence can be veeery sloooooooow…
Routing 4-29
Slow convergence: “count to infinity”
Link cost changes: bad news travels slow!
Bad news = DX)y,v( increased (e.g. link down) Convergence time depends on cost ratios, not
just on nX Z
14
50
Y60
algorithmcontinues
on!
Packets sent from Z, Y to X will loop btw Z, Y!!
Routing 4-30
Distance Vector: poisoned reverse(fix to most `count to infinity` scenarios)
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) Exercises: modify code; re-do convergence analysis Often helps – but complexity still depends on cost
ratios, not just on n; Exercise: demonstrate this!
X Z14
50
Y60
algorithmterminates
Routing 4-31
RIP ( Routing Information Protocol)
Standard distance vector algorithm Distance vectors exchanged among neighbors
every 30 sec via RIP advertisement Distance metric: # of hops
≤15hops; 16=unreachable Each advertisement: list of up to 25
destination nets Sent using UDP (why?)
Routing 4-32
RIP: Example
Destination Network Next Router Num. of hops to dest. w A 2
y B 2 z B 7
x -- 1…. …. ....
w x yA
C
D B
Routing table in D
z
Routing 4-33
RIP: Example
Destination Network Next Router Num. of hops to dest. w A 2
y B 2 z B A 7 5
x -- 1…. …. ....Routing table in D
Dest Next hops w - - x - - z C 4 …. … ...
Advertisementfrom A to D
w x yA
C
D Bz
Routing 4-34
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• Send infinite distance (= 16 hops) to first hop toward
destination
Routing 4-36
Routing: Agenda Network layer services: datagram vs. virtual
circuit Link-state routing: OSPF Distance-vector routing: RIP Hierarchical and Inter-Autonomous Systems
routing: BGP
Routing 4-37
Hierarchical Routing and Autonomous Systems
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 (Autonomous Systems)
AS= Autonomous System, a network under a single administrative control
Identified by 16-bit AS Number (ASN)
Our routing study thus far - idealization all routers identical network “flat”… not true in practice
Routing 4-38
Hierarchical Routing and AS
Aggregate routers By “autonomous
systems” (AS) Or: within a huge AS
routers in same AS run same routing protocol “intra-AS” routing
protocol routers in different AS
can run different intra-AS routing protocol
special routers in AS run intra-AS routing
protocol with all other routers in AS
Use inter-AS routing protocol to route to Nets in other AS-es