11/19/12 The Problem: Distributed Methods for Finding P aths in Networks 4 L2 L0 B D 19 L1 15 11 13 A Link costs 7 C E 5 6.02 Fall 2012 • Addressing (how to name nodes?) Lecture #19 – Unique identifier for global addressing – Link name for neighbors • addressing, forwarding, routing • Forwarding (how does a switch process a packet?) • distance-vector routing • Routing (building and updating data structures to ensure • link-state routing that forwarding works) [Today: no failures] • Functions of the network layer 6.02 Fall 2012 Lecture 19, Slide #1 6.02 Fall 2012 Lecture 19, Slide #2 Forwarding Shortest Path Routing 4 Switch B D 19 15 11 13 A (Assume all costs ≥ 0) 7 C E • Core function is conceptually simple 5 – lookup(dst_addr) in routing table returns route (i.e., outgoing link ) for packet • Each node wants to find the path with minimum total cost – enqueue(packet, link_queue) to other nodes – send(packet) along outgoing link – We use the term “shortest path” even though we’re interested • And do some bookkeeping before enqueue in min cost (and not min #hops) • Several possible distributed approaches – Decrement hop limit (TTL); if 0, discard packet – Recalculate checksum (in IP, header checksum) – Vector protocols, esp. distance vector (DV) – Link-state protocols (LS) 6.02 Fall 2012 Lecture 19, Slide #3 6.02 Fall 2012 Lecture 19, Slide #4 1
11/19/12 Routing Table Structure Distributed Routing: A Common Plan • 4 Determining live neighbors L2 L0 B D 19 – Common to both DV and LS protocols L1 – HELLO protocol (periodic) • Send HELLO packet to each neighbor to let them know who’s at the 15 11 13 A end of their outgoing links • Use received HELLO packets to build a list of neighbors containing an information tuple for each link: (timestamp, neighbor addr, link) 7 • Repeat periodically. Don’t hear anything for a while � link is down, C E 5 so remove from neighbor list. Routing table @ node B • Advertisement step (periodic) – Send some information to all neighbors Destination Link (next-hop) Cost – Used to determine connectivity & costs to reachable nodes ROUTE A L1 18 • Integration step B ‘Self’ 0 – Compute routing table using info from advertisements C L1 11 – Dealing with stale data D L2 4 ROUTE E L1 16 6.02 Fall 2012 Lecture 19, Slide #5 6.02 Fall 2012 Lecture 19, Slide #6 Distance-Vector Routing DV Example: round 2 {‘A’: (L0,19), {‘B’: (L0,4), • DV advertisement ‘B’: (None,0), ‘C’: (L1,15), – Send info from routing table entries: (dest, cost) ‘C’: (L1,11), ‘D’: (None,0), ‘D’: (L2,4) ‘E’: (L2,13) – Initially just (self,0) } } • DV integration step [Bellman-Ford] 4 L0 B L2 L0 D – For each (dest,cost) entry in neighbor’s advertisement 19 L1 L1 L2 • Account for cost to reach neighbor: (dest,my_cost) L0 • my_cost = cost_in_advertisement + link_cost 15 A 11 13 {‘A’: (None,0) , – Are we currently sending packets for dest to this neighbor? ‘B’: (L0,19), L1 ‘C’: (L1,7) L1 L1 • See if link matches what we have in routing table 7 L2 } L0 C E • If so, update cost in routing table to be my_cost L0 L3 5 – Otherwise, is my_cost smaller than existing route? {‘A’: (L0,7), {‘C’: (L0,5), • If so, neighbor is offering a better deal! Use it… Node A: update routes to B C , D C , E C ‘B’: (L1,11), ‘D’: (L1,13), • update routing table so that packets for dest are sent to this Node B: update routes to A C , E C ‘C’: (None,0), ‘E’: (None,0) neighbor Node C: no updates ‘D’: (L2,15), } Node D: update routes to A C ‘E’: (L3,5) Node E: update routes to A C , B C } 6.02 Fall 2012 Lecture 19, Slide #11 6.02 Fall 2012 Lecture 19, Slide #13 2
11/19/12 DV Example: round 3 DV Example: Break a Link {‘A’: (L1,18), {‘A’: (L1,22), {‘A’: (L1,18), {‘A’: (L1,22), ‘B’: (None,0), ‘B’: (L0,4), ‘B’: (None,0), ‘B’: (L0,4), ‘C’: (L1,11), ‘C’: (L1,15), ‘C’: (L1,11), ‘C’: (L1,15), ‘D’: (L2,4), ‘D’: (None,0), ‘D’: (L2,4), ‘D’: (None,0), ‘E’: (L1,16) ‘E’: (L2,13) ‘E’: (L1,16) ‘E’: (L2,13) } } } } 4 4 L0 B L2 L0 D L0 L2 L0 B D 19 19 L1 L1 L1 L2 L1 L2 L0 L 0 × 15 15 A 11 13 A 11 13 {‘A’: (N one,0), {‘A’: (None,0), ‘B’: (L 1,18), ‘B’: (L1,18), L1 L 1 ‘C’: (L 1,7), L1 L1 ‘C’: (L1,7), L1 L1 7 7 L2 L2 ‘D’: (L 1,22), L0 ‘D’: (L1,22), L0 E C E L0 C L0 L3 5 L3 5 ‘E’: (L 1,12) ‘E’: (L1,12) } } {‘A’: (L0,7), {‘A’: (L0,12), {‘A’: (L0,7), {‘A’: (L0,12), Node A: no updates ‘B’: (L1,11), ‘B’: (L0,16), ‘B’: (L1,11), ‘B’: (L0,16), Node B: no updates ‘C’: (None,0), ‘C’: (L0,5), When link breaks: eliminate routes ‘C’: (None,0), ‘C’: (L0,5), Node C: no updates ‘D’: (L2,15), ‘D’: (L1,13), that use that link. ‘D’: (L2,15), ‘D’: (L1,13), Node D: no updates ‘E’: (L3,5) ‘E’: (None,0) ‘E’: (L3,5) ‘E’: (None,0) Node E: no updates } } } } 6.02 Fall 2012 Lecture 19, Slide #14 6.02 Fall 2012 Lecture 19, Slide #15 DV Example: round 4 DV Example: round 5 {‘A’: (None,∞), {‘A’: (L1,22), {‘A’: (L0,19), {‘A’: (L1,22), ‘B’: (None,0), ‘B’: (L0,4), ‘B’: (None,0), ‘B’: (L0,4), ‘C’: (None,∞), ‘C’: (L1,15), ‘C’: (L2,19), ‘C’: (L1,15), ‘D’: (L2,4), ‘D’: (None,0), ‘D’: (L2,4), ‘D’: (None,0), ‘E’: (None,∞) ‘E’: (L2,13) ‘E’: (L2,17) ‘E’: (L2,13) } } } } 4 4 L0 B L2 L0 D L0 B L2 L0 D 19 19 Update cost L1 L1 L1 L2 L1 L2 L 0 L0 × × 15 15 A 11 13 A 11 13 {‘A’: (None,0), {‘A’: (None,0 ), ‘B’: (L1,18), ‘B’: (L1, ∞) , L1 L 1 ‘C’: (L1,7), L1 L1 ‘C’: (L1,7), L1 L1 7 7 L2 L2 ‘D’: (L1,22), L0 ‘D’: (L1,22) , L0 L0 C E C E L0 L3 5 L3 5 ‘E’: (L1,12) ‘E’: (L1,12) } } {‘A’: (L0,7), {‘A’: (L0,12), {‘A’: (L0,7), {‘A’: (L0,12), Node A: update cost to B C Node A: update route to B B ‘B’: (None,∞), ‘B’: (L0,16), ‘B’: (L2,19), ‘B’: (L1,17), Node B: update routes to A A , C D , E D Node B: no updates ‘C’: (None,0), ‘C’: (L0,5), ‘C’: (None,0), ‘C’: (L0,5), Node C: update routes to B D ‘D’: (L2,15), ‘D’: (L1,13), Node C: no updates ‘D’: (L2,15), ‘D’: (L1,13), Node D: no updates ‘E’: (L3,5) ‘E’: (None,0) Node D: no updates ‘E’: (L3,5) ‘E’: (None,0) Node E: update routes to B D Node E: no updates } } } } 6.02 Fall 2012 Lecture 19, Slide # 16 6.02 Fall 2012 Lecture 19, Slide #17 3
11/19/12 DV Example: final state Correctness & P erformance {‘A’: (L0,19), {‘A’: (L1,22), ‘B’: (None,0), ‘B’: (L0,4), • Optimal substructure property fundamental to correctness of ‘C’: (L2,19), ‘C’: (L1,15), both Bellman-Ford and Dijkstra’s shortest path algorithms ‘D’: (L2,4), ‘D’: (None,0), – Suppose shortest path from X to Y goes through Z. ‘E’: (L2,17) ‘E’: (L 2,13) Then, the sub-path from X to Z must be a shortest } } 4 L0 B L2 L0 D path. 19 • Proof of Bellman-Ford via induction on number of L1 L1 L 2 L0 × walks on shortest (min-cost) paths 15 A 11 1 3 {‘A’: (No ne,0), – Easy when all costs > 0 and synchronous model (see notes) ‘B’: (L0 ,19), L1 ‘C’: (L1 ,7), L1 L 1 – Harder with distributed async model (not in 6.02) 7 L2 ‘D’: (L1 ,22), L0 L0 C E • How long does it take for distance-vector routing L3 5 ‘E’: (L1 ,12) protocol to converge ? } {‘A’: (L0,7), {‘A’: (L 0,12), Node A: no updates ‘B’: (L2,19), ‘B’: (L 1,17), – Time proportional to largest number of hops Node B: no updates ‘C’: (None,0), ‘C’: (L0,5), considering all the min-cost paths Node C: no updates ‘D’: (L2,15), ‘D’: (L1,13), Node D: no updates ‘E’: (L3,5) ‘E’: (None,0) Node E: no updates } } 6.02 Fall 2012 Lecture 19, Slide # 18 6.02 Fall 2012 Lecture 19, Slide #19 LSA Flooding Link-State Routing LSA: [F, seq, (G, 8), (C, 2)] • Advertisement step 6 2 A C F – Send information about its links to its neighbors (aka link state advertisement or LSA): 4 [seq#, [(nbhr1, linkcost1), (nbhr2, linkcost2), …] 6 7 8 E – Do it periodically (liveness, recover from lost LSAs) 0 2 • Integration B D G – If seq# in incoming LSA > seq# in saved LSA for source node: 5 update LSA for node with new seq#, neighbor list rebroadcast LSA to neighbors ( � flooding ) • Periodically originate LSA – Remove saved LSAs if seq# is too far out-of-date • LSA travels each link in each direction – Result: Each node discovers current map of the network – Don’t bother with figuring out which link LSA came from • Build routing table • Termination: each node rebroadcasts LSA exactly once – Periodically each node runs the same shortest path algorithm over its map (e.g., Dijkstra’s alg) – Use sequence number to determine if new, save latest seq – If each node implements computation correctly and each • Multiple opportunities for each node to hear any given LSA node has the same map, then routing tables will be correct – Time required: number of links to cross network 6.02 Fall 2012 Lecture 19, Slide #20 6.02 Fall 2012 Lecture 19, Slide #21 4
Recommend
More recommend