Lecture 9 Reminder: Homework 3, Programming Project 2 due today. Questions? Thursday, September 22 CS 475 Networks - Lecture 9 1 Outline Chapter 3 - Internetworking 3.1 Switching and Bridging 3.2 Basic Internetworking (IP) 3.3 Routing 3.4 Implementation and Performance 3.5 Summary Thursday, September 22 CS 475 Networks - Lecture 9 2 Routing Forwarding consists of looking at a packets destination, consulting a table and directing the packet to the corresponding interface. Routing is the process by which forwarding tables are built. Forwarding is a simple process that takes place at a single node. Routing depends on complex distributed algorithms. Thursday, September 22 CS 475 Networks - Lecture 9 3 Routing We distinguish between the forwarding and routing tables although they may be the same in practice. The forwarding table contains information to forward a packet, while the routing table contains the information to build the forwarding table. Example Routing Table Prefix/Length Next Hop 18/8 171.69.245.10 Example Forwarding Table Prefix/Length Interface MAC Address 18/8 if0 Thursday, September 22 CS 475 Networks - Lecture 9 8:0:2b:e4:b:1:2 4 Routing A routing domain is an internetwork under the same administrative control, e.g. an ISP or university (a network of 10 - 100 networks). Today we will be discussing intradomain routing protocols or interior gateway protocols (IGPs). The algorithms do not scale for use in larger networks. Next chapter we will discuss interdomain routing protocols that can be used on larger networks (i.e., the Internet). Thursday, September 22 CS 475 Networks - Lecture 9 5 Network as a Graph We will represent a network as a graph. The nodes represent routers and the edges are links between routers. A cost may be associated with each link. The routing problem is to find the lowest cost path between any two nodes in the graph. Thursday, September 22 CS 475 Networks - Lecture 9 6 Network as a Graph For small networks routing tables could be constructed manually. Statically constructed routing tables must be re-built anytime the network changes (node or link failure, addition of nodes or links, cost changes). For these reasons routing tables are usually constructed by running routing protocols among the nodes. The protocols provide a distributed, dynamic means for construction of the routing tables. Thursday, September 22 CS 475 Networks - Lecture 9 7 Distance-Vector (RIP) The distance vector (DV) algorithm constructs an array (vector) containing the distances (costs) to all other nodes in the network. The vector is then distributed to its immediate neighbors. Initially each node is assumed to know only the cost to its directly connected neighbors. A link that is down is assumed to have an infinite cost. Thursday, September 22 CS 475 Networks - Lecture 9 8 Distance-Vector (RIP) Example network with cost of 1 along each link (since all costs are equal they are not shown). Final Table at A Initial Table at A Dest Cost Next Hop Dest Cost Next Hop B 1 B B 1 B C 1 C C 1 C D ∞ - D 2 C E 1 E E 1 E F 1 F F 1 F G ∞ - G 2 F Thursday, September 22 CS 475 Networks - Lecture 9 9 Distance-Vector (RIP) STOP HERE SPOILER ALERT Initial Table at C Dest Cost Next Hop Final Table at C Dest A A B B D D E E F F G G Thursday, September 22 CS 475 Networks - Lecture 9 Cost Next Hop 10 Distance-Vector (RIP) Initial Table at C Dest Cost Next Hop Final Table at C Dest Cost Next Hop A 1 A A 1 A B 1 B B 1 B D 1 D D 1 D E ∞ - E 2 A F ∞ - F 2 A G ∞ - G 2 D Thursday, September 22 CS 475 Networks - Lecture 9 11 Distance-Vector (RIP) The table below shows a global view of the initial distances to each node. Distance to Reach Node Node A B C D E F G A 0 1 1 ∞ 1 1 ∞ B 1 0 1 ∞ ∞ ∞ ∞ C 1 1 0 1 ∞ ∞ ∞ D ∞ ∞ 1 0 ∞ ∞ 1 E 1 ∞ ∞ ∞ 0 ∞ ∞ F 1 ∞ ∞ ∞ ∞ 0 1 G ∞ ∞ ∞ 1 ∞ 1 0 Thursday, September 22 CS 475 Networks - Lecture 9 12 Distance-Vector (RIP) The table below shows a global view of the final distances to each node. Distance to Reach Node Node A B C D E F G A 0 1 1 2 1 1 2 B 1 0 1 2 2 2 3 C 1 1 0 1 2 2 2 D 2 2 1 0 3 2 1 E 1 2 2 3 0 2 3 F 1 2 2 2 2 0 1 G 2 3 2 1 3 1 0 Thursday, September 22 CS 475 Networks - Lecture 9 13 Distance-Vector (RIP) The nodes send their distance vectors to their directly connected neighbors allowing the neighbors to update their vectors. Initially A believes that it has no path to D. C has a path of cost 1 to D and A and C are directly connected. After A receives C's vector, A determines that it can reach D through C at a cost of 2 and updates its table. (A can reach B through C at a cost of 2, but this is greater than the current cost of 1, so A does not change the corresponding entry.) Thursday, September 22 CS 475 Networks - Lecture 9 14 Distance-Vector (RIP) Updates are sent out periodically. They may also be triggered due to a change in a routing table caused by an update from a neighbor. The routing tables converge fairly rapidly (both initially and also due to any changes). Thursday, September 22 CS 475 Networks - Lecture 9 15 Distance-Vector (RIP) The count to infinity problem can occur if a link goes down. Assume link A-to-E goes down. A advertises a distance of infinity, but C might still advertise a distance of two (through A). B advertises a distance of three through C. A advertises a distance of four through B. C updates to advertise a distance of five through A and so on. The cycle stops only when the distances reach infinity. During this time, all nodes think a path to E still exists. Thursday, September 22 CS 475 Networks - Lecture 9 16 Distance-Vector (RIP) The count to infinity problem can be bounded by using a small value to represent infinity (say 16 hops). Alternatively, in the split horizon method, a node does not send those routes it learned from a neighbor back to that neighbor. In the split horizon with poisoned reverse a node sends back a distance of infinity to those neighbors from which it learned a route. Thursday, September 22 CS 475 Networks - Lecture 9 17 Distance-Vector (RIP) The Routing Information Protocol (RIP) is a very widely used routing protocol on IP networks. RIP is based on the DV algorithm. Distances to networks instead of distances to routers are advertised in RIP. Thursday, September 22 RIPv2 packet format. RIP was designed to support other protocols in addition to IP CS 475 Networks - Lecture 9 18 Link State (OSPF) In DV, routers advertise the cost-to-each-router in the network to their immediate neighbors. In a link state (LS) algorithm, routers advertise the cost-to-their-immediate-neighbors to each router in the network. In LS each node floods the network with a linkstate packet (LSP) that contains: the ID of the node that created the LSP a list of directly connected nodes with costs a sequence number for the packet a time-to-live for the packet Thursday, September 22 CS 475 Networks - Lecture 9 19 Link State (OSPF) When a node X receives an LSP from node Y with a larger sequence number than the one X has in memory it stores the new LSP. If it is an older LSP (smaller seq. num. it discards it) X sends a new LSP out to all neighbors except the one from which it received the LSP. Each neighbor does the same, flooding the network with the new LSP. Each node will eventually have LSPs from all other nodes stored in memory. Thursday, September 22 CS 475 Networks - Lecture 9 20 Link State (OSPF) Routing tables at each node are computed using the forward search implementation of Dijkstra's algorithm: Each switch maintains Tentative and Confirmed lists. The lists contain entries of the form (Destination, Cost, NextHop). 1. The Confirmed list is initialized with an entry to this switch with a cost of 0. 2. The node just added to Confirmed is called Next. Select its LSP. Thursday, September 22 CS 475 Networks - Lecture 9 21 Link State (OSPF) 3. For each neighbor (Neighbor) of Next, calculate the cost (Cost) to each Neighbor through Next. a) If Neighbor is not in either list, add (Neighbor, Cost, NextHop) to Tentative. b) If Neighbor is in Tentative but the Cost through Next is less, update entry. 4. If Tentative is empty, stop. Otherwise pick entry from Tentative with lowest cost, move it to the Confirmed list and return to step 2. Thursday, September 22 CS 475 Networks - Lecture 9 22 Link State (OSPF) Step Conf. 1 Tent. (D,0,-) Comments Look at D's LSP 2 3 Example network used to illustrate LS algorithm. 4 5 Steps at left illustrate construction of routing table for node D. 6 7 Thursday, September 22 CS 475 Networks - Lecture 9 23 Link State (OSPF) Step Conf. 1 (D,0,-) 2 (D,0,-) Tent. Comments Look at D's LSP (B,11,B) (C,2,C) D's LSP contains routes to B and C that are smaller in costs than any existing routes 3 Example network used to illustrate LS algorithm. 4 5 Steps at left illustrate construction of routing table for node D. 6 7 Thursday, September 22 CS 475 Networks - Lecture 9 24 Link State (OSPF) Step Conf. Tent. Comments 1 (D,0,-) Look at D's LSP 2 (D,0,-) (B,11,B) (C,2,C) D's LSP contains routes to B and C that are smaller in costs than any existing routes 3 (D,0,-) (C,2,C) (B,11,B) Move lowest cost member of Tentative to Confirmed. Look at C's LSP 4 Example network used to illustrate LS algorithm. 5 Steps at left illustrate construction of routing table for node D. 6 7 Thursday, September 22 CS 475 Networks - Lecture 9 25 Link State (OSPF) Step Conf. Tent. Comments 1 (D,0,-) 2 (D,0,-) (B,11,B) (C,2,C) D's LSP contains routes to B and C that are smaller in costs than any existing routes 3 (D,0,-) (C,2,C) (B,11,B) Move lowest cost member of Tentative to Confirmed. Look at C's LSP 4 (D,0,-) (C,2,C) Look at D's LSP (B,5,C) C has lower cost route to B, (A,12,C) replace existing route in Tentative. Add A route. Example network used to illustrate LS algorithm. 5 Steps at left illustrate construction of routing table for node D. 6 7 Thursday, September 22 CS 475 Networks - Lecture 9 26 Link State (OSPF) Step Conf. Tent. Comments 1 (D,0,-) Look at D's LSP 2 (D,0,-) (B,11,B) (C,2,C) D's LSP contains routes to B and C that are smaller in costs than any existing routes 3 (D,0,-) (C,2,C) (B,11,B) Move lowest cost member of Tentative to Confirmed. Look at C's LSP 4 (D,0,-) (C,2,C) (B,5,C) C has lower cost route to B, (A,12,C) replace existing route in Tentative. Add A route. 5 (D,0,-) (C,2,C) (B,5,C) (A,12,C) Move lowest cost member of Tentative to Confirmed. Look at B's LSP 6 7 Thursday, September 22 CS 475 Networks - Lecture 9 Example network used to illustrate LS algorithm. Steps at left illustrate construction of routing table for node D. 27 Link State (OSPF) Step Conf. Tent. Comments 1 (D,0,-) Look at D's LSP 2 (D,0,-) (B,11,B) (C,2,C) D's LSP contains routes to B and C that are smaller in costs than any existing routes 3 (D,0,-) (C,2,C) (B,11,B) Move lowest cost member of Tentative to Confirmed. Look at C's LSP 4 (D,0,-) (C,2,C) (B,5,C) C has lower cost route to B, (A,12,C) replace existing route in Tentative. Add A route. 5 (D,0,-) (C,2,C) (B,5,C) (A,12,C) Move lowest cost member of Tentative to Confirmed. Look at B's LSP 6 (D,0,-) (C,2,C) (B,5,C) (A,10,C) There is a lower cost path to A through B 7 Thursday, September 22 CS 475 Networks - Lecture 9 Example network used to illustrate LS algorithm. Steps at left illustrate construction of routing table for node D. 28 Link State (OSPF) Step Conf. Tent. Comments 1 (D,0,-) Look at D's LSP 2 (D,0,-) (B,11,B) (C,2,C) D's LSP contains routes to B and C that are smaller in costs than any existing routes 3 (D,0,-) (C,2,C) (B,11,B) Move lowest cost member of Tentative to Confirmed. Look at C's LSP 4 (D,0,-) (C,2,C) (B,5,C) C has lower cost route to B, (A,12,C) replace existing route in Tentative. Add A route. 5 (D,0,-) (C,2,C) (B,5,C) (A,12,C) Move lowest cost member of Tentative to Confirmed. Look at B's LSP 6 (D,0,-) (C,2,C) (B,5,C) (A,10,C) There is a lower cost path to A through B 7 (D,0,-) (C,2,C) (B,5,C) (A,10,C) Thursday, September 22 Move lowest cost member of Tentative to Confirmed. We are done. CS 475 Networks - Lecture 9 Example network used to illustrate LS algorithm. Steps at left illustrate construction of routing table for node D. 29 Link State (OSPF) Step Conf. Tent. Comments 1 2 3 Example network used to illustrate LS algorithm. 4 5 Steps at left illustrate construction of routing table for node A. STOP HERE SPOILER ALERT 6 7 Thursday, September 22 CS 475 Networks - Lecture 9 30 Link State (OSPF) Step Conf. Tent. Comments 1 (A,0,-) Look at A's LSP 2 (A,0,-) (B,5,B) A's LSP contains routes to B (C,10,C) and C that are smaller in costs than any existing routes 3 (A,0,-) (B,5,B) (C,10,C) Move lowest cost member of Tentative to Confirmed. Look at B's LSP 4 (A,0,-) (B,5,B) (C,8,B) B has lower cost route to C, (D,16,B) replace existing route in Tentative. Add D route. 5 (A,0,-) (B,5,B) (C,8,B) (D,16,B) Move lowest cost member of Tentative to Confirmed. Look at C's LSP 6 (A,0,-) (B,5,B) (C,8,B) (D,10,B) There is a lower cost path to D through C 7 (A,0,-) (B,5,B) (C,8,B) (D,10,B) Thursday, September 22 Move lowest cost member of Tentative to Confirmed. We are done. CS 475 Networks - Lecture 9 Example network used to illustrate LS algorithm. Steps at left illustrate construction of routing table for node A. 31 Link State (OSPF) Node A B C D Routing Table (A,0,-) (B,5,B) (C,8,B) (D,10,B) (A,5,A) (B,0,-) (C,3,C) (D,5,C) (A,8,B) (B,3,B) (C,0,-) (D,2,D) (A,10,C) (B,5,C) (C,2,C) (D,0,-) Example network used to illustrate LS algorithm. Routing tables at each node after convergence of LS algorithm. Thursday, September 22 CS 475 Networks - Lecture 9 32 Link State (OSPF) The Open Shortest Path First (OSPF) protocol is one of the most popular LS protocols. “Open” refers to the fact that it is an open standard. SPF is another name for link state. OSPF allows for authentication of routing messages, partitioning of a domain, and load balancing along equal cost paths. Details of the OSPF packet format can be found in the text. Thursday, September 22 CS 475 Networks - Lecture 9 33 Metrics Many of the methods used to determine link-costs (metrics) were developed on ARPANET. The original ARPANET used the number of packets waiting to be transmitted on a link as the link cost. This method did not take either BW or latency into account. A second ARPANET algorithm used the packet delay (from time of arrival to delivery at the next hop) as the metric. This worked under light load, but exhibited several problems under heavy load. Thursday, September 22 CS 475 Networks - Lecture 9 34 Metrics A third method used a metric based on a non-linear mapping from load to costs. Different links used different mappings. In practice today, most costs are statically assigned. A common setting is cost=Constant/BW. Thursday, September 22 CS 475 Networks - Lecture 9 35 Implementation & Performance It is possible to use an ordinary PC (with additional Network Interface Cards (NICs)) as a switch as shown below: Thursday, September 22 CS 475 Networks - Lecture 9 36 Implementation & Performance Performance of a PC based switch is limited since all packets pass through a single point of contention. Aggregate throughput (the total sustainable data rate summed over all inputs) is half the main memory BW or half the I/O bus BW. A PC with a 133 MHz 64-bit I/O bus can transmit at a peak rate of 8 Gbps giving an aggregate throughput of 4 Gbps. Fast enough for several 100 Mbps Ethernet ports but not fast enough for a high-end router. Thursday, September 22 CS 475 Networks - Lecture 9 37 Ports Many modern switches are based on architectures similar to that shown below. Each port typically contains logic and memory. Thursday, September 22 CS 475 Networks - Lecture 9 38 Ports Each input port typically contains a VC mapping table (VC switches) or a forwarding table (packet switches). Ports also provide buffering. Most use either pure output buffering or a mixture of output buffering and internal buffering (buffering in the switching fabric. Simple input only buffers can lead to head-of-line blocking as shown at right. Thursday, September 22 CS 475 Networks - Lecture 9 39 Fabrics Switching fabric architectures can be categorized as one of the following four types: shared bus: This is the PC architecture illustrated earlier. A single I/O bus is shared between all input and output ports. shared memory: packets are written to memory by an input port and read directly from memory by an output port (similar to shared bus but uses a high speed memory bus instead of an I/O bus) Thursday, September 22 CS 475 Networks - Lecture 9 40 Fabrics crossbar: This is a matrix of pathways that can connect any input port to any output port. In the simplest design each output has to be able to accept packet from all inputs at once. A 4 x 4 Crossbar Thursday, September 22 CS 475 Networks - Lecture 9 41 Fabrics Thursday, September 22 self-routing: Each input port adds a header to each packet to direct it to its correct output CS 475 Networks - Lecture 9 42 Fabrics In the banyan fabric at left each 2 x 2 switch directs the packet up if the header bit is 0 and down if it is a 1. The banyan fabric requires that the input packets be sorted (by output port number). Multiple packets can be simultaneously routed through the fabric. Thursday, September 22 CS 475 Networks - Lecture 9 43 Router Implementation IP routers are more complicated than switches in several respects. Routers must be able to handle variable length IP packets. The forwarding algorithm is different because the network part of the IP address is not fixed in size. Routers may be implemented using network processors instead of general purpose microprocessors. High-performance routers can handle 40 Gbps per interface. Thursday, September 22 CS 475 Networks - Lecture 9 44 In-class Exercises 1) netstat utility 2) Start homework. Thursday, September 22 CS 475 Networks - Lecture 9 45