450 likes | 461 Views
Learn about the functions of the network layer in the internet architecture and explore different routing algorithms such as link-state and distance-vector. Understand the characteristics, issues, and implementations of these algorithms.
E N D
Network layer Functions CSE524: Lecture 12
Where we’re at… • Internet architecture and history • Internet protocols in practice • Application layer • Transport layer • Network layer • Network-layer functions • Addressing, Demux to upper layer, Error detection, Delivery semantics • Security, Fragmentation, Quality of service • Routing • Algorithms • Link-state (Dijkstra’s SPT) • Distance-vector (Distributed Bellman-Ford) • Hierarchies • Specific network layer protocols (IP) and devices • Data-link layer • Physical layer
Recall • Link-state algorithms • Broadcast all link states to each router • Each router performs Dijkstra’s shortest-path tree calculation to generate forwarding tables per-destination • Now… • Analyzing link-state algorithms
NL: Link State Characteristics • Computation overhead • n nodes • each iteration: need to check all nodes, w, not in N • n*(n+1)/2 comparisons: O(n**2) • more efficient implementations possible: O(n log(n)) • Space requirements • Bandwidth requirements • Stability • Inconsistencies can cause transient loops • Consistent LSDBs required for loop-free paths B 1 1 X 3 A C 5 2 D Packet from CA may loop around BDC if B knows about failure and C & D do not
A A A A 2+e 2+e 0 0 D B D D B B D B 1 1+e 1 1+e 0 0 e 0 C C C C NL: Link-state issues Oscillations possible: • e.g., link cost = amount of carried traffic • Example: path to A flaps as traffic routed clockwise and counter-clockwise • Common problem in load-based link metrics • A. Khanna and J. Zinky, "The Revised ARPANET Routing Metric," in ACM SIGCOMM, 1989, pp. 45--46. 1 1+e 0 2+e 0 0 0 0 e 0 1 1+e 1 1 e … recompute … recompute routing … recompute initially
NL: Distance vector routing algorithms • Variants used in • Early ARPAnet • RIP (intra-domain routing protocol) • BGP (inter-domain routing protocol) • Distributed next hop computation • “Gossip with immediate neighbors until you find the best route” • Best route is achieved when there are no more changes • Unit of information exchange • Vector of distances to destinations
X distance from X to Y, via Z as next hop D (Y,*) = X D (Y,Z) Z c(X,Z) + min {D (Y,w)} = w NL: Distance vector routing algorithms • Exchange known distance information iteratively • Example (Bellman 1957) • Start with link table (as with Dijkstra), calculate distance table iteratively • Distance table data structure • table of known distances and next hops kept per node • row for each possible destination • column for each directly-attached neighbor to node • example: in node X, for dest. Y via neighbor Z: Minimum known distance from X to Y = X Next hop node from X to Y H (Y) =
1 B C 7 A 2 8 1 E D 2 E D D (C,D) c(E,D) + min {D (C,w)} = w = 2+2 = 4 E D D (A,D) c(E,D) + min {D (A,w)} = w = 2+3 = 5 E B D (A,B) c(E,B) + min {D (A,w)} = w = 8+6 = 14 NL: Distance table example cost to destination via E D () A B C D A 1 7 6 4 B 14 8 9 11 D 5 5 4 2 destination loop! X H (Y) = loop!
cost to destination via E D () A B C D A 1 7 6 4 B 14 8 9 11 D 5 5 4 2 destination NL: Distance table gives routing table X H (Y) Outgoing link to use, cost A B C D A,1 D,5 D,4 D,4 destination Routing table Distance table
NL: Bellman algorithm • How to calculate best routes? For node i while there is a change in D { for all k not neighbor of i { for each j neighbor of i { Di(k,j) = c(i,j) + Dj(k,*) if Di(k,j) < Di(k,*) { Di(k,*) = Di(k,j) Hi(k) = j } } } } Dj(k,*) k c(i,j) Di(k,*) i j c(i,j’) j’ k’ Dj’(k,*)
NL: Distributed Bellman-Ford • Make Bellman algorithm distributed (Ford-Fulkerson 1962) • Each node i knows part of link table • Iterative • Each node sends around and recalculates D[i,*] • continues until no nodes exchange info. • self-terminating: no “signal” to stop • Asynchronous • nodes need not exchange info/iterate in lock step! • “triggered updates” • Distributed • each node communicates only with directly-attached neighbors
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 NL: Distributed Bellman-Ford overview Each node: 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
NL: Distributed Bellman-Ford algorithm At all nodes, X: 1 Initialization: 2 for all adjacent nodes v: 3 DX(*,v) = infinity /* the * operator means "for all rows" */ 4 DX(v,v) = c(X,v) 5 for all destinations, y 6 send minwDX(y,w) to each neighbor /* w over all X's neighbors */
NL: Distributed Bellman-Ford 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) 11 12 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: DX(y,V) = DX(y,V) + d 16 17 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 minwDV(Y,w) */ 20 /* call this received new value is "newval" */ 21 for the single destination y: DX(Y,V) = c(X,V) + newval 22 23 if we have a new minwDX(Y,w)for any destination Y 24 send new value of minwDX(Y,w) to all neighbors 25 26 forever
NL: DBF example Initial Distance Vectors 1 Distance to Node B C Info at Node A B C D E 7 0 7 ~ ~ 1 A 8 2 B A 7 0 1 ~ 8 C ~ 1 0 2 ~ 1 2 D ~ ~ 2 0 2 E D E 1 8 ~ 2 0
NL: DBF example E Receives D’s Routes Updates cost to C 1 Distance to Node B C Info at Node A B C D E 7 0 7 ~ ~ 1 A 8 2 B A 7 0 1 ~ 8 C ~ 1 0 2 ~ 1 2 D ~ ~ 2 0 2 D E E 1 8 4 2 0
NL: DBF example A receives B’s update Updates cost to C, but cost to E unchanged 1 Distance to Node B C Info at Node A B C D E 7 0 7 8 ~ 1 A 8 2 B A 7 0 1 ~ 8 C ~ 1 0 2 ~ 1 2 D ~ ~ 2 0 2 D E E 1 8 4 2 0
NL: DBF example A receives E’s routes Updates cost to C (new min) and D 1 Distance to Node B C Info at Node A B C D E 7 0 7 5 3 1 A 8 2 B A 7 0 1 ~ 8 C ~ 1 0 2 ~ 1 2 D ~ ~ 2 0 2 D E E 1 8 4 2 0
NL: DBF example And so on, until final distances.... 1 Distance to Node B C Info at Node A B C D E 7 0 6 5 3 1 A 8 2 B A 6 0 1 3 5 C 5 1 0 2 4 1 2 D 3 3 2 0 2 D E E 1 5 4 2 0
NL: DBF example E’s routing table 1 E’s routing table B C Next hop 7 dest A B D 8 2 A 1 14 5 A B 7 8 5 1 2 C 6 9 4 E D D 4 11 2
Y 2 1 X Z 7 NL: DBF (another example) • See book for explanation of this example
Y 2 1 X Z 7 NL: DBF (another example) Z X c(X,Z) + min {D (Y,w)} D (Y,Z) = w = 7+1 = 8 Y X c(X,Y) + min {D (Z,w)} D (Z,Y) = w = 2+1 = 3
Analyzing Distributed Bellman-Ford • Continuously send local distance tables of best known routes to all neighbors until your table converges • Computation diffuses until all nodes converge • Will computation converge quickly and deterministically? • Not all the time • Pathologic cases possible • Several algorithms for minimizing such cases
Link cost changes: • node detects local link cost change • updates distance table (line 15) • if cost change in least cost path, notify neighbors (lines 23,24) • fast convergence (see book for details) 1 Y 4 1 X Z 50 NL: DBF (good news example) algorithm terminates “good news travels fast”
Link cost changes: • good news travels fast • bad news travels slow - “count to infinity” problem! • alternate route implicitly used link that changed 60 Y 4 1 X Z 50 NL: DBF (count-to-infinity example) algorithm continues on!
A B C NL: DBF: (count-to-infinity example) dest cost dest cost 1 X B A 1 1 C 2 C 1 1 25 dest cost A 2 B 1
A B C NL: DBF: (count-to-infinity example) C Sends Routes to B dest cost dest cost B A 1 ~ C 2 C 1 1 25 dest cost A 2 B 1
A B C NL: DBF: (count-to-infinity example) B Updates Distance to A dest cost dest cost B A 1 3 C 2 C 1 1 25 dest cost A 2 B 1
A B C NL: DBF: (count-to-infinity example) B Sends Routes to C dest cost dest cost A B 3 1 C 1 C 2 1 25 dest cost A 4 B 1
A B C NL: DBF: (count-to-infinity example) C Sends Routes to B dest cost dest cost B A 1 5 C 2 C 1 1 25 dest cost A 4 B 1
NL: How are loops caused? • Observation 1: • B’s metric increases • Observation 2: • C picks B as next hop to A • But, the implicit path from C to A includes itself!
NL: Solutions to looping • Split horizon • Do not advertise route to X to an adjacent neighbor if your route to X goes through that neighbor • If C routes through B to get to A, C does not advertise (C=>A) route to B. • Poisoned reverse • Advertise an infinite distance route to X to an adjacent neighbor if your route to X goes through that neighbor • If C routes through B to get to A, C advertises to B that its distance to A is infinity • Works for two node loops • Does not work for loops with more nodes
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? 60 Y 4 1 X Z 50 NL: Split-horizon with poisoned reverse can now select and advertise route to X via Z algorithm terminates route to X through Y goes thru Z poison it! new route to X not involving Y
NL: Solutions to looping 1 A B 1 1 C X 1 D
NL: Solutions to looping • Route poisoning • Advertise infinite cost on a route to everyone (not just next hop) when lowest cost route increases • Gets rid of stale information throughout network • Used in conjunction with Path Holdown • Path Holddown • Freeze route for a fixed time • Do not switch to an alternate while route poisoning is happening • In our example, A and B delay changing and advertising new routes • A and B both set route to D to infinity after single step • Configuring holddown delay • Delay too large: Slow convergence • Delay too small: Count-to-infinity more probable
NL: Solutions to looping • Path vector • Select loop-free paths • Each route advertisement carries entire path • If a router sees itself in path, it rejects the route • BGP does it this way • Space proportional to diameter of network
NL: Solutions to looping • Do solutions completely eliminate loops? • No! Transient loops are still possible • Why? Because implicit path information may be stale • See this in BGP convergence • Only way to fix this • Ensure that you have up-to-date information by explicitly querying
NL: Comparing Link State vs. Distance Vector • Network bandwidth • DV • send everything you know to your neighbors • large messages, transfers only to neighbors • LS • send info about your neighbors to everyone • small messages, but broadcast globally
NL: Link State vs. Distance Vector • Convergence speed: • LS • faster – don’t need to process LSPs before forwarding • single SPT calculation • DV • fast with triggered updates • count-to-infinity problem • Space requirements: • LS • maintains entire topology • DV • maintains only neighbor state • path vector maintains routes proportional to network diameter
NL: Link State vs. Distance Vector • Robustness: • LS can broadcast incorrect/corrupted LSP • Can be made robust since sources are aware of alternate paths within topology • DV can advertise incorrect paths to all destinations • Incorrect calculation can spread to entire network
NL: DUAL • Distributed Update Algorithm • Garcia-Luna-Aceves 1989 • Goal: Avoid transient loops in DV and LS algorithms • Similar in flavor to route poisoning and path holddown • 2 ideas • A path shorter than current path cannot contain a loop • Based on diffusing computation (Dijkstra-Scholten 1980) • Wait until computation completes before changing routes in response to a new update • Similar to path-holddown • 3 kinds of messages • Update, query, reply • 2 states for routers • Active (queries outstanding), passive
NL: DUAL On update if (lower cost) adopt else if (higher cost) { if (from next hop) { if (any path exists < old length from next hop) switch path else freeze route send query to all neighbors except next hop go into active wait for reply from all neighbors update route return to passive } send reply to all querying neighbors }
NL: Routing Hierarchies • Flat routing doesn’t scale • Each node/router cannot be expected to store routes to every destination (or destination network) • 50 million destinations • Route table exchange would swamp network • Key observation • Need less information with increasing distance to destination • Two radically different approaches for routing • The area hierarchy • The landmark hierarchy • Covered in advanced topics at end of course...
NL: Areas • Divide network into areas • Areas can have nested sub-areas • No path between two sub-areas of an area can exit that area • Within area, each node has routes to every other node • Outside area • Each node has routes for other top-level areas only • Inter-area packets are routed to nearest appropriate border router • Can result in sub-optimal paths • Hierarchically address nodes in a network • Sequentially number top-level areas • Sub-areas of area are labeled relative to that area • Nodes are numbered relative to the smallest containing area
NL: Network layer functions summary • Each networking layer provides varying degrees of functionality including…. • security, delivery semantics, quality of service, demux to upper layer, error detection, fragmentation, addressing, routing • Next: IP network layer • IP demux to upper layer • IP error detection • IP delivery semantics • IP security • IP fragmentation • IP quality-of-service • IP addressing • IP routing