Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 The Fundamentals of Routing EE122 Fall 2011 Scott Shenker Materials with thanks to Jennifer Rexford, Ion Stoica,

Similar presentations


Presentation on theme: "1 The Fundamentals of Routing EE122 Fall 2011 Scott Shenker Materials with thanks to Jennifer Rexford, Ion Stoica,"— Presentation transcript:

1 1 The Fundamentals of Routing EE122 Fall 2011 Scott Shenker http://inst.eecs.berkeley.edu/~ee122/ Materials with thanks to Jennifer Rexford, Ion Stoica, Vern Paxson and other colleagues at Princeton and UC Berkeley

2 Announcements 194 is set up: 4 units: CCN: 25571 –Everyone should be off wait list by now…. –Waiting for more accounts oSend me email if you need one…. –Will set up bspace for 194 to hand in homework Open today with questions about project 1 Hope you all handed in HW1 –HW2 out on Wednesday Survey will be available after Wednesday’s class 2

3 Questions about Project 1 (for Shaddi) 3

4 Warning…. This lecture contains detailed calculations Prolonged exposure may induce drowsiness Do not operate heavy machinery while listening 4

5 Where Are We? Motivated our basic design decisions –Best-effort, packet-switching, blah, blah, blah Last lecture: how to build reliable transport on top This lecture: how to build the network itself Basic Task: deliver packets –Need to route them, from anywhere to anywhere Today, we focus on routing 5

6 The Traditional Routing Curriculum Learning switches Link-state routing –Dijkstra’s Algorithm Distance-vector routing –Bellman-Ford 6

7 I have some bad news….. Don’t have anything interesting to say about routing Will follow standard curriculum –Much of it covered in the text But will focus more on principles than details Will work through two algorithms, but details may wait until Wednesday…..134 slides! –Let’s just see how timing goes –If you don’t want to be bored, ask questions! 7

8 Remember…. Goal of the first portion of course is conceptual Ignore real networks Think about the basic concepts That’s where we are. Later will deal with reality… 8

9 9 Basics of Routing and Forwarding

10 Addressing (at a conceptual level) Assume all hosts have unique IDs No particular structure to those IDs Later in course will talk about real IP addressing 10

11 Packets (at a conceptual level) Assume packet headers contain: –Source ID, Destination ID, and perhaps other information 11 Destination Identifier Source Identifier Payload Why include this?

12 Switches/Routers Multiple ports (attached to other switches or hosts) Ports are typically duplex (incoming and outgoing) 12 incoming linksoutgoing links Switch

13 Example of Network Graph 13 Six ports, incoming/outgoing Four ports, incoming/outgoing

14 A Variety of Networks ISPs: carriers –Backbone –Edge –Border (to other ISPs) Enterprises: companies, universities –Core –Edge –Border (to outside) Datacenters: massive collections of machines –Top-of-Rack –Aggregation and Core –Border (to outside) 14

15 UUNET’s North American Network 15

16 Level3’s American Network 16

17 Enterprise Network 17

18 Partial Datacenter Network 18

19 Switches Enterprise/Edge: typically 24 to 48 ports Aggregation switches: 192 ports or more Backbone: typically fewer ports Border: typically very few ports 19

20 Forwarding Decisions When packet arrives, must choose outgoing port Decision is based on routing state (table) in switch 20 incoming linksoutgoing links Switch Consider packet header and routing table

21 Forwarding Decisions When packet arrives.. –Must decide which outgoing port to use –In single transmission time –Forwarding decisions must be simple Routing state dictates where to forward packets –Assume decisions are deterministic Global routing state means collection of routing state in each of the routers –Will focus on where this routing state comes from –But first, a few preliminaries…. 21

22 Forwarding vs Routing Forwarding: “data plane” –Directing a data packet to an outgoing link –Individual router using routing state Routing: “control plane” –Computing paths the packets will follow –Routers talking amongst themselves –Jointly creating the routing state Two very different timescales…. 22

