What is Routing? Routing implements the core function of a network: : Shortest Path Routing Ion Stoica Ts: Junda Liu, K Moon, avid Zats http://inst.eecs.berkeley.edu/~ee/fa9 (Materials with thanks to Vern Paxson, Jennifer Rexford, and colleagues at U erkeley) It ensures that information accepted for transfer at a source node is delivered to the correct set of destination nodes, at reasonable levels of performance. Internet Routing xample Internet organized as a two level hierarchy irst level autonomous systems (S s) S region of network under a single administrative domain S s run an intra-domain routing protocols istance Vector, e.g., Routing Information Protocol (RIP) Link State, e.g., Open Shortest Path irst (OSP) etween S s runs inter-domain routing protocols, e.g., order Gateway Routing (GP) e facto standard today, GP- S- S- Interior router GP router S-
orwarding vs. Routing orwarding: data plane irecting a data packet to an outgoing link Individual router using a forwarding table Routing: control plane omputing paths the packets will follow Routers talking amongst themselves Individual router creating a forwarding table Know Thy Network Routing requires knowledge of the network structure entralized global state Single entity knows the complete network structure an calculate all routes centrally Problems with this approach? istributed global state very router knows the complete network structure Independently calculates routes Problems with this approach? istributed no-global state very router knows only about its neighboring routers Independently calculates routes Problems with this approach? Link State Routing!.g. lgorithm: ijkstra!.g. Protocol: OSP! istance Vector Routing!.g. lgorithm: ellman-ord!.g. Protocol: RIP! 6 Modeling a Network Link State: ontrol Traffic Modeled as a graph Routers nodes Link edges Possible edge costs delay congestion level ach node floods its local information to every other node in the network ach node ends up knowing the entire network topology use ijkstra to compute the shortest path to every other node Host N Host N N Host Goal of Routing etermine a good path through the network from source to destination Good usually means the shortest path Host N N N6 N Host 8
Link State: Node State Notation Host Host N N Host N N N6 N N Host Host c(i,j): link cost from node i to j; cost infinite if not direct neighbors; (v): current value of cost of path from source to destination v p(v): predecessor node along path from source to v, that is next to v S: set of nodes whose least cost path definitively known 9 Source! ijsktra s lgorithm Initialization: S = {}; for all nodes v if v adjacent to then (v) = c(,v); 6 else (v) = ; c(i,j): link cost from node i to j (v): current cost source v p(v): predecessor node along path from source to v, that is next to v S: set of nodes whose least cost path definitively known 9 find w not in S such that (w) is a minimum; add w to S; update (v) for all v adjacent if (w) + c(w,v) < (v) then // w gives us a shorter path to v than we ve found so far (v) = (w) + c(w,v); p(v) = w; until all nodes in S; xample: ijkstra s lgorithm (),p() (),p(),, (),p(), (),p() (),p() Initialization: S = {}; for all nodes v if v adjacent to then (v) = c(,v); 6 else (v) = ;
xample: ijkstra s lgorithm (),p(), (),p(), (),p(), (),p() (),p() 9 find w not in S s.t. (w) is a minimum; add w to S; update (v) for all v adjacent If (w) + c(w,v) < (v) then (v) = (w) + c(w,v); p(v) = w; until all nodes in S; xample: ijkstra s lgorithm (),p(), (),p(), (),p(), (),p() (),p() 9 find w not in S s.t. (w) is a minimum; add w to S; update (v) for all v adjacent If (w) + c(w,v) < (v) then (v) = (w) + c(w,v); p(v) = w; until all nodes in S; xample: ijkstra s lgorithm (),p(), (),p() (),p(),,, (),p(), (),p() 9 find w not in S s.t. (w) is a minimum; add w to S; update (v) for all v adjacent If (w) + c(w,v) < (v) then (v) = (w) + c(w,v); p(v) = w; until all nodes in S; xample: ijkstra s lgorithm (),p(), (),p() (),p(),,,, (),p(), (),p(), 9 find w not in S s.t. (w) is a minimum; add w to S; update (v) for all v adjacent If (w) + c(w,v) < (v) then (v) = (w) + c(w,v); p(v) = w; until all nodes in S; 6
xample: ijkstra s lgorithm (),p(), (),p() (),p(),,,, (),p(), (),p(), 9 find w not in S s.t. (w) is a minimum; add w to S; update (v) for all v adjacent If (w) + c(w,v) < (v) then (v) = (w) + c(w,v); p(v) = w; until all nodes in S; xample: ijkstra s lgorithm (),p(), (),p() (),p(),,,, (),p(), (),p(), 9 find w not in S s.t. (w) is a minimum; add w to S; update (v) for all v adjacent If (w) + c(w,v) < (v) then (v) = (w) + c(w,v); p(v) = w; until all nodes in S; 8 xample: ijkstra s lgorithm (),p(), (),p() (),p(),,,, (),p(), (),p(), 9 find w not in S s.t. (w) is a minimum; add w to S; update (v) for all v adjacent If (w) + c(w,v) < (v) then (v) = (w) + c(w,v); p(v) = w; until all nodes in S; 9 xample: ijkstra s lgorithm (),p(), (),p() (),p(),,,, (),p(), (),p() To determine path (say), work backward from via p(v),
The orwarding Table Running ijkstra at node gives the shortest path from to all destinations We then construct the forwarding table estination Link (,) (,) (,) (,) omplexity How much processing does running the ijkstra algorithm take? ssume a network consisting of N nodes ach iteration: need to check all nodes, w, not in S N(N+)/ comparisons: O(N ) More efficient implementations possible: O(N log(n)) (,) Obtaining Global State looding the Link State looding ach router sends link-state information out its links The next node sends it out through all of its links except the one where the information arrived Note: need to remember previous msgs & suppress duplicates! X X X (a) (c) X (b) (d) Reliable flooding nsure all nodes receive link-state information nsure all nodes use the latest version hallenges Packet loss Out-of-order arrival Solutions cknowledgments and retransmissions Sequence numbers Time-to-live for each packet 6
When to Initiate looding Topology change Link or node failure Link or node recovery onfiguration change Link cost change See next slide for hazards of dynamic link costs based on current load Periodically Refresh the link-state information Typically (say) minutes Oscillations ssume link cost = amount of carried traffic +e e e initially +e +e recompute routing 6 orrects for possible corruption of the data +e +e recompute +e +e e recompute How can you avoid oscillations? istance Vector Routing Minute reak Questions efore We Proceed? ach router knows the links to its immediate neighbors oes not flood this information to the whole network ach router has some idea about the shortest path to each destination.g.: Router : I can get to router with cost via next hop router Routers exchange this information with their neighboring routers gain, no flooding the whole network Routers update their idea of the best path using info from neighbors 8
Information low in istance Vector ellman-ord lgorithm Host Host N N Host N N N6 N N Host Host INPUT: Link costs to each neighbor Not full topology OUTPUT: Next hop to each destination and the corresponding cost oes not give the complete path to the destination 9 ellman-ord - Overview ach router maintains a table Row for each possible destination olumn for each directly-attached neighbor to node ntry in row Y and column Z of node X best known distance from X to Y, via Z as next hop = Z (X,Y) Node 8 8 Neighbor (next-hop) estinations (, ) ellman-ord - Overview ach router maintains a table Row for each possible destination olumn for each directly-attached neighbor to node ntry in row Y and column Z of node X best known distance from X to Y, via Z as next hop = Z (X,Y) Node 8 8 Smallest distance in row Y = shortest istance of to Y, (, Y) 8
ellman-ord - Overview ach router maintains a table Row for each possible destination olumn for each directly-attached neighbor to node ach node: wait for (change in local link ntry in row Y and column Z of node X best known distance from X to Y, via cost or msg from neighbor) Z as next hop = Z (X,Y) ach local iteration caused by: recompute distance table Local link cost change Message from neighbor if least cost path to any dest Notify neighbors only if least cost path to any destination changes has changed, notify neighbors Neighbors then notify their neighbors if necessary istance Vector lgorithm (cont d) Initialization: for all neighbors V do c(i,j): link cost from node i to j if V adjacent to Z (,V): cost from to V via Z (, V) = c(,v); (,V): cost of s best path to V else 6 (, V) = ; send (, Y) to all neighbors loop: 8 wait (until sees a link cost change to neighbor V /* case */ 9 or until receives update from neighbor V) /* case */ if (c(,v) changes by ±d) /* case */ for all destinations Y that go through V do V (,Y) = V (,Y) ± d else if (update (V, Y) received from V) /* case */ /* shortest path from V to some Y has changed */ V (,Y) = V (,V) + (V, Y); /* may also change (,Y) */ if (there is a new minimum for destination Y) 6 send (, Y) to all neighbors forever xample: st Iteration ( ) loop: else if (update (, Y) from ) (,Y) = (,) + (, Y); if (new min. for destination Y) 6 send (, Y) to all neighbors forever Node 8 8 Node Node (, ) = (,) + (, ) = + = 8 (, ) = (,) + (, ) = + = 8 Node xample: st Iteration ( ) loop: else if (update (, Y) from ) (,Y) = (,) + (, Y); if (new min. for destination Y) 6 send (, Y) to all neighbors forever Node 8 8 Node Node (, ) = (,) + (, ) = + = (, ) = (,) + (, ) = + = Node 9
xample: nd of st Iteration nd of st Iteration ll nodes knows the best two-hop paths Node 8 8 Node 9 Node 9 Node 8 xample: nd Iteration ( ) loop: else if (update (, Y) from ) (,Y) = (,) + (, Y); if (new min. for destination Y) 6 send (, Y) to all neighbors forever Node 8 8 Node 9 Node (, ) = (,) + (, ) = + = (, ) = (,) + (, ) = + = Node 8 xample: nd of nd Iteration Node Node 8 8 xample: nd of rd Iteration Node Node 8 6 8 nd of nd Iteration ll nodes knows the best three-hop paths Node 6 9 Node nd of nd Iteration: lgorithm onverges! Node 9 Node
istance Vector: Link ost hanges istance Vector: ount to Infinity Problem loop: 8 wait (until sees a link cost change to neighbor V 9 or until receives update from neighbor V) / if (c(,v) changes by ±d) /* case */ for all destinations Y that go through V do V (,Y) = V (,Y) ± d else if (update (V, Y) received from V) /* case */ V (,Y) = V (,V) + (V, Y); if (there is a new minimum for destination Y) 6 send (, Y) to all neighbors forever loop: 8 wait (until sees a link cost change to neighbor V 9 or until receives update from neighbor V) / if (c(,v) changes by ±d) /* case */ for all destinations Y that go through V do V (,Y) = V (,Y) ± d else if (update (V, Y) received from V) /* case */ V (,Y) = V (,V) + (V, Y); if (there is a new minimum for destination Y) 6 send (, Y) to all neighbors forever 6 Node Node 6 9 6 9 6 9 good news travels fast Node Node 6 9 6 6 9 6 6 9 6 8 9 bad news travels slowly Link cost changes here time lgorithm terminates Link cost changes here time Node Node istance Vector: Poisoned Reverse If routes through to get to : - tells its ( s) distance to is infinite (so won t route to via ) - Will this completely solve count to infinity problem? 6 9 6 6 9 Link cost changes here; updates (, ) = 6 as has advertised (, ) = 6 6 9 6 6 9 6 9 time lgorithm terminates Routing Information Protocol (RIP) Simple distance-vector protocol Nodes send distance vectors every seconds or, when an update causes a change in routing Link costs in RIP ll links have cost Valid distances of through with 6 representing infinity Small infinity smaller counting to infinity problem RIP is limited to fairly small networks.g., campus
Link State vs. istance Vector Per-node message complexity: LS: O(e) messages e: number of edges V: O(d) messages, many times d is node s degree omplexity/onvergence LS: O(N log N) computation Requires global flooding V: convergence time varies ount-to-infinity problem Robustness: what happens if router malfunctions? LS: Node can advertise incorrect link cost ach node computes only its own table V: Node can advertise incorrect path cost ach node s table used by others; errors propagate through network Summary Routing is a distributed algorithm ifferent from forwarding React to changes in the topology ompute the shortest paths Two main shortest-path algorithms ijkstra link-state routing (e.g., OSP, IS-IS) ellman-ord distance-vector routing (e.g., RIP) onvergence process hanging from one topology to another Transient periods of inconsistency across routers Next time: GP Reading: K&R.6. 6