CPS 356: Introduction to Computer Networks Lecture 7: Switching technologies Ch 2.8.2, 3.1, 3.4 Xiaowei Yang xwy@cs.duke.edu Review: link layer functions • Encoding – NRZ, NRZI, Manchester, 4B/5B • Framing: bit, byte, time-synchronization • Error detection – Parity bits, Internet checksum, CRC • Reliable transmission – Stop-and-wait – Sliding window – Concurrent logical channels • Media Access Control – Ethernet, Token Ring, Wifi (today) Ethernet: Physical properties Sensing the line; if idle, sends signals CSMA/CD: Carrier Sense Multiple access with Collision Detection 10Base5 Collision Domain • Any host hears any other host – A single segment – Multiple segments connected by repeaters – Multiple segments connected by a hub Transmitter Algorithm Begin: Wait until the line is idle and has data to send, the adaptor sends it, and listens to collision – If no, go back to Begin – else exponentially backoff • • randomly selects a k between [0,2n-1], waits for k x 51.2 μs to try Begin again Gives up after n reaches 16 Collision detection • An adaptor senses the signals on the line and compares it with its own – If same, no collision; otherwise, collision – Sends 32-bit jamming sequence after collision • In the worst case, a sender needs to send 512 bits (46+14+4 = 64B) to detection collision – Why? • One way delay is d • A needs to send for 2d duration to detect collision • 2d = 512 μs. On a 10Mps Ethernet, corresponds to 512 bits • The IEEE 802.3 Baseband 5-4-3 – Five physical segments between any two nodes – Four repeaters between the nodes. – Three of these physical segments can have connected node • Each segment < 500m Total < 2500m • Propagation delay for this maximum-extent Ethernet network is 25.6us • 2*d = 512us (tolerating errors) • Minimum Ethernet packet size is 512 bits (64B) – Header 14B, payload 46B, CRC 4B Today • Types of switching – Datagram – Virtual circuit – Source routing • Switching hardware design Packet switching • Problem: single link networks have limited scale • Ethernet < 1024 hosts, 2500 meters • Wireless limited by radio ranges • Point-to-point links connect only two nodes • Packet switches enable packets to travel from one host to another without being directly connected • A packet switch is a device with several inputs and outputs leading to and from the nodes that the switch interconnects A star topology • A switch has a limited number of inputs and outputs ports • Switches can be connected to each other to build larger networks • Adding a new host may not reduce the performance for other hosts – Not true for shared media networks – Why? Switching • A switch connects links • Each link can be of different types • A switch runs an appropriate link layer protocol • Switching (or forwarding): receive incoming packets and send to different outgoing links Switching technologies • Problem: how does a switch decide on which output port to place each packet? • Solution: look at the packet header and makes a decision – Connectionless: datagram – Connection oriented: virtual circuit – Source routing Challenges • Contention – Input rate exceeds output rate • Multiple input ports may send to the same output port – Switches queue packets until contention disappears • Congestion – When a switch runs out of buffer, it discards packets. – Too frequent packet loss is said to be congested Datagram • Every packet contains the destination address – A global unique identifier – Ethernet has 48-bit addresses • A switch maintains a forwarding table that maps a packet to an output port Switch 2’s forwarding table A 3 B 0 C 3 D E F G H Q: how does a switch compute the table? Features of datagram switching • Connectionless: hosts can send anytime. No need to wait for connection to set up • Unknown network state: not sure whether a packet can reach the destination • Independent forwarding: packets may take different paths • Robust to failures: a failure of a switch may not disrupt communications – Switches can re-compute forwarding tables Virtual circuit switching • Connection oriented – Set up a virtual circuit – Data transfer • Connection setup phase – Set up connection state – A virtual circuit identifier, an incoming interface, an outgoing interface, and an outgoing virtual circuit identifier Virtual circuit table (switch1) 11 5 Incoming interface Incoming VCI Outgoing interface Outgoing VCI 2 5 1 11 Virtual circuit switching • Algorithm: – If a packet arrives on the matching incoming port with the matching incoming VCI, it will be sent to the corresponding outgoing port with the corresponding VCI • VCIs are link-local How to setup connection state • Administrator configured – Permanent virtual circuit (PVC) – Admin manually sets up VC tables – Does not suit large networks • Signaling – A host sends messages to dynamically setup or tear down a VC VC setup • A host A sends a setup message to first hop switch, including the final destination address – Similar to a datagram packet • The switch picks an unused VCI to identify the incoming connection, and fills part of the VC table – Why not let the host pick it? • Every switch repeats the process until the packet reaches the destination B • The destination B sends an ack to inform its upstream switch the VCI for the connection IF 2 VCI 5 OF 1 VCI Setup B VCI 11 IF 3 OF 2 VCI Setup B IF 0 VCI 7 OF 1 Setup B Setup B IF 0 VCI 7 OF 1 VCI VCI 4 VCI IF 2 VCI 5 OF 1 VCI VCI 11 IF 3 OF 2 VCI ACK, ACK, 4 IF 0 VCI 7 OF 1 VCI 4 VCI 4 Characteristics of VC switching • Connection setup wait • Data packets contain a small VCI, rather than the full destination addresses • One switch failure tears down the entire connection • Connection sets up require routing algorithms – Setup packet is forwarded using a datagram algorithm VC allows resource reservation • Buffers can be allocated during the setup phase to avoid congestion • An example (X.25) – Buffers allocated during connection setup – Sliding window is run between pairs of nodes (hop-by-hop flow control) – Circuit is rejected if no more buffer Quality of service (QoS) • Connectionless network is difficult to allocate resources – Switches send packets independently – How to associate one packet with other packets? • Virtual circuit can be used to provide different QoS – Allocate a fraction of link bandwidth to each circuit Switching technologies • Connectionless: datagram • Connection oriented: virtual circuit • Source routing Source routing • Source host provides all the information for packets to travel across the network – Packets carry output port numbers – Packets carry switch addresses – Variable header length Handling source routing headers • Rotation • Stripping – No return path! • Pointer Loose or strict source routing • Strict – Must visit every node on the path • Loose – Waypoints rather than the complete route Overview • Types of switching – Datagram – Virtual circuit – Source routing • Switching hardware design – How to build switches? Software switch • Packets cross the bus twice – Half of the memory bus speed • 133Mhz, 64-bit wide I/O bus 4Gpbs • Short packets reduce throughput – 1Mpps, 64 bytes packet – Throughput = 512 Mbps – Shared by 10 ports: 51.2Mbps Hardware switches • Ports communicate with the outside world – Eg, maintains VC tables • Switching fabric is simple and fast Performance bottlenecks • Input port – Line speed: 2.48 Gbps • 2.48x109/(64x8) = 4.83 Mpps • Buffering – Head of line blocking – May limit throughput to only 59% – Use output buffers or sophisticated buffer management algorithms to improve performance Fabrics • Shared bus – The workstation switch • Shared memory – Input ports read packets to shared memory – Output ports read them out to links Fabrics • Cross bar – Each output ports need to accept from all input ports Fabrics • Self routing – a self-routing header added by the input port – Most scalable – Often built from 2x2 switching units An example of self-routing • 3-bit numbers are self-routing headers • Multiple 2x2 switching elements – 0: upper output; 1: lower output Summary • Types of switching – Datagram • Forwarding table • Simple, difficult to have QoS – Virtual circuit • Datagram for connection setup • Smaller VC identifiers – Source routing • Packets carry forwarding information • Variable header length • Switching hardware design – Shared bus, shared memory, cross-bar, self-routing • Next lecture – How is forwarding table computed? – ATM network