1 EE 122: Shortest Path Routing Ion Stoica TAs: Junda Liu, DK Moon, David Zats (Materials with thanks to Vern.

Slides:



Advertisements
Similar presentations
Data Communication and Networks Lecture 11 Internet Routing Algorithms and Protocols December 5, 2002 Joseph Conron Computer Science Department New York.
Advertisements

Distance-Vector and Path-Vector Routing Sections , 4.3.2, COS 461: Computer Networks Spring 2011 Mike Freedman
Routing - I Important concepts: link state based routing, distance vector based routing.
Network Layer-11 CSE401N: Computer Networks Lecture-9 Network Layer & Routing.
1 Dijkstra’s Shortest Path Algorithm Gordon College.
Introduction to Networking Bin Lin TA March 3 rd, 2005 Recital 6.
Routing & IP Routing Protocols
Distance-Vector Routing COS 461: Computer Networks Spring 2010 (MW 3:00-4:20 in COS 105) Michael Freedman
Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.
Network Layer Design Isues Store-and-Forward Packet Switching Services Provided to the Transport Layer The service should be independent of the router.
Katz, Stoica F04 EECS 122: Introduction to Computer Networks Link State and Distance Vector Routing Computer Science Division Department of Electrical.
Link-State Routing Reading: Sections 4.2 and COS 461: Computer Networks Spring 2011 Mike Freedman
Network Layer4-1 Chapter 4 Network Layer Computer Networking: A Top Down Approach Featuring the Internet, 2 nd edition. Jim Kurose, Keith Ross Addison-Wesley,
1 The Fundamentals of Routing EE122 Fall 2011 Scott Shenker Materials with thanks to Jennifer Rexford, Ion Stoica,
Announcement r Project 2 extended to 2/20 midnight r Project 3 available this weekend r Homework 3 available today, will put it online.
Rensselaer Polytechnic Institute © Shivkumar Kalvanaraman & © Biplab Sikdar1 ECSE-4730: Computer Communication Networks (CCN) Network Layer (Routing) Shivkumar.
4: Network Layer4a-1 14: Intro to Routing Algorithms Last Modified: 7/12/ :17:44 AM.
Announcement r Project 2 Extension ? m Previous grade allocation: Projects 40% –Web client/server7% –TCP stack21% –IP routing12% Midterm 20% Final 20%
Announcement r Project 2 due next week! r Homework 3 available soon, will put it online r Recitation tomorrow on Minet and project 2.
EE 122: Intra-domain routing Ion Stoica September 30, 2002 (* this presentation is based on the on-line slides of J. Kurose & K. Rose)
Routing Algorithm March 3 rd, Routing Graph abstraction for routing algorithms: graph nodes are routers graph edges are physical links  link cost:
CS 4700 / CS 5700 Network Fundamentals Lecture 9: Intra Domain Routing Revised 7/30/13.
Distance Vector Routing EE 122, Fall 2013 Sylvia Ratnasamy
Network Layer Goals: understand principles behind network layer services: –routing (path selection) –dealing with scale –how a router works –advanced topics:
Intra-Domain Routing D.Anderson, CMU Intra-Domain Routing RIP (Routing Information Protocol) & OSPF (Open Shortest Path First)
Network Layer r Introduction r Datagram networks r IP: Internet Protocol m Datagram format m IPv4 addressing m ICMP r What’s inside a router r Routing.
Link-state routing  each node knows network topology and cost of each link  quasi-centralized: each router periodically broadcasts costs of attached.
IP routing. Simple Routing Table svr 4% netstat –r n Routing tables DestinationGatewayFlagsRefcntUseInterface UGH00emd UH10lo0.
Network Layer4-1 Chapter 4: Network Layer r 4. 1 Introduction r 4.2 Virtual circuit and datagram networks r 4.3 What’s inside a router r 4.4 IP: Internet.
13 – Routing Algorithms Network Layer.
Network Layer4-1 Distance Vector Algorithm Bellman-Ford Equation (dynamic programming) Define d x (y) := cost of least-cost path from x to y Then d x (y)
The Network Layer Part 1: Routing EE 122, Fall 2013 Sylvia Ratnasamy
The Network Layer & Routing
1 Week 5 Lecture 2 IP Layer. 2 Network layer functions transport packet from sending to receiving hosts transport packet from sending to receiving hosts.
1 Even More Routing EE122 Fall 2012 Scott Shenker Materials with thanks to Jennifer Rexford, Ion Stoica, Vern Paxson.
Routing 2 CS457 Fall 2010.
1 More Routing EE122 Fall 2012 Scott Shenker Materials with thanks to Jennifer Rexford, Ion Stoica, Vern Paxson and.
Overview of Internet Routing (I) Fall 2004 CS644 Advanced Topics in Networking Sue B. Moon Division of Computer Science Dept. of EECS KAIST.
Routing 1 Network Layer Network Layer goals:  understand principles behind network layer services:  routing (path selection)  how a router works  instantiation.
Internet Routing r Routing algorithms m Link state m Distance Vector m Hierarchical routing r Routing protocols m RIP m OSPF m BGP.
4: Network Layer4a-1 Distance Vector Routing Algorithm iterative: r continues until no nodes exchange info. r self-terminating: no “signal” to stop asynchronous:
Network Layer (2). Review Physical layer: move bits between physically connected stations Data link layer: move frames between physically connected stations.
4: Network Layer4-1 Chapter 4: Network Layer Last time: r Chapter Goals m Understand network layer principles and Internet implementation r Started routing.
R OUTING P ROTOCOLS 1. P LAN Aug 16 – Routing (CCNA2) Aug 23 – LAB Aug 30- Transport L. Sep 6– Application L. Sep 13 – Presentation Sep 20 – Packet Tracer.
T. S. Eugene Ngeugeneng at cs.rice.edu Rice University1 COMP/ELEC 429 Introduction to Computer Networks Lecture 10: Intra-domain routing Slides used with.
IP tutorial - #2 Routing KAIST Dept. of CS NC Lab.
Network Layer4-1 Chapter 4: Network Layer 4. 1 Introduction 4.2 Virtual circuit and datagram networks 4.3 What’s inside a router 4.4 IP: Internet Protocol.
Network Layer.
CS 5565 Network Architecture and Protocols
CSE390 – Advanced Computer Networks
Routing: Distance Vector Algorithm
Distance Vector Routing: overview
Network layer functions
Chapter 4 – The Network Layer & Routing
Road Map I. Introduction II. IP Protocols III. Transport Layer
Lecture 10 Computer Networking: A Top Down Approach 6th edition Jim Kurose, Keith Ross Addison-Wesley March 2012 CS3516: These slides are generated from.
CS 4700 / CS 5700 Network Fundamentals
CS 3700 Networks and Distributed Systems
Lowest-Cost Routing EE 122: Intro to Communication Networks
ECE453 – Introduction to Computer Networks
CS 3700 Networks and Distributed Systems
COMP/ELEC 429 Introduction to Computer Networks
Chapter 4: Network Layer
ECSE-4730: Computer Communication Networks (CCN)
Network Layer (contd.) Routing
EE 122: Intra-domain routing: Distance Vector
Chapter 4: Network Layer
Network Layer.
Chapter 4: Network Layer
EE 122: Intra-domain routing: Link State
Presentation transcript:

1 EE 122: Shortest Path Routing Ion Stoica TAs: Junda Liu, DK Moon, David Zats (Materials with thanks to Vern Paxson, Jennifer Rexford, and colleagues at UC Berkeley)

2 What is Routing? Routing implements the core function of a network: 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.

3 Internet Routing Internet organized as a two level hierarchy First level – autonomous systems (AS’s) AS – region of network under a single administrative domain AS’s run an intra-domain routing protocols Distance Vector, e.g., Routing Information Protocol (RIP) Link State, e.g., Open Shortest Path First (OSPF) Between AS’s runs inter-domain routing protocols, e.g., Border Gateway Routing (BGP) De facto standard today, BGP-4

4 Example AS-1 AS-2 AS-3 Interior router BGP router

5 Forwarding vs. Routing Forwarding: “data plane” Directing a data packet to an outgoing link Individual router using a forwarding table Routing: “control plane” Computing paths the packets will follow Routers talking amongst themselves Individual router creating a forwarding table

6 Routing requires knowledge of the network structure Centralized global state Single entity knows the complete network structure Can calculate all routes centrally Problems with this approach? Distributed global state Every router knows the complete network structure Independently calculates routes Problems with this approach? Distributed no-global state Every router knows only about its neighboring routers Independently calculates routes Problems with this approach? Know Thy Network Link State Routing E.g. Algorithm: Dijkstra E.g. Protocol: OSPF Distance Vector Routing E.g. Algorithm: Bellman-Ford E.g. Protocol: RIP

7 Modeling a Network Modeled as a graph Routers  nodes Link  edges Possible edge costs  delay  congestion level Goal of Routing Determine a “good” path through the network from source to destination Good usually means the shortest path A E D CB F

8 Link State: Control Traffic Each node floods its local information to every other node in the network Each node ends up knowing the entire network topology  use Dijkstra to compute the shortest path to every other node Host A Host B Host E Host D Host C N1 N2 N3 N4 N5 N7N6

9 Link State: Node State 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

10 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 Source

11 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

12 Example: Dijkstra’s Algorithm Step 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 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) = ; …