23 23 Validity of Routing State

24 “Valid” Routing State Global routing state is “valid” if it produces forwarding decisions that always deliver packets to their destinations –Valid is my terminology, not standard Goal of routing protocols: compute valid state –But how can you tell if routing state if valid? 24

25 Necessary and Sufficient Condition Global routing state is valid if and only if: –There are no dead ends (other than destination) –There are no loops A dead end is when there is no outgoing port –A packet arrives, but the forwarding decision does not yield any outgoing port A loop is when a packet cycles around the same set of nodes forever 25

26 Necessary: Obvious If you run into a deadend before hitting destination, you’ll never reach the destination If you run into a loop, you’ll never reach destination –With deterministic forwarding, once you loop, you’ll loop forever (assuming routing state is static) 26

27 Wandering Packets 27 Packet reaches deadend and stops Packet falls into loop and never reaches destination

28 Sufficient: Easy Assume no deadends, no loops Packet must keep wandering, without repeating –If ever enter same switch from same port, will loop –Because forwarding decisions are deterministic Only a finite number of possible ports for it to visit –It cannot keep wandering forever without looping –Must eventually hit destination 28

29 The “Secret” of Routing Avoiding deadends is easy Avoiding loops is hard The key difference between routing protocols is how they avoid loops! –Don’t focus on details of mechanisms –Just ask “how are loops avoided?” Will return to this later…. 29

30 Making Forwarding Decisions Map PacketState+RoutingState into OutgoingPort –At line rates….. Packet State: –Destination ID –Source ID –Incoming Port (from switch, not packet) –Other packet header information? Routing State: –Stored in router 30

31 Forwarding Decision Dependencies Must depend on destination Could also depend on : –Source: requires n 2 state –Input port: not clear what this buys you –Other header information: let’s ignore for now We will focus only on destination-based routing –But first consider the alternative 31

32 Source/Destination-Based Routing 32 Paths from two different sources (to same destination) can be very different

33 Destination-Based Routing 33 Paths from two different sources (to same destination) must coincide once they overlap

34 Destination-Based Routing Paths to same destination never cross Once paths to destination meet, they never split Set of paths to destination create a “delivery tree” –Must cover every node exactly once –Spanning Tree rooted at destination 34

35 A “Delivery Tree” for a Destination 35

36 Checking Validity of Routing State Focus only on a single destination –Ignore all other routing state Mark outgoing port with arrow –There can only be one at each node Eliminate all links with no arrows Look at what’s left…. 36

37 Example 1 37

38 Pick Destination 38

39 Put Arrows on Outgoing Ports 39

40 Remove Unused Links 40 Leaves Spanning Tree: Valid

41 Second Example 41

42 Second Example 42 Is this valid?

43 Lesson…. Very easy to check validity of routing state for a particular destination Deadends are obvious –Node without outgoing arrow Loops are obvious –Disconnected from rest of graph 43

44 44 Computing Routing State

45 Forms of Route Computation Learn from observing…. –Not covered in your reading Centralized computation –One node has the entire network map Pseudo-centralized computation –All nodes have the entire network map Distributed computation –No one has the entire network map 45

46 How Can You Avoid Loops? Restrict topology to spanning tree –If the topology has no loops, packets can’t loop! Central computation –Can make sure no loops Minimizing metric in distributed computation –Loops are never the solution to a minimization problem 46

47 47 Self-Learning on Spanning Tree

48 Easiest Way to Avoid Loops Use a topology where loops are impossible! Take arbitrary topology Build spanning tree (algorithm covered later) –Ignore all other links (as before) Only one path to destinations on spanning trees Use “learning switches” to discover these paths –No need to compute routes, just observe them 48

49 Consider previous graph 49

50 A Spanning Tree 50

51 Another Spanning Tree 51

52 Yet Another Spanning Tree 52

53 Flooding on a Spanning Tree If you want to send a packet that will reach all nodes, then switches can use the following rule: –Ignoring all ports not on spanning tree! Originating switch sends “flood” packet out all ports When a “flood” packet arrives on one incoming port, send it out all other ports 53

