Data Communication and Networks Lecture 8 Networks: (Routing) October 23, 2003 Joseph Conron Computer Science Department New York University
Some Perspective on Routing ….. zWhen we wish to take a long trip by car, we consult a road map. zThe road map shows the possible routes to our destination. zIt might show us the shortest distance, but, it can’t always tell us what we really want to know: yWhat is the fastest route! yWhy is this not always obvious? zQuestion: What’s the difference between you and network packet?
Packets are Dumb, Students are Smart! zWe adapt to traffic conditions as we go. zPackets depend on routers to choose how they get their destination. zRouters have maps just like we do. These are called routing tables. zWhat we want to know is: yHow to these tables get constructed/updated? yHow are routes chosen using these tables?
Network Information Source and Update Timing zRouting decisions usually based on knowledge of network (not always) zDistributed routing yNodes use local knowledge yMay collect info from adjacent nodes yMay collect info from all nodes on a potential route zCentral routing yCollect info from all nodes zUpdate timing yWhen is network info held by nodes updated yFixed - never updated yAdaptive - regular updates
Routing Strategies zFixed zFlooding zRandom zAdaptive
Fixed Routing zSingle permanent route for each source to destination pair zDetermine routes using a least cost algorithm (chapter 12.3) zRoute fixed, at least until a change in network topology
Fixed Routing Tables
Flooding zNo network info required zPacket sent by node to every neighbor zIncoming packets retransmitted on every link except incoming link zEventually a number of copies will arrive at destination zEach packet is uniquely numbered so duplicates can be discarded zNodes can remember packets already forwarded to keep network load in bounds zCan include a hop count in packets
Flooding Example
Properties of Flooding zAll possible routes are tried yVery robust zAt least one packet will have taken minimum hop count route yCan be used to set up virtual circuit zAll nodes are visited yUseful to distribute information (e.g. routing)
Random Routing zNode selects one outgoing path for retransmission of incoming packet zSelection can be random or round robin zCan select outgoing path based on probability calculation zNo network info needed zRoute is typically not least cost nor minimum hop
Adaptive Routing zUsed by almost all packet switching networks zRouting decisions change as conditions on the network change yFailure yCongestion zRequires info about network zDecisions more complex zTradeoff between quality of network info and overhead zReacting too quickly can cause oscillation zToo slowly to be relevant
Adaptive Routing - Advantages zImproved performance zAid congestion control (See chapter 13) zComplex system yMay not realize theoretical benefits
Classification zBased on information sources yLocal (isolated) xRoute to outgoing link with shortest queue xCan include bias for each destination xRarely used - do not make use of easily available info yAdjacent nodes yAll nodes
Isolated Adaptive Routing
ARPANET Routing Strategies(1) zFirst Generation y1969 yDistributed adaptive yEstimated delay as performance criterion yBellman-Ford algorithm (chapter 12.3) yNode exchanges delay vector with neighbors yUpdate routing table based on incoming info yDoesn't consider line speed, just queue length yQueue length not a good measurement of delay yResponds slowly to congestion
ARPANET Routing Strategies(2) zSecond Generation y1979 yUses delay as performance criterion yDelay measured directly yUses Dijkstra’s algorithm (Chapter 12.3) yGood under light and medium loads yUnder heavy loads, little correlation between reported delays and those experienced
ARPANET Routing Strategies(3) zThird Generation y1987 yLink cost calculations changed yMeasure average delay over last 10 seconds yNormalize based on current value and previous results
Static Vs. Dynamic Routing zRoutes are static if they do not change. yRoute table is loaded once at startup and all changes are manual yComputers at the network edge use static routing. zRoutes are dynamic if the routing table information can change over time (without human intervention. yInternet routers use dynamic routing.
Routing Table Example
Dynamic Routing and Routers zTo insure that routers know how to reach all possible destinations, routers exchange information using a routing protocol. zBut, we cannot expect every router to know about every other router. yToo much Internet traffic would be generated. yTables would be huge (10 6 routers) yAlgorithms to choose “best” path would never terminate. z How to handle this?
Autonomous Systems (AS) zRouters are divided into groups known as an autonomous systems (AS). zASs communicate using an Exterior Routing Protocol (Intra-AS Routing) zRouters within an AS communicate using an Interior Routing Protocol (Inter-AS Routing)
Interior and Exterior Routing
Why different Intra and Inter-AS routing ? Policy: zInter-AS: admin wants control over how its traffic routed, who routes through its net. zIntra-AS: single admin, so no policy decisions needed Scale: zhierarchical routing saves table size, reduced update traffic Performance: zIntra-AS: can focus on performance zInter-AS: policy may dominate over performance
Routing Algorithms Graph abstraction for routing algorithms: zgraph nodes are routers zgraph edges are physical links ylink cost: delay, $ cost, or congestion level Goal: determine “good” path (sequence of routers) thru network from source to dest. Routing protocol A E D CB F z“good” path: ytypically means minimum cost path yother def’s possible
Routing Algorithm classification Static or dynamic? zStatic: yroutes change slowly over time zDynamic: yroutes change more quickly xperiodic update xin response to link cost changes
Routing Algorithm classification Global or decentralized? Global: all routers have complete topology, link cost info “link state” algorithms Decentralized: router knows physically-connected neighbors, link costs to neighbors iterative process of computation, exchange of info with neighbors “distance vector” algorithms
A Link-State Routing Algorithm Dijkstra’s algorithm znet topology, link costs known to all nodes yaccomplished via “link state broadcast” yall nodes have same info zcomputes least cost paths from one node (‘source”) to all other nodes ygives routing table for that node zIterative yafter k iterations, know least cost path to k dest.’s
A Link-State Routing Algorithm Notation: c(i,j): link cost from node i to j. cost infinite if not direct neighbors D(v): current value of cost of path from source to dest. V p(v): predecessor node along path from source to v, that is next v N: set of nodes whose least cost path definitively known
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 A AD ADE ADEB ADEBC ADEBCF D(B),p(B) 2,A D(C),p(C) 5,A 4,D 3,E D(D),p(D) 1,A D(E),p(E) infinity 2,D D(F),p(F) infinity 4,E A E D CB F
Dijkstra’s algorithm, discussion Algorithm complexity: n nodes zeach iteration: need to check all nodes, w, not in N zn*(n+1)/2 comparisons: O(n**2) zmore efficient implementations possible: O(nlogn) Oscillations possible: ze.g., link cost = amount of carried traffic A D C B 1 1+e e 0 e A D C B 2+e e 1 A D C B 0 2+e 1+e A D C B 2+e 0 e 0 1+e 1 initially … recompute routing … recompute
Distance Vector Routing Algorithm iterative: zcontinues until no nodes exchange info. zself-terminating: no “signal” to stop asynchronous: znodes need not exchange info/iterate in lock step! distributed: zeach node communicates only with directly-attached neighbors Distance Table data structure zeach node has its own zrow for each possible destination zcolumn for each directly-attached neighbor to node zexample: in node X, for dest. Y via neighbor Z: D (Y,Z) X distance from X to Y, via Z as next hop c(X,Z) + min {D (Y,w)} Z w = =
Distance Table: example A E D CB D () A B C D A1764A1764 B D5542D5542 E cost to destination via destination 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!
Distance table gives routing table D () A B C D A1764A1764 B D5542D5542 E cost to destination via destination ABCD ABCD A,1 D,5 D,4 D,2 Outgoing link to use, cost destination Distance table Routing table
Distance Vector Routing: overview Iterative, asynchronous: each local iteration caused by: zlocal link cost change zmessage from neighbor: its least cost path change from neighbor Distributed: zeach node notifies neighbors only when its least cost path to any destination changes yneighbors then notify their neighbors if necessary wait for (change in local link cost of msg from neighbor) recompute distance table if least cost path to any dest has changed, notify neighbors Each node:
Distance Vector Algorithm: 1 Initialization: 2 for all adjacent nodes v: 3 D (*,v) = infty /* the * operator means "for all rows" */ 4 D (v,v) = c(X,v) 5 for all destinations, y 6 send min D (y,w) to each neighbor /* w over all X's neighbors */ X X X w At all nodes, X:
Distance Vector Algorithm (cont.): 8 loop 9 wait (until I see a link cost change to neighbor V 10 or until I receive update from neighbor V) if (c(X,V) changes by d) 13 /* change cost to all dest's via neighbor v by d */ 14 /* note: d could be positive or negative */ 15 for all destinations y: D (y,V) = D (y,V) + d else if (update received from V wrt destination Y) 18 /* shortest path from V to some Y has changed */ 19 /* V has sent a new value for its min DV(Y,w) */ 20 /* call this received new value is "newval" */ 21 for the single destination y: D (Y,V) = c(X,V) + newval if we have a new min D (Y,w)for any destination Y 24 send new value of min D (Y,w) to all neighbors forever w X X X X X w w
Distance Vector Algorithm: example X Z Y
X Z 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
Distance Vector: link cost changes Link cost changes: znode detects local link cost change zupdates distance table (line 15) zif cost change in least cost path, notify neighbors (lines 23,24) X Z Y 1 algorithm terminates “good news travels fast”
Distance Vector: link cost changes Link cost changes: zgood news travels fast zbad news travels slow - “count to infinity” problem! X Z Y 60 algorithm continues on!
Distance Vector: poisoned reverse If Z routes through Y to get to X : zZ tells Y its (Z’s) distance to X is infinite (so Y won’t route to X via Z) zwill this completely solve count to infinity problem? X Z Y 60 algorithm terminates
Comparison of LS and DV algorithms Message complexity zLS: with n nodes, E links, O(nE) msgs sent each zDV: exchange between neighbors only yconvergence time varies Speed of Convergence zLS: O(n**2) algorithm requires O(nE) msgs ymay have oscillations zDV: convergence time varies ymay be routing loops ycount-to-infinity problem
Comparison of LS and DV algorithms 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 error propagates thru network
RIP ( Routing Information Protocol) zDistance vector algorithm zIncluded in BSD-UNIX Distribution in 1982 zDistance metric: # of hops (max = 15 hops) yCan you guess why? zDistance vectors: exchanged every 30 sec via Response Message (also called advertisement) zEach advertisement: route to up to 25 destination nets
OSPF (Open Shortest Path First) z“open”: publicly available zUses Link State algorithm yLS packet dissemination yTopology map at each node yRoute computation using Dijkstra’s algorithm zOSPF advertisement carries one entry per neighbor router zAdvertisements disseminated to entire AS (via flooding)