13 Example: Dijkstra’s Algorithm Step 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 D(D),p(D) 1,A D(E),p(E) D(F),p(F)

14 Example: Dijkstra’s Algorithm Step 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 … 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;

15 Example: Dijkstra’s Algorithm Step 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 … 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;

16 Example: Dijkstra’s Algorithm Step 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 … 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;

17 Example: Dijkstra’s Algorithm Step 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 … 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;

18 Example: Dijkstra’s Algorithm Step 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 … 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;

19 Example: Dijkstra’s Algorithm Step 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 … 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;

20 Example: Dijkstra’s Algorithm Step 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 To determine path A  C (say), work backward from C via p(v)

21 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 DestinationLink B(A,B) C(A,D) D E F

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

23 Obtaining Global State Flooding Each 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 A CBD (a) XA C BD (b) X A CB D (c) XA CBD (d)

24 Flooding the Link State 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 Time-to-live for each packet

25 When to Initiate Flooding Topology change Link or node failure Link or node recovery Configuration 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) 30 minutes Corrects for possible corruption of the data

26 Oscillations Assume link cost = amount of carried traffic A D C B 1 1+e e 0 e initially A D C B 2+e e 1 … recompute routing A D C B 0 2+e 1+e … recompute A D C B 2+e 0 e 0 1+e 1 … recompute  How can you avoid oscillations?

