OMP/ELE 49/6 Introduction to omputer Networks Intra-domain routing Some slides used with permissions from Edward W. Knightly, T. S. Eugene Ng, Ion Stoica, Hui Zhang T. S. Eugene Ng eugeneng at cs.rice.edu Rice University
Routing What is routing? The process of determining the path to send data from a source to a destination Routing decides the contents of the forwarding tables in routers Different from Forwarding Forwarding is the act of moving packets from input to output according to a forwarding table Forwarding happens at both IP routers and at Ethernet bridges Ethernet performs forwarding, but not routing: Ethernet bridges flood a packet through the spanning tree, bridges learn the direction to the source and fill forwarding tables. There is no intentional path choice being made. Host Houston Host hicago T. S. Eugene Ng eugeneng at cs.rice.edu Rice University
Two Level Hierarchy of Internet Routing S- Interior router order router S- S- S utonomous System The numeric value is an ID T. S. Eugene Ng eugeneng at cs.rice.edu Rice University
Why Need Levels? Routing protocols are not efficient enough to deal with the size of the entire Internet Different organizations may want different internal routing policies llow organizations to hide their internal network configurations from outside llow organizations to choose how to route across multiple S s More scalable, more autonomy/independence T. S. Eugene Ng eugeneng at cs.rice.edu Rice University 4
Two Level Hierarchy of Internet Routing First level autonomous systems (S) S: region of network under a single administrative domain e.g. Rice s IP network, T&T s US backbone IP network Each S performs intra-domain routing e.g. Routing Information Protocol (RIP) e.g. Open Shortest Path First (OSPF) Protocol e.g. Static routing, centralized routing... Second level inter-connected Ss etween Ss perform inter-domain routing e.g. order Gateway Protocol (GP) De facto standard today, GP-4 T. S. Eugene Ng eugeneng at cs.rice.edu Rice University
Routing Policy Given multiple alternative paths, which paths are chosen to route packets to destinations is a policy decision What are some possible policies? Shortest path Most load-balanced Satisfies app s delay/bandwidth requirements Need routing protocols to realize these policies D E F Network modeled as a graph Routers nodes Link edges Edge cost: delay, congestion level, T. S. Eugene Ng eugeneng at cs.rice.edu Rice University 6
Outline for this Module Two approaches for intra-domain routing oth try to achieve the shortest path routing policy Link state routing protocol Distance vector routing protocol In Project, you will get to implement fairly realistic variants of these and really understand how they work! Distributed coordination in action T. S. Eugene Ng eugeneng at cs.rice.edu Rice University 7
General ssumptions Nodes know only the cost to their neighbors; not the topology Nodes can talk only to their neighbors using messages ll nodes run the same algorithm concurrently Nodes / links may fail, messages may be lost T. S. Eugene Ng eugeneng at cs.rice.edu Rice University 8
Link State Routing Nodes flood, in a controlled manner, topology information in the form of link state packets Each node learns full topology Do not confuse this with Ethernet spanning tree data packet flooding Each node computes its own routing table to realize the shortest path routing policy y Dijkstra's algorithm T. S. Eugene Ng eugeneng at cs.rice.edu Rice University 9
Link State Flooding Each node knows its connectivity and cost to a direct neighbor How? Every node tells every other node this local connectivity/cost information Via controlled flooding In the end, every node learns the complete topology of the network E.g. floods message: connected to cost connected to D cost connected to cost D E F T. S. Eugene Ng eugeneng at cs.rice.edu Rice University 0
Flooding Details Each node periodically generates Link State Packet (LSP) that contains ID of node created LSP List of direct neighbors and costs Sequence number (say 64 bit, assume to never wrap around) Incremented when a new LSP is created Sequence number used to identify newer LSP n older LSP with a sequence number previously seen is discarded What if a router reboots and lost the last sequence number used? Receiving node flood newer LSP to all its neighbors except the neighbor where the LSP came from LSP is also triggered on-demand when a link s state changes (failed or restored) From Seq. # D T. S. Eugene Ng eugeneng at cs.rice.edu Rice University
Link State Flooding Example 7 4 8 6 0 T. S. Eugene Ng eugeneng at cs.rice.edu Rice University
Link State Flooding Example 7 4 8 6 0 T. S. Eugene Ng eugeneng at cs.rice.edu Rice University
Link State Flooding Example 7 4 8 6 0 T. S. Eugene Ng eugeneng at cs.rice.edu Rice University 4
Link State Flooding Example assume this copy arrives first 7 4 8 6 0 T. S. Eugene Ng eugeneng at cs.rice.edu Rice University
Link State Flooding Example assume this copy arrives first 7 4 8 6 0 T. S. Eugene Ng eugeneng at cs.rice.edu Rice University 6
omputing Shortest Path Routes with Dijkstra s Shortest Path lgorithm Dijkstra s algorithm Network topology, link costs learned by all nodes ccomplished via link state flooding Each node computes least cost paths from itself to all other nodes in the topology Notations 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 node 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 T. S. Eugene Ng eugeneng at cs.rice.edu Rice University 7
Dijsktra s lgorithm Initialization: S = {}; for all nodes v 4 if v adjacent to then D(v) = c(,v); 6 else D(v) = ; 7 8 Loop 9 find w not in S such that D(w) is a minimum; 0 add w to S; update D(v) for all v adjacent to w and not in S: D(v) = min( D(v), D(w) + c(w,v) ); // new cost to v is either old cost to v or known // shortest path cost to w plus cost from w to v until all nodes in S; T. S. Eugene Ng eugeneng at cs.rice.edu Rice University 8
Example: Dijkstra s lgorithm Step 0 4 start S D(),p(), D(),p(), D(D),p(D), D(E),p(E) D(F),p(F) D E F Initialization: S = {}; for all nodes v 4 if v adjacent to then D(v) = c(,v); 6 else D(v) = ; T. S. Eugene Ng eugeneng at cs.rice.edu Rice University 9
Example: Dijkstra s lgorithm Step 0 4 start S D D D(),p(), E F D(),p(), 4,D D(D),p(D), D(E),p(E),D D(F),p(F) 8 Loop 9 find w not in S s.t. D(w) is a minimum; 0 add w to S; update D(v) for all v adjacent to w and not in S: D(v) = min( D(v), D(w) + c(w,v) ); until all nodes in S; T. S. Eugene Ng eugeneng at cs.rice.edu Rice University 0
Example: Dijkstra s lgorithm Step 0 4 start S D DE D(),p(), D(),p(), 4,D,E D(D),p(D), D(E),p(E),D D(F),p(F) 4,E D E F 8 Loop 9 find w not in S s.t. D(w) is a minimum; 0 add w to S; update D(v) for all v adjacent to w and not in S: D(v) = min( D(v), D(w) + c(w,v) ); until all nodes in S; T. S. Eugene Ng eugeneng at cs.rice.edu Rice University
Example: Dijkstra s lgorithm Step 0 4 start S D DE DE D(),p(), D(),p(), 4,D,E D(D),p(D), D(E),p(E),D D(F),p(F) 4,E D E F 8 Loop 9 find w not in S s.t. D(w) is a minimum; 0 add w to S; update D(v) for all v adjacent to w and not in S: D(v) = min( D(v), D(w) + c(w,v) ); until all nodes in S; T. S. Eugene Ng eugeneng at cs.rice.edu Rice University
Example: Dijkstra s lgorithm Step 0 4 start S D DE DE DE D(),p(), D(),p(), 4,D,E D(D),p(D), D(E),p(E),D D(F),p(F) 4,E D E F 8 Loop 9 find w not in S s.t. D(w) is a minimum; 0 add w to S; update D(v) for all v adjacent to w and not in S: D(v) = min( D(v), D(w) + c(w,v) ); until all nodes in S; T. S. Eugene Ng eugeneng at cs.rice.edu Rice University
Example: Dijkstra s lgorithm Step 0 4 start S D DE DE DE DEF D(),p(), D(),p(), 4,D,E D(D),p(D), D(E),p(E),D D(F),p(F) 4,E D E F 8 Loop 9 find w not in S s.t. D(w) is a minimum; 0 add w to S; update D(v) for all v adjacent to w and not in S: D(v) = min( D(v), D(w) + c(w,v) ); until all nodes in S; T. S. Eugene Ng eugeneng at cs.rice.edu Rice University 4
Distance Vector Routing What is a distance vector? urrent best known cost to get to a destination e.g. at a node Dest. ost 7 D J K Q T t the beginning, distance vector only has information about directly attached neighbors Eventually the vector is filled T. S. Eugene Ng eugeneng at cs.rice.edu Rice University
Each router maintains Distance Vector Routing Row for each possible destination olumn for each directly-attached neighbor Entry in row Y and column Z of node X represents best known distance from X to Y, via Z as next hop Idea: Exchange distance vectors among neighbors to learn about lowest cost paths Periodically to refresh information On-demand when distance vector information changes Iteratively exchange distance vectors until no new information is learned T. S. Eugene Ng eugeneng at cs.rice.edu Rice University 6
Distance Vector Routing Each local iteration caused by: Local link cost change DV message from neighbor: its least cost path to destination changed Each node notifies neighbors when its least cost path to any destination changes Neighbors then notify their neighbors if necessary Periodic messages used to refresh information Each node: wait for (change in local link cost or msg from neighbor) recompute distance vector if least cost path to any dest has changed, notify neighbors T. S. Eugene Ng eugeneng at cs.rice.edu Rice University 7
Distance Vector lgorithm Initialization: for all nodes V do if V adjacent to 4 D(, V, V) = c(,v); /* Distance from to V via neighbor V */ else D(, V, *) = ; loop: 8 wait (until sees a link cost change to neighbor V 9 or until receives update from neighbor V) 0 if (c(,v) changes by d) for all destinations Y through V do D(,Y, V) = D(,Y,V) + d else if (update D(V, Y) received from V) /* shortest path from V to some Y has changed */ 4 D(,Y,V) = c(,v) + D(V, Y); if (there is a new minimum for destination Y) 6 send new message containing D(, Y) to all neighbors /* D(,Y) denotes the min D(,Y,*) */ 7 forever T. S. Eugene Ng eugeneng at cs.rice.edu Rice University 8
Example: Distance Vector lgorithm 7 D Node Dest. ost NextHop 7 D - Node Dest. ost NextHop D D Initialization: for all nodes V do if V adjacent to 4 D(, V, V) = c(,v); else 6 D(, V, *) = ; Node Dest. ost NextHop 7 D D Node D Dest. ost NextHop - T. S. Eugene Ng eugeneng at cs.rice.edu Rice University 9
Example: st Iteration ( ) 7 Node 7 loop: else if (update D(V, Y) received from V) 4 D(,Y,V) = c(,v) + D(V, Y); if (there is a new min. for destination Y) 6 send D(, Y) to all neighbors 7 forever Node D Dest. ost NextHop 7 D 8 Dest. ost NextHop 7 D D Node Dest. ost NextHop D D D(,D,) = c(, ) + D(,D) = 7 + = 8 (D(,), D(,), D(,D)) Node D Dest. ost NextHop - T. S. Eugene Ng eugeneng at cs.rice.edu Rice University 0
Example: st Iteration (, ) 7 D Node Dest. ost NextHop D Node Dest. ost NextHop D D D(,D,) = c(,) + D(,D) = + = D(,,) = c(,) + D(,) = + = 7 loop: else if (update D(V, Y) received from V) 4 D(,Y,V) = c(,v) + D(V, Y) if (there is a new min. for destination Y) 6 send D(, Y) to all neighbors 7 forever Node Dest. ost NextHop 7 D D Node D Dest. ost NextHop - T. S. Eugene Ng eugeneng at cs.rice.edu Rice University
Example: End of st Iteration 7 D 7 loop: else if (update D(V, Y) received from V) 4 D(,Y,V) = c(,v) + D(V, Y); if (there is a new min. for destination Y) 6 send D(, Y) to all neighbors 7 forever Node Dest. ost NextHop D Node Dest. ost NextHop D D Node Dest. ost NextHop D Node D Dest. ost NextHop T. S. Eugene Ng eugeneng at cs.rice.edu Rice University
Example: End of nd Iteration 7 D Node Dest. ost NextHop D 4 7 loop: else if (update D(V, Y) received from V) 4 D(,Y,V) = c(,v) + D(V, Y); if (there is a new min. for destination Y) 6 send D(, Y) to all neighbors 7 forever Node Dest. ost NextHop D D Node Dest. ost NextHop D Node D Dest. ost NextHop 4 T. S. Eugene Ng eugeneng at cs.rice.edu Rice University
7 Example: End of rd Iteration D Node Dest. ost NextHop D 4 7 loop: else if (update D(V, Y) received from V) 4 D(,Y,V) = c(,v) + D(V, Y); if (there is a new min. for destination Y) 6 send D(, Y) to all neighbors 7 forever Node Dest. ost NextHop D D Nothing changes Node Dest. ost NextHop D Node D Dest. ost NextHop 4 T. S. Eugene Ng eugeneng at cs.rice.edu Rice University 4
Node Distance Vector: Link ost hanges 4 0 D N D N D N D N 4 Node D N D N D N D N good news travels fast Link cost changes here Nothing changes time T. S. Eugene Ng eugeneng at cs.rice.edu Rice University
Distance Vector: ount to Infinity Problem Node D N D N D N D N 60 4 0 4 6 6 8 Node D N D N D 7 N D 7 N bad news travels slowly time Link cost changes here; recall that also maintains shortest distance to through, which is 6. Thus D(, ) becomes 6! T. S. Eugene Ng eugeneng at cs.rice.edu Rice University 6
Node Distance Vector: Poison Reverse If routes through to get to : - tells its distance to is infinite (so won t route to via ) - Will this completely solve count to infinity problem? D N D N D N D N 60 4 0 D N 4 60 60 Node D N D N D N D N D N 0 0 0 T. S. Eugene Ng eugeneng at cs.rice.edu Rice University 7
Link State vs. Distance Vector chieve different engineering trade-offs in terms of messaging overhead, computational overhead, convergence time, reliability... Which one would you choose and why? T. S. Eugene Ng eugeneng at cs.rice.edu Rice University 8
Link State vs. Distance Vector Per node message complexity LS: O(n*d) messages to learn entire topology; n number of nodes; d average degree of nodes DV: O(d) messages per iteration; number of iterations vary (count-to-infinity) omputation complexity LS: O(n log n) with efficient priority queue for each execution of Dijkstra s alg. Faster incremental algorithms do exist DV: O(n) per iteration; total computation and convergence time vary (count-to-infinity) Robustness How likely is it to have a routing loop with each protocol? What happens in each protocol if a router malfunctions and lies in messages? T. S. Eugene Ng eugeneng at cs.rice.edu Rice University 9