200 likes | 363 Views
Routing: Part I. Section 4.2 Outline Algorithms Scalability. Overview. Forwarding vs Routing forwarding: to select an output port based on destination address and routing table routing: process by which routing table is built Network as a Graph Assume single admin. authority
E N D
Routing:Part I Section 4.2 Outline Algorithms Scalability
Overview • Forwarding vs Routing • forwarding: to select an output port based on destination address and routing table • routing: process by which routing table is built • Network as a Graph • Assume single admin. authority • Assume nodes are routers • Assume each link has a cost • The Routing Problem: Find lowest cost path (sum of links) between two nodes
Routing Protocol Issues • It may be simple to calculate least cost path if graph is static but… • Links and routers go down • Links and routers are added • Traffic can cause links to overload • How are costs calculated? • Algorithm must be distributed in order to scale • Different routers can have different routes at same time • Rich area for research due to distributed, dynamic nature of the problem
Distance Vector • Each node maintains a set of triples • (Destination, Cost, NextHop) • forwarding only uses (Destination,NextHop) • Directly connected neighbors exchange “route updates” • periodically (on the order of several seconds; called periodic update) • whenever table changes (called triggered update) • Each update is a list of pairs: • (Destination, Cost) • A router modifies its routing table if it receives a “new” route • smaller cost ( “better” route) • came from the next-hop used to reach a destination • Refresh existing routing table entries • delete an entry if it times out
Example Destination Cost NextHop A 1 A C 1 C D 2 C E 2 A F 2 A G 3 A Table of Router B
Routing Loops: Example 1 F detects that the link to G has failed • F sets distance to G to infinity and sends triggered update to A • A sets distance to G to infinity since it uses F to reach G; sends triggered update to neighbors • C ignores this update since its route to G is vai D with a cost of 2 • A receives periodic update from C with 2-hop path to G • A sets distance to G to 3 and sends a triggered update • F decides it can reach G in 4 hops via A Network stabilizes
Routing Loops: Example 2 the following depends on exact timing of events: • link from A to E fails, A advertises distance of infinity to E • C advertise a distance of 2 to E (periodic updates) • B processes update from A, then the update from C • Based on update from C • B decides it can reach E in 3 hops; sends triggered update • A decides that it can reach E in 4 hops (Via B); sends triggered update • C decides that it can reach E in 5 hops; sends update to B • Based on update from C • B decides it can reach E in 6 hops; sends triggered update • A decides that it can reach E in 7 hops (Via B); sends triggered update • C decides that it can reach E in 8 hops; sends update to B • Based on update from C • cycle repeats • …..
Routing Loops:Example 2 (continued) • Cycle stops when distances reach infinity (some large number) • For a period of time, no node knows that E is unreachable • Routing tables do not stabilize • This is known as the Count-to-infinity problem
Loop-Breaking “Heuristics” • Set infinity to 16 • Assume this is the maximum number of hops in network • bounds the amount of time that it takes to count to infinity • Split horizon • Works only for loops involving two nodes • Don’t send routes learned from a neighbor back to the neighbor • B has the route (E, 2, A) in its table • it must have learned this route from A • When B sends a periodic update to A • route (E, 2) is not included in update
Loop-Breaking Heuristics (cont.) • Split horizon with poison reverse • Send route back with negative information i.e. Infinite • ensures that A will not use B to get to E. • B sends the route (E, ∞) to A.
Loop-Breaking: What can be done ?? • B and C wait after hearing of link failure from A before advertising routes to E • each would conclude that it really had no route to E • However, this delays the convergence of the protocol (Distance Vector Routing)
Link State • Strategy • each node sends to all other nodes information about directly connected links • Link State Packet (LSP) • id of the node that created the LSP • cost of link to each neighbor • sequence number (SEQNO) • time-to-live (TTL) for this packet
Link State:Reliable flooding • when reboot, start SEQNO of all initial LSPs at 0 • generate new LSP periodically • increment SEQNO • store most recent LSP from each node • forward LSP to all nodes but one that sent it • decrement TTL of each LSP before flooding it to neigbors • discard when TTL=0
Link State Route Calculation:Dijkstra’s Shortest Path Algorithm • Let • N denotes set of nodes in the graph • each node needs to execute the algorithm • l (i, j) denotes non-negative cost for edge (i, j) • l (i, j) = ∞ if no edge connects i and j • s denotes this node (i.e. the node executing the algorithm to find the shortest path to all the other nodes in N) • for each node n !=s which is a member in the setN,let C(n) denotes cost of the path from s to node n • At each point during the execution of the algorithm, let M denotes the set of nodes whose routes has been found so far
Link State Route Calculation:Dijkstra’s Shortest Path Algorithm (cont.) M = {s} for each n in N - {s} C(n) = l(s, n) /* Costs of directly connected nodes */ while (M != N ) /* Add a node */ M = M union {w} such that C(w) is the minimum for all w in (N - M) for each n in (N - M) /* Recalculate costs */ C(n) = MIN(C(n), C (w) + l(w, n ))
Route Calculation: Explanation • start with M containing s • initialize table of costs using known costs to directly connected nodes • while M <> N • w: node reachable at lowest cost • update M : add w to M • update table of costs by considering the cost of reaching nodes through w • choose a new route to node n through w if total cost of going from s to w and then following link from w to n is less than old route to n • repeat until all nodes are incorporated in M
Example: Node A Executing the Algorithm 5 3 C B 2 5 3 2 F A 1 Itrn M B Path C Path D Path E Path F Path G Path 1 {A} 2 A-B 5 A-C 1 A-D Inf. Inf. 1 A-G 2 {A,D} 2 A-B 4 A-D-C 1 A-D 2 A-D-E Inf. 1 A-G 3 {A,D,G} 2 A-B 4 A-D-C 1 A-D 2 A-D-E Inf. 1 A-G 4 {A,B,D,G} 2 A-B 4 A-D-C 1 A-D 2 A-D-E Inf. 1 A-G 5 {A,B,D,E,G} 2 A-B 3 A-D-E-C 1 A-D 2 A-D-E 4 A-D-E-F 1 A-G 6 {A,B,C,D,E 2 A-B 3 A-D-E-C 1 A-D 2 A-D-E 4 A-D-E-F 1 A-G G} 7 {A,B,C,D,E 2 A-B 3 A-D-E-C 1 A-D 2 A-D-E 4 A-D-E-F 1 A-G F,G} 1 1 2 1 E D G
Link State Routing Summary • One of the oldest algorithm for routing • Finds “Shortest Path” by developing paths in order of increasing length • Requires each node to have complete information about the network • Nodes exchange information with all other nodes in the network • Known to converge quickly under static conditions • Does not generate much network traffic
Metrics for Link Cost • Simplest method is to assign 1 to each link • Original ARPANET metric • link cost = number of packets enqueued on each link • This moves packets toward shortest queue not the destination!! • took neither latency or bandwidth into consideration • Newer ARPANET metric • link cost = average delay over some time period • stamp each incoming packet with its arrival time (AT) • record departure time (DT) • when link-level ACK arrives, compute Delay = (DT - AT) + Transmit + Latency • Transmit and latency are static for the link • if timeout, reset DT to departure time for retransmission • Fine Tuning (pp 287, 289)