54 Flooding on Spanning Tree 54

55 Flooding on Spanning Tree (Again) 55

56 Flooding on a Spanning Tree This works because the lack of loops prevents the flooding from cycling back on itself Eventually all nodes will be covered, exactly once 56

57 This Enables Learning! There is only one path from source to destination Each switch can learn how to reach a another node by remembering where its flooding packets came from! If flood packet from Node A entered switch from port 4, then to reach Node A, switch sends packets out port 4 57

58 Learning from Flood Packets 58 Node A Node A can be reached through this port Node A can be reached through this port Once a node has sent a flood message, all other switches know how to reach it….

59 General Approach Flood first packet All switches learn where you are When destination responds, all switches learn where it is… Done. 59

60 60 Self-Learning Switch When a packet arrives Inspect source ID, associate with incoming port Store mapping in the switch table Use time-to-live field to eventually forget mapping A B C D Packet tells switch how to reach A.

61 61 Self Learning: Handling Misses When packet arrives with unfamiliar destination Forward packet out all other ports Response will teach switch about that destination A B C D When in doubt, shout!

62 62 General Rule When switch receives a packet: index the switch table using destination ID if entry found for destination { if dest on port from which packet arrived then drop packet else forward packet on port indicated } else flood forward on all but the interface on which the frame arrived Why do this?

63 Summary of Learning Approach Avoids loop by restricting to spanning tree This makes flooding possible Flooding allows packet to reach destination And in the process switches learn how to reach source of flood No route “computation” 63

64 Weaknesses of This Approach? Requires loop-free topology (Spanning Tree) Slow to react to failures (entries time out) Very little control over paths Spanning Trees suck. 64

65 On to other routing techniques… 65

66 66 A Little Test How many of you did the reading?

67 The Task Remove sheet of paper from beanbag, but do not look at sheet of paper until I say so You will have five minutes to complete this task Each sheet says: You are node X You are connected to nodes Y,Z Your job: find route from source (node 1) to destination (node 40) in five minutes 67

68 Ground Rules You may not: –Leave your seat (but you can stand) –Pass your sheet of paper –Let anyone copy your sheet of paper You may: –Ask nearby friends for advice –Shout to other participants (anything you want) –Curse your instructor (sotto voce) You must: Try 68

69 Go! 69

70 1 1636725 10 1953438 29 33153923 14 923511 22 32262137 3 2812304 27 20311824 40 817613

71 71 5 Minute Break Questions Before We Proceed?

72 How Can You Avoid Loops? Restrict topology to spanning tree Central computation (can make sure no loops) Minimizing metric in distributed computation Any other techniques? 72

73 Organization for Rest of Lecture Link-state routing Distance-vector routing Goal of today: basic idea –May review details on Wednesday –Definitely go over details in section 73

74 74 Link-State Details in Section

75 Another Approach to Loop-Avoidance If one has a picture of the entire network, can compute routing state that does not produce loops This route computation can be done in many ways –Here we will review Dijkstra’s algorithm briefly –But that’s just because it is expected from such courses oSnore….. The real question is, how do you get picture of entire network? 75

76 76 Link-State Routing Is Conceptually Simple Each router keeps track of its incident links Each router broadcasts the link state –To give every router a complete view of the graph Each router runs Dijkstra’s algorithm –Compute shortest paths, then construct forwarding table Example protocols –Open Shortest Path First (OSPF) –Intermediate System – Intermediate System (IS-IS) Challenges: scaling, transient disruptions

77 77 Link State Routing Each node floods its local information Each node then knows entire network topology Host A Host B Host E Host D Host C N1 N2 N3 N4 N5 N7N6

78 78 Link State: Each Node Has Global View Host A Host B Host E Host D Host C N1 N2 N3 N4 N5 N7N6 A B E D C A B E D C A B E D C A B E D C A B E D C A B E D C A B E D C