27 5 Minute Break Questions Before We Proceed?

28 Distance Vector Routing Each router knows the links to its immediate neighbors Does not flood this information to the whole network Each router has some idea about the shortest path to each destination 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

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

30 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

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 B D 3 1 BC B28 C37 D48 Node A Neighbor (next-hop) Destinations D C (A, D)

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 B D 3 1 BC B28 C37 D48 Node A Smallest distance in row Y = shortest Distance of A to Y, D(A, Y)

33 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) 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:

34 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

Example: 1 st Iteration (C  A) A C 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) = = 8 D C (A, D) = D C (A,C) + D(C, D) = = 8

Example: 1 st Iteration (B  A) A C 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) = = 3 D B (A, D) = D B (A,B) + D(B, D) = = 5 BC A∞∞ B3∞ C∞1

Example: End of 1 st Iteration A C 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

Example: 2 nd Iteration (A  B) A C 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) = = 5 D A (B, D) = D A (B,A) + D(A, D) = = 7

Example: End of 2 nd Iteration A C B D 3 1 BC B28 C37 D48 Node A ACD A 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

Example: End of 3rd Iteration A C 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!

41 Distance Vector: Link Cost Changes A C 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

42 Distance Vector: Count to Infinity Problem A C 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

43 Distance Vector: Poisoned Reverse A C 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

44 Routing Information Protocol (RIP) Simple distance-vector protocol Nodes send distance vectors every 30 seconds … or, when an update causes a change in routing Link costs in RIP All links have cost 1 Valid distances of 1 through 15 … with 16 representing infinity Small “infinity”  smaller “counting to infinity” problem RIP is limited to fairly small networks E.g., campus

45 Link State vs. Distance Vector Per-node message complexity: LS: O(e) messages e: number of edges DV: O(d) messages, many times d is node’s degree Complexity/Convergence LS: O(N log N) computation Requires global flooding DV: convergence time varies Count-to-infinity problem Robustness: what happens if router malfunctions? LS: Node can advertise incorrect link cost Each node computes only its own table DV: Node can advertise incorrect path cost Each node’s table used by others; errors propagate through network

46 Summary Routing is a distributed algorithm Different from forwarding React to changes in the topology Compute the shortest paths Two main shortest-path algorithms Dijkstra  link-state routing (e.g., OSPF, IS-IS) Bellman-Ford  distance-vector routing (e.g., RIP) Convergence process Changing from one topology to another Transient periods of inconsistency across routers Next time: BGP Reading: K&R 4.6.3