ECE 4450:427/527 - Computer Networks Spring 2016 Dr. Nghi Tran Department of Electrical & Computer Engineering Lecture 6.3: Routing Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 1 Internetworking: Discussions • For Internetworking, we shall look at few subproblems: • Interconnect links of the same type: Switches • We consider an important of class switch: Bridges to interconnect Ethernet segments. • We also look a way to interconnect disparate networks and links: Gateways, or now mostly known as routers. We shall focus on the IP • Once we are able to interconnect a whole lot of links and networks with switches and routers, we will look at a way to find a suitable path, or route through a network: • Paths that are efficient, loop free, etc.: Routing Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 2 Recall: IP Routing Table Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 3 What is Routing? Construct directions from starting point to destination Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 4 Forwarding vs Routing • Forwarding: data plane – Directing a data packet to an outgoing link – Individual router using a forwarding/routing table • Routing: control plane – Computing paths the packets will follow – Routers talking amongst themselves – Individual router creating a forwarding table Routing can be simply understood as a process by which routing table is built 5 Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 5 Why Does Routing Matter? • End-to-end performance – Quality of the path affects user performance – Propagation delay, throughput, and packet loss • Use of network resources – Balance of the traffic over the routers and links – Avoiding congestion by directing traffic to lightly-loaded links • Transient disruptions during changes – Failures, maintenance, and load balancing – Limiting packet loss and delay during changes Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 6 Different Types of Routing • Routing in a GPS device • Routing in computer networks – Shortest path – Smallest delay – Highest reliability – Avoid congested nodes Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 7 Routing • Network as a Graph • The basic problem of routing is to find the lowest-cost path between any two nodes • The cost of a path equals the sum of the costs of all the edges that make up the path • Cost: delay, financial cost, probability of failure, etc. Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 8 Routing • For a simple network, we can calculate all shortest paths and load them into some nonvolatile storage on each node. • Such a static approach has several shortcomings • It does not deal with node or link failures • It does not consider the addition of new nodes or links • It implies that edge costs cannot change • What is the solution? • Need a distributed and dynamic protocol • Two main classes of protocols • Distance Vector • Link State Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 9 Distance Vector: Algorithm • Construct a one-dimensional array (vector) of distances to all other nodes, with assumption that each node knows the cost of the link to each of its directly connected neighbors • Exchange info with immediate neighbors • Update distances based on received information • Stop sending updates as soon as no change occurs Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 10 Distance Vector Initial distances stored at each node (global view) (assume unit cost for each link) Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 11 Distance Vector Dest Cost Next Hop B 1 B C 1 C D – E 1 E F 1 F G – Initial routing table at node A, assume unit cost for each link Now, how about node B? Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 12 Distance Vector: Local View (initial) Dest Cost Next Hop Dest Cost Next Hop Dest Cost Next Hop B 1 B A 1 A A 1 A C 1 C C 1 C B 1 B D – D – D 1 D E 1 E E – E – F 1 F F – F – G – G – G – Dest Cost Next Hop Dest Cost Next Hop Dest Cost Next Hop Dest Cost Next Hop A – A 1 A A 1 A A – B – B – B – B – C 1 C C – C – C – E – D – D – D 1 D F – F – E – E – G 1 G G – G 1 G F 1 F Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 13 Distance Vector – 1st Update for A 1st Update: Every node sends to its directly connected neighbors its personal list of distances 1st Update for A Dest Cost Next Hop B 1 B C 1 C D – E 1 E F 1 F G – Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Dest Cost Next Hop B 1 B C 1 C D 2 C E 1 E F 1 F G 2 F Computer Networks 14 Distance Vector – 1st Update for B? 1st Update Dest Cost Next Hop A 1 A C 1 C D – E – F – G – Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Dest Cost Next Hop A 1 A C 1 C D 2 C E 2 A F 2 A G – Computer Networks 15 Distance Vector – 1st Update Dest Cost Next Hop Dest Cost Next Hop Dest Cost Next Hop B 1 B A 1 A A 1 A C 1 C C 1 C B 1 B D 2 C D 2 C D 1 D E 1 E E 2 A E 2 A F 1 F F 2 A F 2 A G 2 F G – G 2 G Dest Cost Next Hop Dest Cost Next Hop Dest Cost Next Hop Dest Cost Next Hop A 2 C A 1 A A 1 A A 2 F B 2 C B 2 A B 2 A B – C 1 C C 2 A C 2 A C 2 D E – D – D 2 G D 1 D F 2 G F 2 A E 2 E E – G 1 G G – G 1 G F 1 F Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 16 Distance Vector – 2nd Update Dest Cost Next Hop Dest Cost Next Hop Dest Cost Next Hop B 1 B A 1 A A 1 A C 1 C C 1 C B 1 B D 2 C D 2 C D 1 D E 1 E E 2 A E 2 A F 1 F F 2 A F 2 A G 2 F G 3 C G 2 G Dest Cost Next Hop Dest Cost Next Hop Dest Cost Next Hop Dest Cost Next Hop A 2 C A 1 A A 1 A A 2 F B 2 C B 2 A B 2 A B 3 D C 1 C C 2 A C 2 A C 2 D E 3 C D 3 A D 2 G D 1 D F 2 G F 2 A E 2 E E 3 F G 1 G G 3 A G 1 G F 1 F Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 17 Distance Vector: Global View Final distances stored at each node (global view) Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 18 Distance Vector • The other common name for this class of algorithm is Bellman-Ford, after its inventors. • As we can see, it usually takes a number of exchanges/updates between neighbors before each node has complete routing table. • The process of getting consistent routing information to all nodes is called convergence: vary • We have two different circumstances under which a node decides to send a routing update • Periodic update • Triggered update Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 19 Failure of Link F-G • When a node detects a link failure • • • • • • F detects that link to G has failed (how?) F sets distance to G to infinity and sends update to A A sets distance to G to infinity since it uses F to reach G A receives periodic update from C with 2-hop path to G A sets distance to G to 3 and sends update to F F decides it can reach G in 4 hops via A Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 20 Failure of Link F-G: Updated Tables A/Dest Cost Next Hop B/Dest Cost Next Hop C/Dest Cost Next Hop B 1 B A 1 A A 1 A C 1 C C 1 C B 1 B D 2 C D 2 C D 1 D E 1 E E 2 A E 2 A F 1 F F 2 A F 2 A G 3 C G 3 C G 2 G D/Dest Cost Next Hop E/Dest Cost Next Hop F/Dest Cost Next Hop G/Dest Cost Next Hop A 2 C A 1 A A 1 A A 3 D B 2 C B 2 A B 2 A B 3 D C 1 C C 2 A C 2 A C 2 D E 3 C D 3 A D 4 C D 1 D F 3 C F 2 A E 2 E E 3 F G 1 G G 4 A G 4 A F 4 D Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 21 Drawback – Suppose the link from A to E goes down – In the next round of updates, A advertises a distance of infinity to E, but C advertise a distance of 2 to E – Depending on the exact timing of events, the following might happen • Node B, upon hearing that E can be reached in 2 hops from C, concludes that it can reach E in 3 hops and advertises this to A • Node A concludes it can reach E in 4 hops and advertises this to C • Node C concludes that it can reach E in 5 hops; and so on. • This cycle stops only when the distances reach some number that is large enough to be considered infinite Count-to-infinity problem Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 22 Solutions • One technique to improve the time to stabilize routing is called split horizon – When a node sends a routing update to its neighbors, it does not send those routes it learned from each neighbor back to that neighbor – For example, if B has the route (E, 2, A) in its table, then it knows it must have learned this route from A, and so whenever B sends a routing update to A, it does not include the route (E, 2) in that update • In a stronger version of split horizon, called split horizon with poison reverse – B actually sends that back route to A, but it puts negative information in the route to ensure that A will not eventually use B to get to E – For example, B sends the route (E, ∞) to A Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 23 Routing Information Protocol (RIP) • Early routing protocol for IP networks • Distance-vector algorithm where vertices are networks and not hosts • Valid hop count (distances) 1-15, with 16 representing infinity • Limited to fairly small networks Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 24 Metric/Cost in Real World • Can we just assign a cost of 1 to all links? • Certainly, there are so many ways to define cost: • Number of packets queued waiting to be transmitted • Consider both bandwidth and latency • In the current real world • Common approach: a constant/link bandwidth • It means metric changes rarely if at all and only under the control of network administrator • Why? • i) Dynamically changing metrics are too unstable; • ii) Many networks today lack the great disparity of speeds and latencies Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 25 Distance Vector vs. Link-State • Distance vector: • each node talks only to its directly connected neighbors … • but it tell them everything it has learned, i.e., distance to all nodes • Link-state: • each node talks to all other nodes… • but it tells them only what it knows for sure, i.e., state of its directly connected links Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 26 Link-State Routing Strategy: Send to all nodes (not just neighbors) information about directly connected links (not entire routing table) and associated cost. • Rely on two key mechanisms: – Reliable flooding: Make sure all nodes get the above information of other nodes – Route calculation: Once a node has a copy of the information from every other node, it is able to compute a complete map of the network, and then can decide the best route to each destination Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 27 Reliable Flooding • Objective: Make sure all nodes get the link-state information of other nodes: Knowledge of directly connected neighbors and associated cost for each node • Each node creates an update packet called link-state packet (LSP) with the following information: • ID of the node that created LSP • Cost of link to each directly connected neighbor • Sequence number (SEQNO) • Time-to-live for this packet Reliable flooding: Make sure all nodes get LSP from the other nodes. Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 28 Reliable Flooding • Transmission of LSPs between adjacent routers using ACK and transmission. But how to send an LSP to all nodes? • We need some more steps to reliably flood an LSP to all nodes: controlled flooding • A node x receives a copy of LSP originated from y. • x then needs to check if it has already had a copy. If not, store it. If it has, compare sequence number, keep a newer one. • If the received LSP is new, x sends a copy of LSP to all neighbors, except the one from which LSP was received (why?). • Neighbors then turn around and do the same thing: most recent copy of LSP reaches all nodes. Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 29 Reliable Flooding Reliable Flooding Flooding of link-state packets. (a) LSP arrives at node X; (b) X floods LSP to A and C; (c) A and C flood LSP to B (but not X); (d) flooding is complete Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 30 Route Calculation • Now, assume a given node has copies of LSPs from every other node: • it is able to compute a complete map for the topology of the network • and from this map it is able to decide the best routes to each destination • But how to decide/calculate the best route to each destination? • The solution is based on a well-known algorithm from graph theory – Dijkstra’s shortest-path algorithm Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 31 Shortest-Path Problem: Statement • Given: network topology with link costs – c(x,y): link cost from node x to node y – Infinity if x and y are not direct neighbors • Compute: least-cost paths to all nodes – From a given source u to all other nodes – For each node a: u stores a’s predecessor node along path from u to a, & cost. 2 3 u 2 1 4 Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 1 1 4 a 5 3 Computer Networks 32 Dijkstra’s Algorithm: Overview • Iterative algorithm for a given source node u: – After k iterations, know least-cost path to k nodes • S: set of nodes whose least-cost path known – Initially, S = {u} where u is the source node – Add one node to S in each iteration • D(a): current cost of path from source to node a – Initially, D(a) = c(u, a) for all nodes a adjacent to u – … and D(a) = ∞ for all other nodes a – Continuously update D(a) as shorter paths are learned Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 33 Dijkstra’s Algorithm: Implementation 1 Initialization: 2 S = {u} 3 for all nodes {a} 4 If a adjacent to u { 5 D(a) = c(u,a) 6 else D(v) = ∞ 7 8 Loop 9 Find b not in S with the smallest D(b) 10 Add b to S, store D(b) and P(b) (predecessor node) 11 update D(a) for all {a} adjacent to b and not in S: 12 D(a) = min{D(a), D(b) + c(b,a)} 13 until all nodes in S Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 34 Example 2 3 2 2 1 1 3 4 2 1 5 4 2 5 4 3 3 2 1 1 1 4 1 2 3 1 1 3 4 2 5 4 Dr. Nghi Tran (ECE-University of Akron) 1 4 3 ECE 4450:427/527 1 1 4 5 3 Computer Networks 35 Example (Cont.) 2 3 2 2 1 1 3 1 4 2 1 5 4 2 5 4 3 3 2 1 1 1 4 1 2 3 1 3 4 2 1 5 4 Dr. Nghi Tran (ECE-University of Akron) 4 3 ECE 4450:427/527 1 1 4 5 3 Computer Networks 36 Dijkstra’s Table Step S v w x y z s t D(v) P(v) D(w) P(w) D(x) P(x) D(y) P(y) D(z) P(z) D(s) P(s) D(t) P(t) 3 u 2 u 3 w 5 v 6 y 6 w 8 x . . . . . . 7 u,w,v,x,y ,z,s,t Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 37 Shortest-Path Tree • Shortest-path tree from • Routing table at u u v 3 u 1 2 1 x 1 w link y 2 4 5 4 s Dr. Nghi Tran (ECE-University of Akron) z t 3 ECE 4450:427/527 v w x y z s t (u,v) (u,w) (u,w) (u,v) (u,v) (u,w) (u,w) Computer Networks 38 Open Shortest First Path (OSPF) • It is the most widely used link-state routing protocols in practice • Open: Publicly available • SPF: Alternative name for link-state • OSPF adds a number of features to the basic link-state • Authentication: Make sure all nodes can be trusted • Additional hierarchy: Network domain divided further in to areas: a router might just need to get to a right area • Load balancing: Allow multiple routes to the same place to be assigned the same cost: traffic distributed evenly to those routers Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 39 Distance Vector vs. Link-State • Distance vector: each node talks only to its directly connected neighbors, but it tell them everything it has learned, i.e., distance to all nodes • Link-state: each node talks to all other nodes, but it tells them only what it knows for sure, i.e., state of its directly connected links Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 40 Distance Vector vs. Link-State • Who is the winner? Message complexity • LS: with n nodes, E links, O(nE) msgs sent . A lot of information needs to be stored. • DV: exchange between neighbors only Speed of Convergence • LS: O(n2) algorithm requires O(nE) msgs • DV: convergence time varies – may be routing loops – count-to-infinity problem Dr. Nghi Tran (ECE-University of Akron) Robustness: what happens if router malfunctions, misbehaves? LS: – node can advertise incorrect link cost – each node computes only its own table, providing a degree of robustness DV: ECE 4450:427/527 – DV node can advertise incorrect path cost – each node’s table used by others , error propagate thru network Computer Networks 41 Routing in the Internet • Routing protocols we have learned so far: idealization, all routers identical, flat network • Internet: Network of hundreds of thousands of networks: Not possible to directly using those protocols: they do not scale to those kinds of numbers!!! • We need something else!!! Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 42 Routing in the Internet • Internet is organized as autonomous systems (AS) each of which is under the control of a single administrative entity • Autonomous System (AS) – corresponds to an administrative domain – examples: University, company, backbone network, as may the network of a single ISP – AS chooses its own routing protocol, e.g., distance-vector or link-state • Divide routing problem in two parts: • Intra-domain: We have already learned • Inter-domain: Border Gateway Protocol (BGP) (BGP-v4) Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 43 BGP • Few books dedicated to BGP • Key points: • Assumes the Internet is an arbitrarily interconnected set of AS‘s • Impossible to define optimal path • Advertise only reachability: complete paths as an enumerated lists of ASs to reach a particular network • Does not belong to either distance-vector or link-state • For further discussions (high points), see Chapter 4.1.2 Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 44