79 How to Compute Routes Each node should have same global view They each compute their own routing tables Using exactly the same algorithm Can use any algorithm that avoids loops Computing shortest paths is one such algorithm –Associate a “cost” with each link –Don’t worry what it stands for…. 79

80 Dijkstra’s Shortest Path Algorithm INPUT: –Network topology (graph), with link costs OUTPUT: –Least cost paths from one node to all other nodes –Produces “tree” of routes oDifferent from what we talked about before oPrevious tree was rooted at destination oThis is rooted at source oBut shortest paths are reversible! 80

81 “Least Cost” Routes No sensible cost metric will be minimized by traversing a loop “Least cost” routes an easy way to avoid loops Least cost routes are also “destination-based” –i.e., do not depend on the source –Why is this? Therefore, least-cost paths form a spanning tree 81

82 82 Example A E D CB F 2 2 1 3 1 1 2 5 3 5

83 83 Notation c(i,j): link cost from node i to j; cost infinite if not direct neighbors; ≥ 0 D(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 A E D CB F 2 2 1 3 1 1 2 5 3 5 Source

84 84 Dijsktra’s Algorithm 1 Initialization: 2 S = {A}; 3 for all nodes v 4 if v adjacent to A 5 then D(v) = c(A,v); 6 else D(v) = ; 7 8 Loop 9 find w not in S such that D(w) is a minimum; 10 add w to S; 11 update D(v) for all v adjacent to w and not in S: 12 if D(w) + c(w,v) < D(v) then // w gives us a shorter path to v than we’ve found so far 13 D(v) = D(w) + c(w,v); p(v) = w; 14 until all nodes in S; c(i,j): link cost from node i to j D(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

85 85 Example: Dijkstra’s Algorithm Step 0 1 2 3 4 5 start S A D(B),p(B) 2,A D(C),p(C) 5,A D(D),p(D) 1,A D(E),p(E) D(F),p(F) A E D CB F 2 2 1 3 1 1 2 5 3 5 1 Initialization: 2 S = {A}; 3 for all nodes v 4 if v adjacent to A 5 then D(v) = c(A,v); 6 else D(v) = ; …

86 86 Example: Dijkstra’s Algorithm Step 0 1 2 3 4 5 start S A D(B),p(B) 2,A D(C),p(C) 5,A … 8 Loop 9 find w not in S s.t. D(w) is a minimum; 10 add w to S; 11update D(v) for all v adjacent to w and not in S: 12If D(w) + c(w,v) < D(v) then 13 D(v) = D(w) + c(w,v); p(v) = w; 14 until all nodes in S; A E D CB F 2 2 1 3 1 1 2 5 3 5 D(D),p(D) 1,A D(E),p(E) D(F),p(F)

87 87 Example: Dijkstra’s Algorithm Step 0 1 2 3 4 5 start S A AD D(B),p(B) 2,A D(C),p(C) 5,A D(D),p(D) 1,A D(E),p(E) D(F),p(F) A E D CB F 2 2 1 3 1 1 2 5 3 5 … 8 Loop 9 find w not in S s.t. D(w) is a minimum; 10 add w to S; 11update D(v) for all v adjacent to w and not in S: 12If D(w) + c(w,v) < D(v) then 13 D(v) = D(w) + c(w,v); p(v) = w; 14 until all nodes in S;

88 88 Example: Dijkstra’s Algorithm Step 0 1 2 3 4 5 start S A AD D(B),p(B) 2,A D(C),p(C) 5,A 4,D D(D),p(D) 1,A D(E),p(E) 2,D D(F),p(F) A E D CB F 2 2 1 3 1 1 2 5 3 5 … 8 Loop 9 find w not in S s.t. D(w) is a minimum; 10 add w to S; 11update D(v) for all v adjacent to w and not in S: 12If D(w) + c(w,v) < D(v) then 13 D(v) = D(w) + c(w,v); p(v) = w; 14 until all nodes in S;

89 89 Example: Dijkstra’s Algorithm Step 0 1 2 3 4 5 start S A AD ADE D(B),p(B) 2,A D(C),p(C) 5,A 4,D 3,E D(D),p(D) 1,A D(E),p(E) 2,D D(F),p(F) 4,E A E D CB F 2 2 1 3 1 1 2 5 3 5 … 8 Loop 9 find w not in S s.t. D(w) is a minimum; 10 add w to S; 11update D(v) for all v adjacent to w and not in S: 12If D(w) + c(w,v) < D(v) then 13 D(v) = D(w) + c(w,v); p(v) = w; 14 until all nodes in S;

90 90 Example: Dijkstra’s Algorithm Step 0 1 2 3 4 5 start S A AD ADE ADEB D(B),p(B) 2,A D(C),p(C) 5,A 4,D 3,E D(D),p(D) 1,A D(E),p(E) 2,D D(F),p(F) 4,E A E D CB F 2 2 1 3 1 1 2 5 3 5 … 8 Loop 9 find w not in S s.t. D(w) is a minimum; 10 add w to S; 11update D(v) for all v adjacent to w and not in S: 12If D(w) + c(w,v) < D(v) then 13 D(v) = D(w) + c(w,v); p(v) = w; 14 until all nodes in S;

91 91 Example: Dijkstra’s Algorithm Step 0 1 2 3 4 5 start S A AD ADE ADEB ADEBC D(B),p(B) 2,A D(C),p(C) 5,A 4,D 3,E D(D),p(D) 1,A D(E),p(E) 2,D D(F),p(F) 4,E A E D C B F 2 2 1 3 1 1 2 5 3 5 … 8 Loop 9 find w not in S s.t. D(w) is a minimum; 10 add w to S; 11update D(v) for all v adjacent to w and not in S: 12If D(w) + c(w,v) < D(v) then 13 D(v) = D(w) + c(w,v); p(v) = w; 14 until all nodes in S;

92 92 Example: Dijkstra’s Algorithm Step 0 1 2 3 4 5 start S A AD ADE ADEB ADEBC ADEBCF D(B),p(B) 2,A D(C),p(C) 5,A 4,D 3,E D(D),p(D) 1,A D(E),p(E) 2,D D(F),p(F) 4,E A E D CB F 2 2 1 3 1 1 2 5 3 5 … 8 Loop 9 find w not in S s.t. D(w) is a minimum; 10 add w to S; 11update D(v) for all v adjacent to w and not in S: 12If D(w) + c(w,v) < D(v) then 13 D(v) = D(w) + c(w,v); p(v) = w; 14 until all nodes in S;

93 93 Example: Dijkstra’s Algorithm Step 0 1 2 3 4 5 start S A AD ADE ADEB ADEBC ADEBCF D(B),p(B) 2,A D(C),p(C) 5,A 4,D 3,E D(D),p(D) 1,A D(E),p(E) 2,D D(F),p(F) 4,E A E D CB F 2 2 1 3 1 1 2 5 3 5 To determine path A  C (say), work backward from C via p(v)

94 94 Running Dijkstra at node A gives the shortest path from A to all destinations We then construct the forwarding table The Forwarding Table A E D CB F 2 2 1 3 1 1 2 5 3 5 DestinationLink B(A,B) C(A,D) D E F

95 Complexity How much processing does running the Dijkstra algorithm take? Assume a network consisting of N nodes –Each iteration: check all nodes w not in S –N(N+1)/2 comparisons: O(N 2 ) –More efficient implementations: O(N log(N)) 95

96 96 Flooding the Topology Information Each router sends information out its ports The next node sends it out through all of its ports –Except the one where the information arrived –Need to remember previous msgs, suppress duplicates! X A CBD (a) XA C BD (b) X A CB D (c) XA CBD (d)

97 Making Flooding Reliable Reliable flooding –Ensure all nodes receive link-state information –Ensure all nodes use the latest version Challenges –Packet loss –Out-of-order arrival Solutions –Acknowledgments and retransmissions –Sequence numbers How can it still fail? 97

98 When to Initiate Flood? Topology change –Link or node failure –Link or node recovery Configuration change –Link cost change –Potential problems with making cost dynamic! Periodically –Refresh the link-state information –Typically (say) 30 minutes –Corrects for possible corruption of the data 98

99 99 Convergence Getting consistent routing information to all nodes –E.g., all nodes having the same link-state database Forwarding is consistent after convergence –All nodes have the same link-state database –All nodes forward packets on same paths

100 100 Convergence Delay Time elapsed before every router has a consistent picture of the network Sources of convergence delay –Detection latency –Flooding of link-state information –Recomputation of forwarding tables –Storing forwarding tables Performance during convergence period –Lost packets due to blackholes and TTL expiry –Looping packets consuming resources –Out-of-order packets reaching the destination Very bad for VoIP, online gaming, and video

101 101 Inconsistent link-state database –Some routers know about failure before others –The shortest paths are no longer consistent –Can cause transient forwarding loops Transient Disruptions A E D CB F A E D CB F A and D think that this is the path to C E thinks that this is the path to C Loop!

102 102 Reducing Convergence Delay Faster detection –Smaller hello timers –Link-layer technologies that can detect failures Faster flooding –Flooding immediately –Sending link-state packets with high-priority Faster computation –Faster processors on the routers –Incremental Dijkstra algorithm Faster forwarding-table update –Data structures supporting incremental updates

103 103 Scaling Link-State Routing Overhead of link-state routing –Flooding link-state packets throughout the network –Running Dijkstra’s shortest-path algorithm –Becomes unscalable when 100s of routers Introducing hierarchy through “areas” Area 0 Area 1 Area 2 Area 3 Area 4 area border router

104 104 Distance-Vector Details in Section

105 Distributed Computation of Routes More scalable than Link-State –No global flooding Each node computing the outgoing port based on: –Local information (who it is connected to) –Paths advertised by neighbors 105

106 Distributed Computation 106 I am one hop away I am two hops away I am three hops away

107 Loops in a Distributed Computation If the nodes choose their paths according to different criterion, then loops can occur Example –Node A is minimizing hop count –Node B is minimizing latency –Node C is maximizing capacity –Node D is minimizing price Any of those goals are fine, if globally adopted –Only a problem when nodes use different criteria Any criteria that results in destination-based routing is fine…. 107

108 108 Distance Vector Routing Each router knows the links to its neighbors –Does not flood this information to the whole network Each router has provisional “shortest path” –E.g.: Router A: “I can get to router B with cost 11 via next hop router D” Routers exchange this information with their neighboring routers –Again, no flooding the whole network Routers update their idea of the best path using info from neighbors This iterative process converges with set of shortest paths

109 109 Information Flow in Distance Vector Host A Host B Host E Host D Host C N1 N2 N3 N4 N5 N7N6

110 110 Information Flow in Distance Vector Host A Host B Host E Host D Host C N1 N2 N3 N4 N5 N7N6

111 111 Information Flow in Distance Vector Host A Host B Host E Host D Host C N1 N2 N3 N4 N5 N7N6

112 Why Is This Different From Flooding? 112

113 Bellman-Ford Algorithm INPUT: –Link costs to each neighbor –Not full topology OUTPUT: –Next hop to each destination and the corresponding cost –Does not give the complete path to the destination 113

114 114 Bellman-Ford - Overview Each router maintains a table –Best known distance from X to Y, via Z as next hop = D Z (X,Y) Each local iteration caused by: –Local link cost change –Message from neighbor Notify neighbors only if least cost path to any destination changes –Neighbors then notify their neighbors if necessary wait for (change in local link cost or msg from neighbor) recompute distance table if least cost path to any dest has changed, notify neighbors Each node:

115 Bellman-Ford - Overview Each router maintains a table –Row for each possible destination –Column for each directly-attached neighbor to node –Entry in row Y and column Z of node X  best known distance from X to Y, via Z as next hop = D Z (X,Y) A C 1 2 7 B D 3 1 BC B28 C37 D48 Node A Neighbor (next-hop) Destinations D C (A, D)

116 Bellman-Ford - Overview Each router maintains a table –Row for each possible destination –Column for each directly-attached neighbor to node –Entry in row Y and column Z of node X  best known distance from X to Y, via Z as next hop = D Z (X,Y) A C 1 2 7 B D 3 1 BC B28 C37 D48 Node A Smallest distance in row Y = shortest Distance of A to Y, D(A, Y)

117 117 Distance Vector Algorithm (cont’d) 1 Initialization: 2 for all neighbors V do 3 if V adjacent to A 4 D(A, V) = c(A,V); 5 else 6 D(A, V) = ∞; 7 send D(A, Y) to all neighbors loop: 8 wait (until A sees a link cost change to neighbor V /* case 1 */ 9 or until A receives update from neighbor V) /* case 2 */ 10 if (c(A,V) changes by ±d) /*  case 1 */ 11 for all destinations Y that go through V do 12 D V (A,Y) = D V (A,Y) ± d 13 else if (update D(V, Y) received from V) /*  case 2 */ /* shortest path from V to some Y has changed */ 14 D V (A,Y) = D V (A,V) + D(V, Y); /* may also change D(A,Y) */ 15 if (there is a new minimum for destination Y) 16 send D(A, Y) to all neighbors 17 forever c(i,j): link cost from node i to j D Z (A,V): cost from A to V via Z D(A,V): cost of A’s best path to V

118 Example: 1 st Iteration (C  A) A C 1 2 7 B D 3 1 BC B28 C∞7 D∞8 Node A ACD A2∞∞ C∞1∞ D∞∞3 Node B Node C ABD A 7∞∞ B∞1∞ D∞∞1 BC A∞∞ B3∞ C∞1 Node D 7loop: … 13 else if (update D(A, Y) from C) 14 D C (A,Y) = D C (A,C) + D(C, Y); 15 if (new min. for destination Y) 16 send D(A, Y) to all neighbors 17 forever D C (A, B) = D C (A,C) + D(C, B) = 7 + 1 = 8 D C (A, D) = D C (A,C) + D(C, D) = 7 + 1 = 8

119 Example: 1 st Iteration (B  A) A C 1 2 7 B D 3 1 BC B28 C37 D58 Node A ACD A2∞∞ C∞1∞ D∞∞3 Node B Node C ABD A 7∞∞ B∞1 D∞∞1 Node D 7loop: … 13 else if (update D(A, Y) from B) 14 D B (A,Y) = D B (A,B) + D(B, Y); 15 if (new min. for destination Y) 16 send D(A, Y) to all neighbors 17 forever D B (A, C) = D B (A,B) + D(B, C) = 2 + 1 = 3 D B (A, D) = D B (A,B) + D(B, D) = 2 + 3 = 5 BC A∞∞ B3∞ C∞1

120 Example: End of 1 st Iteration A C 1 2 7 B D 3 1 BC B28 C37 D58 Node A Node B Node C ABD A 7 3∞ B914 D∞41 Node D BC A58 B32 C41 End of 1 st Iteration All nodes knows the best two-hop paths ACD A 2 3∞ C914 D∞23

121 Example: 2 nd Iteration (A  B) A C 1 2 7 B D 3 1 BC B28 C37 D58 Node A Node B Node C ABD A 7 3∞ B914 D∞41 Node D BC A58 B32 C41 ACD A 2 3∞ C514 D723 7loop: … 13 else if (update D(B, Y) from A) 14 D A (B,Y) = D A (B,A) + D(A, Y); 15 if (new min. for destination Y) 16 send D(B, Y) to all neighbors 17 forever D A (B, C) = D A (B,A) + D(A, C) = 2 + 3 = 5 D A (B, D) = D A (B,A) + D(A, D) = 2 + 5 = 7

122 Example: End of 2 nd Iteration A C 1 2 7 B D 3 1 BC B28 C37 D48 Node A ACD A 2 311 C514 D723 Node B Node C ABD A 7 36 B914 D1241 Node D BC A54 B32 C41 End of 2 nd Iteration All nodes knows the best three-hop paths

123 Example: End of 3rd Iteration A C 1 2 7 B D 3 1 BC B28 C37 D48 Node A ACD A 2 36 C514 D723 Node B Node C ABD A 7 35 B914 D1141 Node D BC A54 B32 C41 End of 2 nd Iteration: Algorithm Converges!

124 Intuition Initial state: best one-hop paths One round: best two-hop paths Two rounds: best three-hop paths … Kth round: best (k+1) hop paths This must eventually converge….but how does it respond to changes in cost? 124

125 125 Distance Vector: Link Cost Changes A C 1 4 50 B 1 “good news travels fast” AC A46 C91 Node B AB A505 B541 Node C Link cost changes here time Algorithm terminates loop: 8 wait (until A sees a link cost change to neighbor V 9 or until A receives update from neighbor V) / 10 if (c(A,V) changes by ±d) /*  case 1 */ 11 for all destinations Y that go through V do 12 D V (A,Y) = D V (A,Y) ± d 13 else if (update D(V, Y) received from V) /*  case 2 */ 14 D V (A,Y) = D V (A,V) + D(V, Y); 15 if (there is a new minimum for destination Y) 16 send D(A, Y) to all neighbors 17 forever AC A16 C91 AB A505 B541 AC A16 C91 AB A502 B511 AC A13 C31 AB A502 B511

126 126 DV: Count to Infinity Problem A C 1 4 50 B 60 “bad news travels slowly” Node B Node C Link cost changes here time … loop: 8 wait (until A sees a link cost change to neighbor V 9 or until A receives update from neighbor V) / 10 if (c(A,V) changes by ±d) /*  case 1 */ 11 for all destinations Y that go through V do 12 D V (A,Y) = D V (A,Y) ± d 13 else if (update D(V, Y) received from V) /*  case 2 */ 14 D V (A,Y) = D V (A,V) + D(V, Y); 15 if (there is a new minimum for destination Y) 16 send D(A, Y) to all neighbors 17 forever AC A46 C91 AB A505 B541 AC A606 C91 AB A505 B541 AC A606 C91 AB A507 B1011 AC A608 C91 AB A507 B1011

127 127 Distance Vector: Poisoned Reverse A C 1 4 50 B 60 If B routes through C to get to A: -B tells C its (B’s) distance to A is infinite (so C won’t route to A via B) -Will this completely solve count to infinity problem? Node B Node C Link cost changes here; C updates D(C, A) = 60 as B has advertised D(B, A) = ∞ time Algorithm terminates AC A46 C91 AB A505 B∞1 AC A606 C91 AB A505 B∞1 AC A606 C91 AB A50∞ B∞1 AC A6051 C91 AB A50∞ B∞1 AC A6051 C91 AB A50∞ B∞1

128 Aside: Another Way to Avoid Loops? In Distributed Computation? Exchange entire paths, not just cost of paths Nodes can use arbitrary metrics to choose paths –No need to agree on single metric No loops, but algorithm might not converge Will discuss later in semester… 128

129 Routing: Just the Beginning Link state and distance-vector (and path vector) are the deployed routing paradigms But we know how to do much, much better… Stay tuned for a later lecture where we: –Reduce convergence time to zero –Respond to failures instantly! 129

130 Next Lecture Review computations (if needed) What pieces are we missing? –Naming –Security –Content retrieval –??? 130


Download ppt "1 The Fundamentals of Routing EE122 Fall 2011 Scott Shenker Materials with thanks to Jennifer Rexford, Ion Stoica,"

Similar presentations


Ads by Google