Lecture 7 Reminder: Homework 2, Programming Project 1 due today. Homework 3, Programming Project 2 out, due Thursday next week. Questions? Thursday, September 15 CS 475 Networks - Lecture 7 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 15 CS 475 Networks - Lecture 7 2 Introduction Direct link networks from Chapter 2 must be connected together to form a global network. This internetworking is accomplished by switches and routers. A switch interconnects links of the same type. It has multiple inputs and outputs. Its job is to forward (switch) a packet arriving on an input to the right output. A router interconnects links of different types, dealing with heterogeneity. Thursday, September 15 CS 475 Networks - Lecture 7 3 Switching and Bridging A switch can use one of three methods to determine which output port a packet should be forwarded to: (1) datagram or connectless approach, (2) virtual-circuit or connection-oriented approach, (3) source routing. All three methods assume that each node has a unique identifier (an address). Thursday, September 15 CS 475 Networks - Lecture 7 4 Datagrams Dest. Port A 3 B 0 C 3 D 3 E 2 F 1 G 0 H 0 Forwarding table for Switch 2 Thursday, September 15 Fig 3.2 Example network for datagram forwarding CS 475 Networks - Lecture 7 5 Datagrams Each datagram packet contains the complete destination address. Each switch contains a forwarding (routing) table. A host can send a packet at any time (in contrast to virtual circuit networks). A host has no way of knowing if the network can deliver the packet (or if the destination is up). Packets are forwarded independently. A switch or link failure can be tolerated if an alternate route exists. Thursday, September 15 CS 475 Networks - Lecture 7 6 Datagrams For a simple network like the one shown here a network administrator could construct the forwarding tables manually. For more complex networks with dynamically changing topologies and multiple paths between nodes, routing algorithms are used to construct the table. We will study routing algorithms next week (Section 3.3). The Internet Protocol (IP) is based on datagram forwarding. Thursday, September 15 CS 475 Networks - Lecture 7 7 Virtual Circuit Switching Fig 3.3 An example of a virtual circuit network SWITCH In Int. In VCI Out Int. Out VCI 1 2 5 1 11 2 3 11 2 7 3 0 7 1 4 Selected virtual circuit entries from switch tables (for a VC between hosts A and B) Thursday, September 15 CS 475 Networks - Lecture 7 8 Virtual Circuit Switching Communication between nodes A and B on a VC network requires that a connection be setup. In the setup (signalling) process host A sends a setup message to the network. The message contains the address of host B. As the message passes through each switch, the switch assigns a VC identifier (VCI) for that connection on the upstream link. The response from B contains the VCI for the downsteam link so each switch can construct an entry in the VC table. Thursday, September 15 CS 475 Networks - Lecture 7 9 Virtual Circuit Switching The VC tables establish a virtual circuit between hosts A and B. Notice that each link in a VC will typically have a different VCI. Multiple VCIs are normally assigned to a link. Each VCI would correspond to a different VC. Thursday, September 15 CS 475 Networks - Lecture 7 10 Virtual Circuit Switching There is at least a RTT delay for setup before two nodes can communication. While the connection request has to have the full address of B, data frames need only a VCI. (The VCI is changed in the frame by switch.) In the event of a switch or link failure a new connection must be setup. Forwarding of the connection request requires a routing algorithm. Thursday, September 15 CS 475 Networks - Lecture 7 11 Virtual Circuit Switching After the nodes are done communicating the VC should be torn down to free resources (VC table entries and VC buffers). It is relatively easy to implement different Quality of Service (QoS) guarantees on different VCs. Frame Relay and ATM networks were popular examples of VC networks. They were used as backbone networks. Thursday, September 15 CS 475 Networks - Lecture 7 12 Asynchronous Transfer Mode (ATM) Asynchronous Transfer Mode (ATM) was embraced by the telephone industry in the 1980s and early 1990s. ATM is a connection-oriented (virtual circuits), packet-switched technology. It uses fixed-length 53 byte (5 byte header, 48 byte payload) packets called cells. Although ATM was originally designed to compete with Ethernet, it is now used primarily only in DSL networks. Thursday, September 15 CS 475 Networks - Lecture 7 13 Asynchronous Transfer Mode (ATM) The most significant feature of the ATM cell is its fixed length. Easier to build hardware, write algorithms Easier to do tasks in parallel, improving scalability The payload of 48 bytes was a compromise. Voice data is better in smaller units; digital data better in larger units. Thursday, September 15 CS 475 Networks - Lecture 7 14 Source Routing Fig 3.7 Source routing example (the switch reads the rightmost number) Thursday, September 15 CS 475 Networks - Lecture 7 15 Source Routing In source routing the source node provides all the information about the network that is necessary for the packet to reach the destination. The information is embedded in the packet header. In the example on the previous slide the required switch output port number is included in the header. Since the number of switches is usually unknown, the list of ports numbers is rotated so that the port of the next switch is always at the head of the list. Thursday, September 15 CS 475 Networks - Lecture 7 16 Source Routing As alternatives to rotating the port list, the port number could be stripped as in (b) or the header could contain a pointer to the next port number as in (c). (The pointer would be updated as the packet passes through the switch.) Thursday, September 15 CS 475 Networks - Lecture 7 17 Source Routing Source routing requires the sending host know enough about the network topology to build the header (analogous to building forwarding or VC tables). Note that packet headers must, in general, be of variable length with no upper bound on the size of the header. Thursday, September 15 CS 475 Networks - Lecture 7 18 Bridges and LAN Switches Switches that forward packets between sharedmedia LANs (e.g. Ethernets) are known as LAN switches or bridges. A bridge (unlike a hub or repeater) buffers a packet received on one port and retransmits it on all other ports. The ports are in different collision domains. Bridges can be used to create an extended LAN. For example a bridge can be used to connect two Ethernets that are at their max. size and form an extended Ethernet. Thursday, September 15 CS 475 Networks - Lecture 7 19 Learning Bridges Host Port A 1 B 1 C 1 X 2 Y 2 Z 2 Forwarding Table A bridge need not forward all frames. The bridge could use a forwarding table to only send packets addressed to host A out Port 1. Broadcast frames need to be forwarded to all ports (except the port they are received on). Thursday, September 15 CS 475 Networks - Lecture 7 20 Learning Bridges Forwarding tables are constructed automatically. Initially the bridge forwards packets to all ports while it inspects the source address in each frame. It builds the table by associating source addresses with the port on which the frame arrives. Table entries have timeout values to handle moving hosts from one network to another. Frames addressed to hosts not listed in the table are forwarded to all other ports. Thursday, September 15 CS 475 Networks - Lecture 7 21 Spanning Tree Algorithm The network at right contains loops. Simple forwarding tables might allow duplicate frames to arrive (along different paths) or broadcast frames to endlessly cycle. Thursday, September 15 Fig. 3.10 Extended LAN with loops CS 475 Networks - Lecture 7 22 Spanning Tree Algorithm If we imagine the network as a graph (with bridges as vertices) then a spanning tree is a Fig. 3.11 (a) cyclic graph (b) spanning tree subgraph which includes all vertices but includes no loops. An example graph and a corresponding spanning tree are shown above. (The spanning tree shown is one of many possible.) Thursday, September 15 CS 475 Networks - Lecture 7 23 Spanning Tree Algorithm The spanning tree algorithm is a protocol used by bridges to agree on a spanning tree for an extended network. The algorithm allows each bridge to select ports over which it will and will not forward frames. The algorithm is dynamic so that if a bridge fails, a new spanning tree is constructed. Thursday, September 15 CS 475 Networks - Lecture 7 24 Spanning Tree Algorithm The algorithm works as follows to allow each bridge to select ports over which it will forward packets: Each bridge has a unique ID (B1, B2). The bridge with the smallest ID is the root bridge. The root forwards packets out all ports. Each bridge computes the shortest path (# of hops) to the root and notes which port is on this path. This port is used as the preferred path to the root. Thursday, September 15 CS 475 Networks - Lecture 7 25 Spanning Tree Algorithm On each LAN one bridge is selected as the designated bridge for forwarding frames toward the root. The designated bridge is the one closest to the root (if there is a tie, the lowest ID wins). Each bridge is connected to multiple LANs and it participates in election of a designated bridge for each LAN it is connected to. The bridge forwards frames over those ports for which it is the designated bridge. Thursday, September 15 CS 475 Networks - Lecture 7 26 Spanning Tree Algorithm B5 is the designated bridge for LAN A because it is closer to the root (B1) than B3. It is also the designated bridge for LAN B because it has a lower ID than B7. Fig. 3.14 Spanning tree with removed ports Thursday, September 15 CS 475 Networks - Lecture 7 27 Spanning Tree Algorithm Ports not in the spanning tree neither accept or transmit frames. Frames from LAN B addressed (or broadcast frames) to nodes in LAN K would follow the B1-B5-B7 path. Note that bridges B3 and B6 are currently unused. If bridge B5 were to go down the algorithm is rerun, and bridges B3 and B7 would become designated bridges for LANs A and B, respectively. The network would function normally. Thursday, September 15 CS 475 Networks - Lecture 7 28 Spanning Tree Algorithm In real networks the spanning tree is created by bridges passing configuration messages to each other and then deciding whether or not they are a root or designated bridge (refer to the text for details). Each configuration message contains the following information: 1) The ID for the bridge sending the message 2) The ID of the bridge thought to be root 3) The distance (hops) to the root Thursday, September 15 CS 475 Networks - Lecture 7 29 Broadcast and Multicast Bridges forward broadcast frames on each active (selected) port other than the one on which it is received. Multicasts can be handled in the same way, but they can be handled more efficiently. If no hosts on a segment of the spanning tree are receiving the multicast the segment can be pruned. Each host in a multicast group must periodically send a frame to the multicast address so that the bridge does not prune the segment containing the host. Thursday, September 15 CS 475 Networks - Lecture 7 30 Limitations of Bridges Bridges should be used only to connect 10 or so LANs. The spanning tree algorithm scales linearly and broadcast messages are sent across the extended LAN. One approach to building larger networks is to use routers to connect (extended) LANs. We will discuss routing in Section 3.3. Newer LAN switches provide support for virtual LANs (VLAN). VLANs allow a bridged network to be partitioned into smaller separate LANs. Thursday, September 15 CS 475 Networks - Lecture 7 31 Limitations of Bridges Ports on LAN switches can be assigned to particular VLANs. Packets can be sent (using only MAC addressing) between hosts on the the same VLAN. Broadcast messages are restricted to the same VLAN. Frames on VLAN 100 are never forwarded to VLAN 200 (and vice versa). The packets must be routed between VLANs. Thursday, September 15 CS 475 Networks - Lecture 7 32 In-class Exercises Problem 3.3 on page 285 Problem 3.13 on page 288 Turn in at the end of class. Thursday, September 15 CS 475 Networks - Lecture 7 33