* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download 3rd Edition, Chapter 5
Survey
Document related concepts
Zero-configuration networking wikipedia , lookup
Airborne Networking wikipedia , lookup
Network tap wikipedia , lookup
Computer network wikipedia , lookup
IEEE 802.1aq wikipedia , lookup
Cracking of wireless networks wikipedia , lookup
Point-to-Point Protocol over Ethernet wikipedia , lookup
IEEE 802.11 wikipedia , lookup
Wake-on-LAN wikipedia , lookup
Deep packet inspection wikipedia , lookup
Multiprotocol Label Switching wikipedia , lookup
Asynchronous Transfer Mode wikipedia , lookup
Internet protocol suite wikipedia , lookup
Recursive InterNetwork Architecture (RINA) wikipedia , lookup
Transcript
Chapter 5 Link Layer and LANs A note on the use of these ppt slides: We’re making these slides freely available to all (faculty, students, readers). They’re in PowerPoint form so you can add, modify, and delete slides (including this one) and slide content to suit your needs. They obviously represent a lot of work on our part. In return for use, we only ask the following: If you use these slides (e.g., in a class) in substantially unaltered form, that you mention their source (after all, we’d like people to use our book!) If you post any slides in substantially unaltered form on a www site, that you note that they are adapted from (or perhaps identical to) our slides, and note our copyright of this material. Computer Networking: A Top Down Approach 4th edition. Jim Kurose, Keith Ross Addison-Wesley, July 2007. Thanks and enjoy! JFK/KWR All material copyright 1996-2007 J.F Kurose and K.W. Ross, All Rights Reserved 5: DataLink Layer 5-1 Chapter 5: The Data Link Layer Our goals: understand principles behind data link layer services: error detection, correction sharing a broadcast channel: multiple access link layer addressing reliable data transfer, flow control: done! instantiation and implementation of various link layer technologies 5: DataLink Layer 5-2 Link Layer 5.1 Introduction and services 5.2 Error detection and correction 5.3Multiple access protocols 5.4 Link-Layer Addressing 5.5 Ethernet and other data link layers 5.6 Hubs and switches 5.7 PPP 5.8 Link Virtualization: ATM and MPLS 5: DataLink Layer 5-3 Link Layer: Introduction Some terminology: hosts and routers are nodes communication channels that connect adjacent nodes along communication path are links wired links wireless links LANs layer-2 packet is a frame, encapsulates datagram data-link layer has responsibility of transferring datagram from one node to adjacent node over a link 5: DataLink Layer 5-4 Adaptors Communicating datagram sending node frame frame adapter link and physical layers implemented in adaptor/NIC (Network Interface Card) RAM, DSP chips, host bus interface, and link interface Ethernet card, PCMCIA card, 802.11 card sending side: rcving node link layer protocol encapsulates datagram in a frame adds error checking bits, rdt, flow control, etc. adapter receiving side looks for errors, rdt, flow control, etc extracts datagram, passes to upper layer at receiving side datagram transferred by different link protocols over different links: e.g., Ethernet on first link, frame relay on intermediate links, 802.11 on last link 5: DataLink Layer 5-5 Protocol stack picture M Ht M Hn Ht M Hl Hn Ht M application transport network link physical data link protocol phys. link network link physical Hl Hn Ht M frame adapter card 5: DataLink Layer 5-6 Host adaptor host schematic application transport network link cpu memory controller link physical host bus (e.g., PCI) physical transmission network adapter card 5: DataLink Layer 5-7 Link Layer Functions Flow Control pacing between adjacent sending and receiving nodes Reliable delivery between adjacent nodes we learned how to do this already (chapter 3)! seldom used on low bit error link (i.e. fiber, twisted pair) wireless links: high error rates • Eschew end-to-end principle for performance Security Demux to upper protocol Framing encapsulate datagram into frame, adding header, trailer 5: DataLink Layer 5-8 Link Layer Functions (more) Error Detection errors caused by signal attenuation, noise. receiver detects presence of errors: • signals sender for retransmission or drops frame Error Correction receiver identifies and corrects bit error(s) without resorting to retransmission Medium access and quality of service channel access if shared medium Addressing “MAC” addresses used in frame headers to identify source, dest (different from IP address) 5: DataLink Layer 5-9 Flow control Pacing between sender and receiver Sender prevented from overrunning receiver Ready-To-Send, Clear-To-Send signalling 5: DataLink Layer 5-10 Reliable delivery Reliability at the link layer Handled in a similar manner to transport protocols ARQ, Stop-and-wait, Go-back-N, Selective Repeat When and why should this be used? Rarely done over twisted-pair or fiber optic links Usually done over lossy links for performance improvement (versus correctness) 5: DataLink Layer 5-11 Security Mainly for broadcast data-link layers Encrypt payload of higher layers Hide IP source/destination from eavesdroppers Important for wireless LANs especially • Parking lot attacks with 802.11b • WEP, WPA If time permits, security will be covered at the end of the course…. 5: DataLink Layer 5-12 Demux to upper protocol Protocol type specification interfaces to network layer Data-link layer can support any number of network layers Type field in data-link header specifies network layer of packet Each data-link layer defines its own protocol type numbering for network layer IP is one of many network layers 5: DataLink Layer 5-13 Demux to upper protocol http://www.cavebear.com/CaveBear/Ethernet/type.html Some Ethernet protocol types – – – – – 0800 DOD Internet Protocol (IP) 0806 Address Resolution Protocol (ARP) 8037 IPX (Novell Netware) 80D5 IBM SNA Services 809B EtherTalk (AppleTalk over Ethernet) 5: DataLink Layer 5-14 Framing Data encapsulation for transmission over physical link Data embedded within a link-layer frame before transmission Data-link header and/or trailer added Physical addresses used in frame headers to identify source and destination (not IP) 5: DataLink Layer 5-15 Fixed length framing Length delimited Beginning of frame has length Single corrupt length can cause problems • Must have start of frame character to resynchronize • Resynchronization can fail if start of frame character is inside packets as well 5: DataLink Layer 5-16 Variable length framing Byte stuffing Special start of frame byte (e.g. 0xFF) Special escape byte value (e.g. 0xFE) Values actually in text are replaced (e.g. 0xFF by 0xFEFF and 0xFE by 0xFEFE) Worst case – can double the size of frame Bit stuffing Special bit sequence (0x01111110) 0 bit stuffed after any 11111 sequence 5: DataLink Layer 5-17 Clock-Based Framing Used by SONET Fixed size frames (810 bytes) Look for start of frame marker that appears every 810 bytes Will eventually sync up 5: DataLink Layer 5-18 Link Layer 5.1 Introduction and services 5.2 Error detection and correction 5.3Multiple access protocols 5.4 Link-Layer Addressing 5.5 Ethernet and other data link layers 5.6 Hubs and switches 5.7 PPP 5.8 Link Virtualization: ATM 5: DataLink Layer 5-19 Error detection/correction Errors caused by signal attenuation, noise. Receiver detects presence of errors Possible actions Signal sender for retransmission Drops frame Correct bit errors if possible and continue 5: DataLink Layer 5-20 Error Detection EDC= Error Detection and Correction bits (redundancy) D = Data protected by error checking, may include header fields • Error detection not 100% reliable! • protocol may miss some errors, but rarely • larger EDC field yields better detection and correction 5: DataLink Layer 5-21 Parity Checking Single Bit Parity: Detect single bit errors Two Dimensional Bit Parity: Detect and correct single bit errors 0 0 5: DataLink Layer 5-22 Cyclic Redundancy Check (CRC) Polynomial code Treat data bits as coefficients of n-bit polynomial Choose r+1 bit generator polynomial G • G well known – chosen in advance Add r bits to packet so that message is divisible by G • At receiver, divide payload by generator polynomial • If result not zero, error detected Better loss detection properties than checksums All single bit errors, all double bit errors, all oddnumbered errors, burst errors less than r Widely used in practice (802.11, WiFi, ATM, SCTP) 5: DataLink Layer 5-23 Cyclic Redundancy Check (CRC) Calculate code using modulo 2 division of data by generator polynomial Subtraction equivalent to XOR Weak definition of magnitude • X >= Y iff position of highest 1 bit of X is the same or greater than the highest 1 bit of Y Record remainder “R” after division and attach “R” after data Result divisible by generator polynomial 5: DataLink Layer 5-24 Cyclic Redundancy Check (CRC) 5: DataLink Layer 5-25 CRC example Data: 101110 Generator Polynomial: x3 + 1 (1001) Send: 101110011 5: DataLink Layer 5-26 CRC example Data: 10000 Generator Polynomial: x2 + 1 (101) Send: G 101 1000000 5: DataLink Layer 5-27 CRC example Data: 10000 Generator Polynomial: x2 + 1 (101) Send: 1000001 G 101 101 1000000 101 010 000 100 101 010 000 100 101 01 D R 5: DataLink Layer 5-28 Cyclic Redundancy Check (CRC) CRC-16 implementation Shift register and XOR gates 5: DataLink Layer 5-29 CRC polynomials CRC-16 = x16 + x15 + x2+ 1 (used in HDLC) CRC-CCITT = x16 + x12 + x5 + 1 CRC-32 = x32 + x26 + x23 + x22 + x16 + x12 + x11 + x10 + x8 + x7 + x5 + x4 + x2 + x + 1 (used in Ethernet) 5: DataLink Layer 5-30 Forward error correction FEC Use error correcting codes to repair losses Add redundant information which allows receiver to correct bit errors See information and coding theory work. 5: DataLink Layer 5-31 Link Layer 5.1 Introduction and services 5.2 Error detection and correction 5.3Multiple access protocols 5.4 Link-Layer Addressing 5.5 Ethernet and other data link layers 5.6 Hubs and switches 5.7 PPP 5.8 Link Virtualization: ATM 5: DataLink Layer 5-32 Multiple Access Links and Protocols Two types of “links”: point-to-point PPP for dial-up access point-to-point link between Ethernet switch and host broadcast (shared wire or medium) old-fashioned Ethernet upstream HFC (cable) 802.11 wireless LAN shared wire (e.g., cabled Ethernet) shared RF (e.g., 802.11 WiFi) shared RF (satellite) humans at a cocktail party (shared air, acoustical) 5: DataLink Layer 5-33 Multiple access problem Point-to-point link and switched media no problem Broadcast links? Network arbitration Give everyone a fixed time/freq slot? • Ok for fixed bandwidth (e.g., voice) • What if traffic is bursty? Centralized arbiter • Ex: cell phone base station • Single point of failure Distributed arbitration • Aloha/Ethernet Humans use multiple access protocols all the time 5: DataLink Layer 5-34 Multiple access protocols single shared communication channel two or more simultaneous transmissions by nodes: interference only one node can send successfully at a time multiple access protocol: distributed algorithm that determines how stations share channel, i.e., determine when station can transmit communication about channel sharing uses channel itself! what to look for in multiple access protocols: • synchronous or asynchronous • amount of information needed about other stations • robustness (e.g., to channel errors) • performance 5: DataLink Layer 5-35 Ideal Multiple Access Protocol Broadcast channel of rate R bps 1. Efficient: When one node wants to transmit, it can send at rate R. 2. Fair: When M nodes want to transmit, each can send at average rate R/M 3. Fully decentralized: no special node to coordinate transmissions no synchronization of clocks, slots 4. Simple 5: DataLink Layer 5-36 MAC Protocols: a taxonomy Three broad classes: Channel Partitioning divide channel into smaller “pieces” (time slots, frequency, code) allocate piece to node for exclusive use Random Access channel not divided, allow collisions “recover” from collisions “Taking turns” tightly coordinate shared access to avoid collisions Nodes take turns, but nodes with more to send can take longer turns 5: DataLink Layer 5-37 Channel Partitioning MAC protocols: TDMA TDMA: time division multiple access channel divided into N time slots, one per user access to channel in "rounds" inefficient with low duty cycle users and at light load each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example: 6-station LAN, 1,3,4 have pkt, slots 2,5,6 idle 6-slot frame 1 3 4 1 3 4 5: DataLink Layer 5-38 Channel Partitioning MAC protocols: FDMA FDMA: frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example: 6-station LAN, 1,3,4 have pkt, frequency FDM cable frequency bands bands 2,5,6 idle 5: DataLink Layer 5-39 Channel Partitioning MAC protocols CDMA (Code Division Multiple Access) unique “code” assigned to each user; ie, code set partitioning used mostly in wireless broadcast channels (cellular, satellite,etc) each user has own “chipping” sequence (ie, code) to encode data encoded signal = (original data) X (chipping sequence) decoding: inner-product of encoded signal and chipping sequence allows multiple users to “coexist” and transmit simultaneously with minimal interference (if codes are “orthogonal”) 5: DataLink Layer 5-40 Channel Partitioning MAC protocols CDMA Encode/Decode 5: DataLink Layer 5-41 Channel Partitioning MAC protocols CDMA: two sender interference 5: DataLink Layer 5-42 Random Access Protocols When node has packet to send transmit at full channel data rate R. no a priori coordination among nodes two or more transmitting nodes ➜ “collision”, To avoid deterministic collisions: randomize random access MAC protocol specifies: • how to detect collisions • how to recover from collisions (e.g., via delayed retransmissions) • “Asynchronous” TDMA Examples of random access MAC protocols: slotted ALOHA ALOHA CSMA, CSMA/CD, CSMA/CA 5: DataLink Layer 5-43 Slotted ALOHA Assumptions all frames same size time is divided into equal size slots, time to transmit 1 frame nodes start to transmit frames only at beginning of slots nodes are synchronized if 2 or more nodes transmit in slot, all nodes detect collision Operation when node obtains fresh frame, it transmits in next slot no collision, node can send new frame in next slot if collision, node retransmits frame in each subsequent slot with prob. p until success 5: DataLink Layer 5-44 Slotted ALOHA Pros single active node can continuously transmit at full rate of channel highly decentralized: only slots in nodes need to be in sync simple Cons collisions, wasting slots idle slots nodes may be able to detect collision in less than time to transmit packet clock synchronization 5: DataLink Layer 5-45 Slotted Aloha efficiency Efficiency is the long-run fraction of successful slots when there are many nodes, each with many frames to send Suppose N nodes with many frames to send, each transmit in slot with probability p prob that node 1 has success in a slot = p(1-p)N-1 prob that any node has a success = Np(1-p)N-1 For max efficiency with N nodes, find p* that maximizes Np(1-p)N-1 For many nodes, take limit of Np*(1-p*)N-1 as N goes to infinity, gives 1/e = .37 At best: channel used for useful transmissions 37% of time! 5: DataLink Layer 5-46 Pure (unslotted) ALOHA unslotted Aloha: simpler, no synchronization when frame arrives Send without awaiting for beginning of slot collision probability increases: frame sent at t0 collides with other frames sent in [t0-1,t0+1] 5: DataLink Layer 5-47 Pure Aloha efficiency P(success by given node) = P(node transmits) . P(no other node transmits in [p0-1,p0] . P(no other node transmits in [p0,p0+1] = p . (1-p)(N-1) . (1-p) (N-1) P(success by any of N nodes) = N p . (1-p) (N-1). (1-p) (N-1) S = throughput = “goodput” (success rate) … choosing optimum p as n -> infty ... = 1/(2e) = .18 0.4 0.3 Slotted Aloha 0.2 0.1 Pure Aloha 0.5 1.0 1.5 2.0 G = offered load = Np protocol constrains effective channel throughput! 5: DataLink Layer 5-48 CSMA (Carrier Sense Multiple Access) Human analogy: don’t interrupt others! Listen before transmitting CSMA algorithm If channel sensed idle: transmit entire frame If channel sensed busy, defer transmission • Persistent CSMA: retry immediately with probability p when channel becomes idle • Non-persistent CSMA: retry after random interval 5: DataLink Layer 5-49 CSMA collisions spatial layout of nodes collisions can still occur: propagation delay means two nodes may not hear each other’s transmission collision: entire packet transmission time wasted note: role of distance & propagation delay in determining collision probability 5: DataLink Layer 5-50 CSMA/CD (Collision Detection) Human analogy: the polite conversationalist CSMA/CD algorithm Carrier sensing, deferral as in CSMA Attempt to detect collisions while sending Abort colliding transmissions as soon as possible to reduce channel wastage Collision detection: Easy in wired LANs: measure signal strengths, compare transmitted, received signals Collisions detected within short time 5: DataLink Layer 5-51 CSMA/CD collision detection 5: DataLink Layer 5-52 CSMA/CD problems Can CSMA/CD work over wireless LANs? Collision detection difficult in wireless LANs: receiver shut off while transmitting Hidden terminal problem 5: DataLink Layer 5-53 Hidden Terminal effect A, C cannot hear each other obstacles, signal attenuation Neither A nor C can tell if they collide at B 5: DataLink Layer 5-54 CSMA/CA: CSMA w/ collision avoidance Use base CSMA Add acknowledgements Receiver acknowledges receipt of data Avoids hidden terminal problem Avoid collisions explicitly via channel reservation Sender sends “request-to-send” (RTS) messages • Transmitted without reservation using CSMA with ACKs Receiver sends “clear-to-send” (CTS) messages • Transmitted without reservation using CSMA with ACKs Sender sends data packet using reservation • Explicitly indicates length of so others know how long to back off Used in 802.11 wireless LAN networks 5: DataLink Layer 5-55 “Taking Turns” MAC protocols Recall, channel partitioning MAC protocols: share channel efficiently and fairly at high load inefficient at low load: delay in channel access, 1/N bandwidth allocated even if only 1 active node! Random access MAC protocols efficient at low load: single node can fully utilize channel high load: collision overhead “taking turns” protocols look for best of both worlds! 5: DataLink Layer 5-56 “Taking Turns” MAC protocols Polling: master node “invites” slave nodes to transmit in turn RTS, CTS messages typically used with “dumb” slave devices concerns: data polling overhead latency single point of failure (master) poll master data slaves 5: DataLink Layer 5-57 “Taking Turns” MAC protocols Token passing: control token passed from one node to next sequentially. token message concerns: token overhead latency single point of failure (token) T (nothing to send) T data 5: DataLink Layer 5-58 Taking-turns protocols Distributed Polling: time divided into slots begins with N short reservation slots reservation slot time equal to channel end-end propagation delay station with message to send posts reservation reservation seen by all stations after reservation slots, message transmissions ordered by known priority 5: DataLink Layer 5-59 Summary of MAC protocols What do you do with a shared media? Channel Partitioning • Time Division • Frequency Division • Code Division Random partitioning (dynamic), • ALOHA, S-ALOHA, CSMA, CSMA/CD • carrier sensing: easy in some technologies (wire), hard in others (wireless) • CSMA/CD used in Ethernet • CSMA/CA used in 802.11 Taking Turns • polling from a central site, token passing • Bluetooth, FDDI, IBM Token Ring 5: DataLink Layer 5-60 Link Layer 5.1 Introduction and services 5.2 Error detection and correction 5.3Multiple access protocols 5.4 Link-Layer Addressing 5.5 Ethernet and other data link layers 5.6 Hubs and switches 5.7 PPP 5.8 Link Virtualization: ATM 5: DataLink Layer 5-61 MAC Addresses MAC/LAN/physical/Ethernet address: used to get frame from one interface to another physically-connected interface (same network) Globally unique 48 bit address (for most LANs) burned in the adapter ROM • ifconfig –a Administered by IEEE • manufacturer buys portion of MAC address space to assure uniqueness 5: DataLink Layer 5-62 LAN Addresses Each adapter on LAN has unique LAN address 1A-2F-BB-76-09-AD 71-65-F7-2B-08-53 LAN (wired or wireless) Broadcast address = FF-FF-FF-FF-FF-FF = adapter 58-23-D7-FA-20-B0 0C-C4-11-6F-E3-98 5: DataLink Layer 5-63 MAC vs IP addressing MAC address Flat (not hierarchical) • Like Social Security Numbers • Does not change when machine is moved (portable) IP addresses Hierarchically organized • Like postal address • Depends on IP subnet that node is attached to • Must change when machine is moved (not portable) Why have separate IP and hardware addresses? Assign adapters an IP address • Hardware only works for IP (no IPX, DECNET) Use hardware address as network address • No route aggregation 5: DataLink Layer 5-64 ARP: Address Resolution Protocol Question: how to determine MAC address of B given B’s IP address? 237.196.7.78 1A-2F-BB-76-09-AD 237.196.7.23 237.196.7.14 LAN 71-65-F7-2B-08-53 237.196.7.88 ARP Broadcast interest in B’s MAC address B responds with its MAC address Keep track of mappings in ARP table • IP/MAC address mappings for LAN nodes 58-23-D7-FA-20-B0 < IP address; MAC address; TTL> • TTL (Time To Live) 0C-C4-11-6F-E3-98 • Soft state 5: DataLink Layer 5-65 ARP protocol: Same LAN (network) A knows B’s IP address and wants to send datagram to B, and B’s MAC address not in A’s ARP table. A broadcasts ARP query packet, containing B's IP address Dest MAC address = FF-FF-FF-FF-FF-FF all machines on LAN receive ARP query B receives ARP packet, replies to A with its (B's) MAC address frame sent to A’s MAC address (unicast) A caches (saves) IP-to- MAC address pair in its ARP table until information becomes old (times out) soft state: information that times out (goes away) unless refreshed ARP is “plug-and-play”: nodes create their ARP tables without intervention from net administrator • arp –a • /proc/net/arp 5: DataLink Layer 5-66 Routing to another LAN walkthrough: send datagram from A to B via R assume A knows B’s IP address A R B Two ARP tables in router R, one for each IP network (LAN) In routing table at source Host, default route 111.111.111.110 A creates datagram with source A, destination B 5: DataLink Layer 5-67 A checks route table to find B is not on its network A uses ARP to get R’s MAC address (ARP for 111.111.111.110) A creates link-layer frame with R's MAC address as dest, frame contains A-to-B IP datagram A’s adapter sends frame R’s adapter receives frame R removes IP datagram from Ethernet frame, sees its destined to B R uses ARP to get B’s MAC address R creates frame containing A-to-B IP datagram sends to B A R B 5: DataLink Layer 5-68 DHCP Q: How does host get an IP address on subnet? hard-coded by system admin in a file Wintel: control-panel->network->configuration->tcp/ip>properties UNIX: /etc/rc.config DHCP: Dynamic Host Configuration Protocol: dynamically get address from server “plug-and-play” Given a hardware address, give me the IP address • Predecessors: RARP, BOOTP • Opposite of ARP (given IP address, give me MAC address) 5: DataLink Layer 5-69 DHCP: Dynamic Host Configuration Protocol Goal: allow host to dynamically obtain its IP address from network server when it joins network Allows reuse of addresses (only hold address while connected and “on”) Support for mobile users who want to join network Can renew its lease on address in use DHCP overview: host broadcasts “DHCP discover” msg DHCP server responds with “DHCP offer” msg host requests IP address: “DHCP request” msg DHCP server sends address: “DHCP ack” msg 5: DataLink Layer 5-70 DHCP client-server scenario A B 223.1.2.1 DHCP server 223.1.1.1 223.1.1.2 223.1.1.4 223.1.2.9 223.1.2.2 223.1.1.3 223.1.3.1 223.1.3.27 223.1.3.2 E arriving DHCP client needs address in this (223.1.2.0/24) network 5: DataLink Layer 5-71 DHCP client-server scenario DHCP server: 223.1.2.5 DHCP discover arriving client src : 0.0.0.0, 68 dest.: 255.255.255.255,67 yiaddr: 0.0.0.0 transaction ID: 654 DHCP offer src: 223.1.2.5, 67 dest: 255.255.255.255, 68 yiaddrr: 223.1.2.4 transaction ID: 654 Lifetime: 3600 secs DHCP request time src: 0.0.0.0, 68 dest:: 255.255.255.255, 67 yiaddrr: 223.1.2.4 transaction ID: 655 Lifetime: 3600 secs DHCP ACK src: 223.1.2.5, 67 dest: 255.255.255.255, 68 yiaddrr: 223.1.2.4 transaction ID: 655 Lifetime: 3600 secs 5: DataLink Layer 5-72 Link Layer 5.1 Introduction and services 5.2 Error detection and correction 5.3Multiple access protocols 5.4 Link-Layer Addressing 5.5 Ethernet and other data link layers 5.6 Hubs and switches 5.7 PPP 5.8 Link Virtualization: ATM 5: DataLink Layer 5-73 Specific data-link layers Specific data-link layers Ethernet (802.3) Token Ring (802.5) WiFi (802.11) Frame relay Special link layers covered later (PPP, ATM) 5: DataLink Layer 5-74 Ethernet's implementation of data-link layer Framing (special pre-amble within frame) Physical addressing (6 byte hardware addresses) Demux to upper protocol (type field in header) Flow control (none) Error detection and correction (CRC-32) Reliable delivery (none) Security (none) Media access and quality of service (CSMA/CD with adaptive, randomized wait) Digital to analog conversion (Manchester encoding) 5: DataLink Layer 5-75 Ethernet “dominant” wired LAN technology: First practical local area network, built at Xerox PARC in 70’s • first widely used LAN technology Simpler, cheaper than token LANs and ATM • cheap: $3 for 100Mbs NIC Metcalfe’s Ethernet sketch 5: DataLink Layer 5-76 Ethernet topologies Flexible topologies Bus topology popular through mid 90s • all nodes in same collision domain • requires the use of CSMA/CD Star topology today • active switch in center • each “spoke” runs a (separate) Ethernet protocol (nodes do not collide with each other) switch bus: coaxial cable star 5: DataLink Layer 5-77 Ethernet Frame Structure Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame Preamble: 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 used to synchronize receiver, sender clock rates 5: DataLink Layer 5-78 Ethernet Frame Structure (more) Addresses: 6 bytes Globally unique, allocated to manufacturers if adapter receives frame with matching destination address, or with broadcast address (eg ARP packet), it passes data in frame to net-layer protocol otherwise, adapter discards frame Type: indicates the higher layer protocol mostly IP but others include Novell IPX and AppleTalk Data – 46 to 1500 bytes CRC: 4 bytes checked at receiver, if error is detected, frame is dropped CRC-32 • (x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1) 5: DataLink Layer 5-79 Unreliable, connectionless service Connectionless: No handshaking between sending and receiving adapter. Unreliable: receiving adapter doesn’t send acks or nacks to sending adapter stream of datagrams passed to network layer can have gaps gaps will be filled if app is using TCP otherwise, app will see the gaps 5: DataLink Layer 5-80 Ethernet CSMA/CD algorithm 1. Adaptor receives datagram from 5. Random access: After aborting, net layer & creates frame adapter enters exponential 2. Carrier sensing: If adapter backoff before returning to senses channel idle, it starts to Step 2 transmit frame. If it senses after m th collision, choose K channel busy, waits until channel randomly out of {0,1,2,…2m-1}. idle and then transmits Wait K*512 bit times 3. If adapter transmits entire first collision: choose K from frame without detecting {0,1}; delay is K· 512 bit another transmission, the transmission times adapter is done with frame ! 4. Collision detection: If adapter detects another transmission while transmitting, aborts and sends jam signal (make sure all adapters see collision: 48 bits) after second collision: choose K from {0,1,2,3}… after ten collisions, choose K from {0,1,2,3,4,…,1023} 5: DataLink Layer 5-81 Exponential backoff calculation Goal: adapt retransmission attempts to estimated current load heavy load: random wait will be longer Deterministic delay after collision • Collision will occur again in lockstep Random delay with fixed mean • Few senders needless waiting • Too many senders too many collisions Exponentially increasing random delay • Infer senders from # of collisions • More senders increase wait time See/interact with Java applet on AWL Web site: highly recommended ! 5: DataLink Layer 5-82 General Ethernet CSMA/CD Packet? No Sense Carrier Send Detect Collision Yes Discard Packet attempts < 16 b=CalcBackoff(); wait(b); attempts++; attempts == 16 5: DataLink Layer 5-83 Ethernet CSMA/CD and Packet Size What if two people sent really small packets How do you find collision? Must have a minimum packet size Min packet length > 2x max prop delay If A, B are at opposite sides of link, and B starts one link prop delay after A 5: DataLink Layer 5-84 Propagation delay & packet size Propagation delay determines min. packet size to prevent undetected collisions Modern 10Mb Ethernet Segment length to support? • 500m maximum segment length • Can add repeaters up to a maximum 5 segments (2500m) Propagation delay for maximum segment • c in cable = 60% * c in vacuum = 1.8 x 10^8 m/s • ~ 12.5us one-way delay Add repeater and tranceiver delay • To be safe IEEE specifies a 512 “bit-time” slot for Ethernet = 51.2us • 512 bits = 64 bytes (minimum data payload = 46 bytes) 5: DataLink Layer 5-85 Minimum packet size What about scaling? 100Mbit, 1Gbit... Make network smaller? Solution for 100BaseT Make min pkt size larger? 512bits @ 1Gbps = 512ns 512ns * 1.8 * 10^8 = 92meters Gigabit ethernet uses collision extension for small pkts 5: DataLink Layer 5-86 Ethernet Problems Ethernet unstable at high loads Peak throughput worse with More hosts – more collisions needed to identify single sender Smaller packet sizes – more frequent arbitration Longer links – collisions take longer to observe, more wasted bandwidth 5: DataLink Layer 5-87 Token Rings Packets broadcast around ring Token “right to send” rotates around ring Fair, real-time bandwidth allocation • Every host holds token for limited time • Higher latency when only one sender 5: DataLink Layer 5-88 Token Passing: IEEE802.5 standard 4 Mbps max token holding time: 10 ms (limits frame length) • SD, ED mark start, end of packet • AC: access control byte: ● ● ● token bit: value 0 means token can be seized, value 1 means data follows FC priority bits: priority of packet reservation bits: station can write these bits to prevent stations with lower priority packet from seizing token after token becomes free 5: DataLink Layer 5-89 Why Did Ethernet Win? Better failure modes Token rings – network unusable Ethernet – node detached Good performance in common case Volume lower cost higher volume …. Adaptable To higher bandwidths (vs. FDDI) To switching (vs. ATM) Completely distributed, easy to maintain/administer Easy incremental deployment Cheap cabling, etc 5: DataLink Layer 5-90 IEEE 802.11 Wireless LAN Untethered (often mobile) networking IEEE 802.11 standard: Defines specific implementations of data-link functions Framing, error detection, MAC, etc. Unlicensed frequency spectrum: 900Mhz, 2.4Ghz 5: DataLink Layer 5-91 IEEE 802.11 Ad-hoc mode Ad hoc network: stations can dynamically form network without AP Applications: “laptop” meeting in conference room, car interconnection of “personal” devices battlefield IETF MANET (Mobile Ad hoc Networks) working group 5: DataLink Layer 5-92 IEEE 802.11 Infrastructure mode Typically used with access point (base station) Several communication methods supported CSMA (with explicit ACK to indicate collision) CSMA/CA: reservations Polling from AP 5: DataLink Layer 5-93 IEEE 802.11 MAC Protocol: CSMA 802.11 CSMA sender - if sense channel idle for DIFS sec. then transmit entire frame (no collision detection) -if sense channel busy then backoff (random, exponential) 802.11 CSMA receiver -if received OK return ACK after SIFS SIFS < DIFS allows acks to grab channel with higher priority 802.11 CSMA others NAV: Network Allocation Vector 802.11 frame has transmission time field others (hearing data) defer access for NAV time units 5: DataLink Layer 5-94 IEEE 802.11 MAC Protocol CSMA/CA Same as previous mode but with explicit channel reservation Send short reservation messages via CSMA to reserve channel • Sender RTS (request to send), Receiver CTS (clear to send) • CTS notifies all hidden stations of sender's reservation • Short messages so that collision less likely and of short duration Send data unobstructed on reserved channel • End result similar to CSMA/CD 5: DataLink Layer 5-95 Link Layer 5.1 Introduction and services 5.2 Error detection and correction 5.3Multiple access protocols 5.4 Link-Layer Addressing 5.5 Ethernet and other data link layers 5.6 Interconnections: Hubs and switches 5.7 PPP 5.8 Link Virtualization: ATM 5: DataLink Layer 5-96 Link-layer devices Q: Why not just one big LAN? limited aggregate bandwidth limited length: electrical limitations large “collision domain” (can collide with many stations) access delay (eg 802.5 token passing delay) 5: DataLink Layer 5-97 Hubs Hubs are essentially physical-layer, multi-port repeaters: bits coming from one link go out all other links at the same rate addresses electrical limitations no frame buffering no CSMA/CD at hub: adapters detect collisions • all nodes connected to hub can collide with one another twisted pair hub 5: DataLink Layer 5-98 Hubs (more) Hubs do not isolate collision domains: node may collide with any node residing at any segment in LAN Hub Advantages: simple, inexpensive device extends maximum distance between node pairs 5: DataLink Layer 5-99 Interconnecting with hubs Backbone hub interconnects LAN segments But individual segment collision domains become one large collision domain Single collision domain results in no increase in max throughput Simultaneous transfers between A to A’ and B to B’ collide Multi-tier throughput same as single segment throughput Can’t interconnect 10BaseT & 100BaseT hub hub A hub hub B A’ B’ 5: DataLink Layer 5-100 Switches Link Layer device Smarter than hubs Actively stores and forwards Ethernet frames Examines frame header and selectively forwards frame based on destination MAC address Two-port switch known as a “bridge” Switches known as “multi-port” bridges A switch isolates collision domains since it buffers frames Uses CSMA/CD to access individual network segments to transmit frames Transparent to hosts Plug-and-play, self-learning (do not need to be configured) 5: DataLink Layer 5-101 Switches: multiple simultaneous transmissions Hosts have dedicated direct connection to switch Ethernet protocol and frame used, but… C’ B No collisions • Each link is its own collision domain A Full duplex operation switch Switch buffers frames Much greater aggregate C bandwidth Data backplane of switches typically large to support simultaneous transfers amongst ports B’ A’ Switching: A-to-A’ and B-to-B’ simultaneously, no collisions 5: DataLink Layer 5-102 Switches (more) Switch advantages: Isolates collision domains resulting in higher total max throughput Can connect different type Ethernet since it is a store and forward device Transparent: no need for any change to hosts LAN adapters 5: DataLink Layer 5-103 Switch operation switch 1 2 hub 3 hub hub How do determine onto which LAN segment to forward frame? Looks like a routing problem... 5: DataLink Layer 5-104 Self learning Approach Monitor traffic to build a cache (switch table) of which nodes are downstream of which ports • (MAC Address, Interface, Time Stamp) • learns which hosts can be reached through which interfaces Selectively forward frames based on cache entries Flood network for frames with unknown (MAC) destinations 5: DataLink Layer 5-105 Switch algorithm When frame received: 1. record link associated with sending host 2. index switch table using MAC dest address 3. if entry found for destination then { if dest on segment from which frame arrived then drop the frame else forward the frame on interface indicated } else flood forward on all but the interface on which the frame arrived 5: DataLink Layer 5-106 Switch example Suppose C sends frame to D 1 3 2 B C hub hub hub A address interface switch I D E F G A B E G C 1 1 2 3 1 H Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table, switch forwards frame into interfaces 2 and 3 frame received by D 5: DataLink Layer 5-107 Switch example Suppose D replies back with frame to C. 1 3 2 B C hub hub hub A address interface switch I D E F G A B E G C D 1 1 2 3 1 2 H Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table, switch forwards frame only to interface 1 frame received by C 5: DataLink Layer 5-108 Switch: traffic isolation switch installation breaks subnet into LAN segments switch filters packets: same-LAN-segment frames not usually forwarded onto other LAN segments segments become separate collision domains switch collision domain hub collision domain hub collision domain hub 5: DataLink Layer 5-109 Switches and Spanning Trees for increased reliability, desirable to have redundant, alternate paths from source to destination with multiple simultaneous paths, cycles result bridges may multiply and forward frame forever solution: organize switches in a spanning tree by disabling subset of interfaces Disabled switch switch 5: DataLink Layer 5-110 Switches vs. Routers both store-and-forward devices routers: network layer devices (examine network layer headers) switches/bridges are link Layer devices routers maintain routing tables, implement routing algorithms swtiches maintain filtering tables, implement filtering, learning and spanning tree algorithms 5: DataLink Layer 5-111 Routers vs. Switches Switches + and + Switch operation is simpler requiring less processing bandwidth - Topologies are restricted with switches: avoid cycles with spanning trees - Switches do not offer protection from broadcast storms (endless broadcasting by a host will be forwarded by a switch) 5: DataLink Layer 5-112 Routers vs. Switches Routers + and + arbitrary topologies can be supported, cycling is limited by TTL counters (and good routing protocols) - require IP address configuration (not plug and play) - require higher processing bandwidth switches do well in small (few hundred hosts) while routers used in large networks (thousands of hosts) 5: DataLink Layer 5-113 Summary comparison hubs routers switches traffic isolation no yes yes plug & play yes no yes optimal routing cut through no yes no yes no yes 5: DataLink Layer 5-114 Link Layer 5.1 Introduction and services 5.2 Error detection and correction 5.3Multiple access protocols 5.4 Link-Layer Addressing 5.5 Ethernet and other data link layers 5.6 Hubs and switches 5.7 PPP 5.8 Link Virtualization: ATM 5: DataLink Layer 5-115 Point to Point Data Link Control Point-to-point links One sender, one receiver, one link Easier than shared broadcast links • No media access control • No need for explicit MAC addressing (ie ARP) Goal of Point-to-Point protocols Layer generic “higher-level” data-link layer functions on top of a variety of point-to-point links • Dial-up phone line, DSL, ISDN etc. • Each different link does its own digital-analog conversion (ie provides bits) • Implement pseudo-link layer on top that implements common functions – Framing, Demux to upper layer, etc. Examples PPP (point-to-point protocol) HDLC: High level data link control (Data link used to be considered “high layer” in protocol stack!) 5: DataLink Layer 5-116 PPP Design Requirements [RFC 1557] packet framing: encapsulation of network-layer datagram in data link frame carry network layer data of any network layer protocol (not just IP) at same time demultiplex upwards bit transparency: must carry any bit pattern in the data field error detection (no correction) connection liveness: detect, signal link failure to network layer network layer address negotiation: endpoint can learn/configure each other’s network address 5: DataLink Layer 5-117 PPP non-requirements no error correction/recovery no flow control out of order delivery OK no need to support multipoint links (e.g., polling) Error recovery, flow control, data re-ordering all relegated to higher layers! 5: DataLink Layer 5-118 PPP Data Frame Flag: delimiter (framing) Address: does nothing (only one option) Control: does nothing; in the future possible multiple control fields Protocol: upper layer protocol to which frame delivered (eg, PPP-LCP, IP, IPCP, etc) 5: DataLink Layer 5-119 PPP Data Frame info: upper layer data being carried check: cyclic redundancy check for error detection 5: DataLink Layer 5-120 Byte Stuffing “data transparency” requirement: data field must be allowed to include flag pattern <01111110> Q: is received <01111110> data or flag? Sender: adds (“stuffs”) extra < 01111101> byte before each <01111110> data byte adds (“stuffs”) extra < 01111101> byte before each <01111101> data byte Receiver: 01111101 byte followed by 01111110 byte: discard first byte, continue data reception single 01111110: flag byte 5: DataLink Layer 5-121 Byte Stuffing flag byte pattern in data to send flag byte pattern plus stuffed byte in transmitted data 5: DataLink Layer 5-122 PPP Data Control Protocol Before exchanging networklayer data, data link peers must configure PPP link (max. frame length, authentication) learn/configure network layer information for IP: carry IP Control Protocol (IPCP) msgs (protocol field: 8021) to configure/learn IP address 5: DataLink Layer 5-123 Link Layer 5.1 Introduction and services 5.2 Error detection and correction 5.3Multiple access protocols 5.4 Link-Layer Addressing 5.5 Ethernet and other data link layers 5.6 Hubs and switches 5.7 PPP 5.8 Link Virtualization: ATM and MPLS 5: DataLink Layer 5-124 Virtualization of networks Virtualization of resources: a powerful abstraction in systems engineering: computing examples: virtual memory, virtual devices Virtual machines: e.g., java IBM VM os from 1960’s/70’s layering of abstractions: don’t sweat the details of the lower layer, only deal with lower layers abstractly 5: DataLink Layer 5-125 The Internet: virtualizing networks 1974: multiple unconnected nets ARPAnet data-over-cable networks packet satellite network (Aloha) packet radio network ARPAnet "A Protocol for Packet Network Intercommunication", V. Cerf, R. Kahn, IEEE Transactions on Communications, May, 1974, pp. 637-648. … differing in: addressing conventions packet formats error recovery routing satellite net 5: DataLink Layer 5-126 The Internet: virtualizing networks Internetwork layer (IP): addressing: internetwork appears as a single, uniform entity, despite underlying local network heterogeneity network of networks Gateway: “embed internetwork packets in local packet format or extract them” route (at internetwork level) to next gateway gateway ARPAnet satellite net 5: DataLink Layer 5-127 Cerf & Kahn’s Internetwork Architecture What is virtualized? two layers of addressing: internetwork and local network new layer (IP) makes everything homogeneous at internetwork layer underlying local network technology cable satellite 56K telephone modem today: ATM, MPLS … “invisible” at internetwork layer. Looks like a link layer technology to IP! 5: DataLink Layer 5-128 Virtual links and tunneling Many options of encapsulating or tunneling packets through a “virtual link” (VPN) Generic Routing Encapsulation (GRE) • PPTP (Point-to-point Tunneling Protocol) • L2F (Layer 2 Forwarding) • L2TP (Layer 2 Tunneling Protocol) Can also be done at network layer via IPsec Encrypt data at a layer below network layer Works for IP packets 5: DataLink Layer 5-129 Virtual links example Treat IP-to-IP session as a virtual LAN link IP_local = IP addr. of client at home assigned by ISP IP_work = IP addr. of client for use in accessing work LAN IP_file_serv = IP addr. of protected file server at work • ACL to only allow access from work LAN IP_VPN_serv = IP addr. of VPN server at work • • • • Authenticates remote client via username/password Assigns remote client an IP address on LAN (IP_work) Responds to ARPs for IP_remote on behalf of client Decapsulates and encapsulates packets to/from client IP Src = IP_local IP Src = IP_work IP Src = IP_file_serv IP Dst = IP_VPN_serv VPN server terminates tunnel IP Src = IP_work IP Src = IP_file_serv 5: DataLink Layer 5-130 ATM and MPLS ATM, MPLS separate networks in their own right different service models, addressing, routing from Internet viewed by Internet as logical link connecting IP routers just like dialup link is really part of separate network (telephone network) 5: DataLink Layer 5-131 Multiprotocol label switching (MPLS) initial goal: speed up IP forwarding by using fixed length label (instead of IP address) to do forwarding borrowing ideas from Virtual Circuit (VC) approach but IP datagram still keeps IP address! Data-link header MPLS header label 20 IP header remainder of payload Exp S TTL 3 1 5 5: DataLink Layer 5-132 MPLS capable routers a.k.a. label-switched router forwards packets to outgoing interface based only on label value (don’t inspect IP address) MPLS forwarding table distinct from IP forwarding tables signaling protocol needed to set up forwarding RSVP-TE forwarding possible along paths that IP alone would not allow (e.g., source-specific routing) !! use MPLS for traffic engineering must co-exist with IP-only routers 5: DataLink Layer 5-133 MPLS forwarding tables in label out label dest 10 12 8 out interface A D A 0 0 1 in label out label dest out interface 10 6 A 1 12 9 D 0 R6 0 0 D 1 1 R3 R4 R5 0 0 R2 in label 8 out label dest 6 A out interface in label 6 outR1 label dest - A A out interface 0 0 5: DataLink Layer 5-134 Chapter 5: Summary principles behind data link layer services: error detection, correction sharing a broadcast channel: multiple access link layer addressing instantiation and implementation of various link layer technologies Ethernet switched LANS PPP virtualized networks as a link layer: ATM, MPLS 5: DataLink Layer 5-135 Physical Layer Functions Digital to Analog conversion Physical media characteristics 5: DataLink Layer 5-136 Digital to analog conversion Bits sent as analog signals Photonic pulses of a given wavelength over optical fiber Electronic signals of a given voltage 5: DataLink Layer 5-137 Digital to analog conversion Will cover electronic transmission (optical transmission left for you to research) Biggest issue When to sample voltage? Detecting sequences involves clocking with the same clock • How to synchronize sender and receiver clocks? Need easily detectible event at both ends • Signal transitions help resync sender and receiver • Need frequent transitions to prevent clock skew http://www.mouse.demon.nl/ckp/telco/encode.h tm 5: DataLink Layer 5-138 NRZ-L Non-Return to Zero Level (NRZ-L) 1=high signal, 0=lower signal Long sequence of same bit causes difficulty • DC bias hard to detect – low and high detected by difference from average voltage • Clock recovery difficult Used by Synchronous Optical Network (SONET) • SONET XOR’s bit sequence to ensure frequent transitions Used in early magnetic tape storage 5: DataLink Layer 5-139 NRZ-L 5: DataLink Layer 5-140 NRZ-M Non-Return to Zero Mark Less power to transmit versus NRZ 1=signal transition at start of bit, 0=no change No problem with string of 1’s NRZ-like problem with string of 0’s Used in SDLC (Synchronous Data Link Control) Used in modern magnetic tape storage 5: DataLink Layer 5-141 Manchester (Bi-Phase-Level) coding Manchester 0=low to high transition, 1=high to low transition Transition for every bit simplifies clock recovery Not very efficient • Doubles the number of transitions • Circuitry must run twice as fast Used by Ethernet 5: DataLink Layer 5-142 Manchester coding Encoding for 110100 Bit stream 1 1 0 1 0 0 Manchester encoding 5: DataLink Layer 5-143 Physical Layer Plethora of physical media Fiber, copper, air Specifies the characteristics of transmission media Too many to cover in detail, not the focus of the course Many data-link layer protocols (i.e. Ethernet, Token-Ring, FDDI. ATM run across multiple physical layers) Physical characteristics dictate suitability of data-link layer protocol and bandwidth limits 5: DataLink Layer 5-144 Common Cabling Copper Twisted Pair • Unshielded (UTP) – CAT-1, CAT-2, CAT-3, CAT-4, CAT-5, CAT-5e • Shielded (STP) Coaxial Cable Fiber Single-mode Multi-mode 5: DataLink Layer 5-145 Twisted Pair Most common LAN interconnection Multiple pairs of twisted wires Twisting to eliminate interference More twisting = Higher data rates, higher cost 5: DataLink Layer 5-146 Twisted pair Standards specify twisting, resistance, and maximum cable length for use with particular data-link layer 5 categories Category 1 • Voice only (telephone wire) Category 2 • Data to 4Mbs (LocalTalk) Category 3 • Data to 10Mbs (Ethernet) Category 4 • Data to 20Mbs (16Mbs Token Ring) Category 5 (100 MHz) • Data to 100Mbs (Fast Ethernet) Category 5e (350 MHz) • Data to 1000Mbs (Gigabit Ethernet) 5: DataLink Layer 5-147 Twisted Pair Common connectors for Twisted Pair RJ11 (3 pairs) • Phone connections RJ45 (4 pairs) • Allows both data and phone connections – (1,2) and (3,6) for data – (4,5) for voice – (7,8) unused • Crossover cables for NIC-NIC, Hub-Hub connection (Data pairs swapped) 5: DataLink Layer 5-148 UTP Unshielded Twisted Pair Limited amount of protection from interference Commonly used for voice and ethernet • Voice: multipair 100-ohm UTP 5: DataLink Layer 5-149 STP Shielded Twisted Pair Not as common at UTP UTP susceptible to radio and electrical interference Extra shielding material added Cables heavier, bulkier, and more costly Often used in token ring topologies • 150 ohm STP two pair (IEEE 802.5 Token Ring) 5: DataLink Layer 5-150 Coaxial cable Two concentric copper conductors Bidirectional Separated by plastic insulation layer Support longer connectivity distances over UTP Used in CATV networks HFC networks (Hybrid Fiber/Coax) • Fiber from cable headend to location near home • Coax to home FDM to support multiple data channels 5: DataLink Layer 5-151 Fiber Transmit light pulses vs. electronic signals Immune to electromagnetic noise/interference high-speed point-to-point transmission (e.g., 10’s-100’s Gps) Low error rate Cabling Center core made of glass or plastic fiber Plastic coating to cushion core Kevlar fiber for strength Teflon or PVC outer insulating jacket 5: DataLink Layer 5-152 Fiber Single-mode fiber Smaller diameter (12.5 microns) One mode only Preserves signal better over longer distances Typically used for SONET or SDH Lasers used to signal Multi-mode fiber Larger diameter (62.5 microns) Multiple modes WDM and DWDM = (dense) wavelength division multiplexing Photodiodes at receivers 5: DataLink Layer 5-153 Physical-link lingo Specifies capacities over physical media Electronic T1/DS1=1.54 Mbps T3/DS3=45Mbps Optical (OC=optical carrier) OC1=52 Mbps OC3/STM1=156 Mbps OC12=622 Mbps OC48=2488 Mbps OC192=10 Gbps OC768=40 Gbps 5: DataLink Layer 5-154 Wireless Entire spectrum of transmission frequency ranges Radio Infrared Lasers Cellular telephone Microwave Satellite Acoustic (see ESE sensors) Ultra-wide band propagation environment effects: reflection obstruction by objects interference http://www.ntia.doc.gov/osmhome/allochrt.html 5: DataLink Layer 5-155 5: DataLink Layer 5-156 What runs on them? Protocol Summary Protocol Cable Speed Topology Ethernet Twisted Pair, Coaxial, Fiber 10 Mbps Linear Bus, Star, Tree Fast Ethernet Twisted Pair, Fiber 100 Mbps Star LocalTalk Twisted Pair .23 Mbps Linear Bus or Star Token Ring Twisted Pair 4 Mbps - 16 Mbps Star-Wired Ring FDDI Fiber 100 Mbps Dual ring ATM Twisted Pair, Fiber 155-2488 Mbps Linear Bus, Star, Tree 5: DataLink Layer 5-157 Extra slides 5: DataLink Layer 5-158 ARQ Automatic Repeat Request (ARQ) Receiver sends acknowledgement (ACK) when it receives packet Sender waits for ACK and timeouts if it does not arrive within some time period 5: DataLink Layer 5-159 Stop and Wait Sender Time Receiver Timeout • Simplest ARQ protocol • Send a packet, stop and wait until acknowledgement arrives 5: DataLink Layer 5-160 ACK lost Timeout Timeout Timeout Timeout Timeout Time Timeout Recovering from Error Packet lost Early timeout 5: DataLink Layer 5-161 Stop and Wait Problems How to recognize a duplicate? Performance Can only send one packet per round trip 5: DataLink Layer 5-162 How to Recognize Resends? • Use sequence numbers – both packets and acks • Sequence # in packet is finite -- how big should it be? – For stop and wait? • One bit – won’t send seq #1 until received ACK for seq #0 5: DataLink Layer 5-163 How to Keep the Pipe Full? Send multiple packets without waiting for first to be acked Number of pkts in flight = window How large a window is needed Round trip delay * bandwidth = capacity of pipe Reliable, unordered delivery Several parallel stop & waits Send new packet after each ack Sender keeps list of unack’ed packets; resends after timeout Receiver same as stop&wait 5: DataLink Layer 5-164 Sliding Window Reliable, ordered delivery Receiver has to hold onto a packet until all prior packets have arrived Sender must prevent buffer overflow at receiver Circular buffer at sender and receiver Packets in transit <= buffer size Advance when sender and receiver agree packets at beginning have been received 5: DataLink Layer 5-165 Sender/Receiver State Sender Max ACK received Receiver Next expected Next seqnum … … … … Sender window Sent & Acked Sent Not Acked OK to Send Not Usable Max acceptable Receiver window Received & Acked Acceptable Packet Not Usable 5: DataLink Layer 5-166 Window Sliding – Common Case On reception of new ACK (i.e. ACK for something that was not acked earlier Increase sequence of max ACK received Send next packet On reception of new in-order data packet (next expected) Hand packet to application Send cumulative ACK – acknowledges reception of all packets up to sequence number Increase sequence of max acceptable packet 5: DataLink Layer 5-167 Loss Recovery On reception of out-of-order packet Send nothing (wait for source to timeout) Cumulative ACK (helps source identify loss) Timeout (Go Back N recovery) Set timer upon transmission of packet Retransmit max ACK received sequence + 1 Restart from max ACK received sequence + 1 Performance during loss recovery No longer have an entire window in transit Can have much more clever loss recovery • Covered in TCP lectures 5: DataLink Layer 5-168 Sequence Numbers How large do sequence numbers need to be? Must be able to detect wrap-around Depends on sender/receiver window size E.g. Max seq = 7, send win=recv win=7 If pkts 0..6 are sent succesfully and all acks lost • Receiver expects 7,0..5, sender retransmits old 0..6 Max sequence must be >= send window + recv window 5: DataLink Layer 5-169 Checksumming: Cyclic Redundancy Check view data bits, D, as a binary number choose r+1 bit pattern (generator), G goal: choose r CRC bits, R, such that <D,R> exactly divisible by G (modulo 2) receiver knows G, divides <D,R> by G. If non-zero remainder: error detected! can detect all burst errors less than r+1 bits widely used in practice (ATM, HDCL) 5: DataLink Layer 5-170 RZ Return to Zero (RZ) 1=pulse to high, dropping back to low 0=no transition 5: DataLink Layer 5-171 NRZ-S Non-Return to Zero Space 1=no change, 0=signal transition at start of bit No problem with string of 0’s NRZ-like problem with string of 1’s 5: DataLink Layer 5-172 Manchester encoding Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to synchronize to each other no need for a centralized, global clock among nodes! Hey, this is physical-layer stuff! More later 5: DataLink Layer 5-173 Other coding schemes Bi-Phase-Mark, Bi-Phase-Space Level change at every bit period boundary Mid-period transition determines bit • Bi-Phase-M: 0=no change, 1=signal transition • Bi-Phase-S: 0=signal transition, 1=no change 5: DataLink Layer 5-174 Other coding schemes Differential Bi-Phase-Space, Differential Bi-Phase-Mark Level change at every mid-bit period boundary Bit period boundary transition determines bit • Diff-Bi-Phase-M: 0=signal transition, 1=no change • Diff-Bi-Phase-S: 0=no change, 1=signal transition 5: DataLink Layer 5-175 802.3 Ethernet Standards: Link & Physical Layers many different Ethernet standards common MAC protocol and frame format different speeds: 2 Mbps, 10 Mbps, 100 Mbps, 1Gbps, 10G bps different physical layer media: fiber, cable application transport network link physical MAC protocol and frame format 100BASE-TX 100BASE-T2 100BASE-FX 100BASE-T4 100BASE-SX 100BASE-BX copper (twisted pair) physical layer fiber physical layer 5: DataLink Layer 5-176 10BaseT and 100BaseT 10/100 Mbps rate; latter called “fast ethernet” T stands for Twisted Pair Originally, half-duplex mode Bus topology popular through mid 90s (10Base2, co-ax) Eventually, nodes connect to a hub: “star topology”; 100 m max distance between nodes and hub Nodes at both ends of link can not transmit at same time Nodes can not transmit and receive at same time Today, mostly full-duplex Nodes connect to switches Simultaneous xmit and receive twisted pair hub 5: DataLink Layer 5-177 Gbit Ethernet uses standard Ethernet frame format allows for point-to-point links and shared broadcast channels in shared mode, CSMA/CD is used; short distances between nodes required for efficiency Full-Duplex at 1 Gbps for point-to-point links Nodes can transmit and receive at 1Gbps simultaneously 10 Gbps now ! 5: DataLink Layer 5-178 Backbone Bridge 5: DataLink Layer 5-179 Interconnection Without Backbone Not recommended for two reasons: - single point of failure at Computer Science hub - all traffic between EE and SE must path over CS segment 5: DataLink Layer 5-180 CSMA/CD efficiency Tprop = max prop delay between 2 nodes in LAN ttrans = time to transmit max-size frame efficiency 1 1 5t prop /ttrans efficiency goes to 1 as tprop goes to 0 as ttrans goes to infinity better performance than ALOHA: and simple, cheap, decentralized! 5: DataLink Layer 5-181 More on Switches cut-through switching: frame forwarded from input to output port without first collecting entire frame slight reduction in latency combinations of shared/dedicated, 10/100/1000 Mbps interfaces 5: DataLink Layer 5-182 Institutional network to external network mail server web server router switch IP subnet hub hub hub 5: DataLink Layer 5-183 Ethernet: uses CSMA/CD if packet then { A: sense channel if idle then { transmit and monitor the channel; } } if detect another transmission then { abort and send jam signal; update # collisions; delay as required by exponential backoff algorithm; goto A } else {done with the frame; set collisions to zero} else {wait until ongoing transmission is over and goto A} 5: DataLink Layer 5-184 10Base2 Ethernet Sifting through the jargon (10Base2) 10: 10Mbps; 2: under 200 meters max cable length thin coaxial cable in a bus topology repeaters used to connect up to multiple segments repeater repeats bits it hears on one interface to DataLink Layer its other interfaces: physical layer device5:only! 5-185 ATM ATM Replace existing Internet protocols with a more “robust” architecture Network architecture to support • Multiple service classes and per-flow guarantees • Virtual circuits to support real-time applications • Explicit rate signaling and resource allocation Covered as a data-link layer… 5: DataLink Layer 5-186 Internet vs. ATM Internet “elastic” datagram service, no strict timing req. Computer communication only “smart” end systems (computers) • can adapt, perform control, error recovery • simple inside network, complexity at “edge” many link types • different characteristics • uniform service difficult ATM evolved from telephony, strict timing and reliability requirements Computer and human communication • need for guaranteed service “dumb” end systems • telephones • complexity inside network 5: DataLink Layer 5-187 Asynchronous Transfer Mode (ATM) 1980s/1990’s standard for high-speed (155Mbps to 622 Mbps and higher) Broadband Integrated Service Digital Network architecture Take strengths of IP, learn from its shortcomings Packet switching good Packet switching without explicit network-level connections and reservations bad Packet switching using large headers for small packets bad (voice) Design new network to address emerging applications while allowing for efficient support for non-real-time data applications Goal: integrated, end-end transport of carry voice, video, data meeting timing/QoS requirements of voice, video (versus Internet best-effort model) “next generation” telephony: technical roots in telephone world packet-switching (fixed length packets, called “cells”) using virtual circuits Covered now since it is used mostly as a data-link layer 5: DataLink Layer 5-188 ATM architecture adaptation layer: only at edge of ATM network data segmentation/reassembly roughly analagous to Internet transport layer ATM layer: “network” layer cell switching, routing physical layer 5: DataLink Layer 5-189 ATM: network or link layer? Vision: end-to-end transport: “ATM from desktop to desktop” ATM is a network technology Reality: used to connect IP backbone routers “IP over ATM” ATM as switched link layer, connecting IP routers IP network ATM network 5: DataLink Layer 5-190 ATM Adaptation Layer (AAL) ATM Adaptation Layer (AAL): “adapts” upper layers (IP or native ATM applications) to ATM layer below AAL present only in end systems, not in switches AAL layer segment (header/trailer fields, data) fragmented across multiple ATM cells analogy: TCP segment in many IP packets 5: DataLink Layer 5-191 ATM Adaptation Layer (AAL) [more] Different versions of AAL layers, depending on ATM service class: AAL1: for CBR (Constant Bit Rate) services, e.g. circuit emulation AAL2: for VBR (Variable Bit Rate) services, e.g., MPEG video AAL5: for data (eg, IP datagrams) User data AAL PDU ATM cell 5: DataLink Layer 5-192 ATM Layer Service: transport cells across ATM network analogous to IP network layer very different services than IP network layer Network Architecture Internet Service Model Guarantees ? Congestion Bandwidth Loss Order Timing feedback best effort none ATM CBR ATM VBR ATM ABR ATM UBR constant rate guaranteed rate guaranteed minimum none no no no yes yes yes yes yes yes no yes no no (inferred via loss) no congestion no congestion yes no yes no no 5: DataLink Layer 5-193 ATM Layer: Virtual Circuits VC transport: cells carried on VC from source to dest call setup, teardown for each call before data can flow each packet carries VC identifier (not destination ID) every switch on source-dest path maintain “state” for each passing connection link,switch resources (bandwidth, buffers) may be allocated to VC: to get circuit-like perf. Permanent VCs (PVCs) long lasting connections typically: “permanent” route between to IP routers Switched VCs (SVC): dynamically set up on per-call basis 5: DataLink Layer 5-194 ATM VCs Advantages of ATM VC approach: QoS performance guarantee for connection mapped to VC (bandwidth, delay, delay jitter) Drawbacks of ATM VC approach: Inefficient support of datagram traffic one PVC between each source/dest pair) does not scale (N*2 connections needed) SVC introduces call setup latency, processing overhead for short lived connections 5: DataLink Layer 5-195 ATM Layer: ATM cell 5-byte ATM cell header 48-byte payload Why?: small payload -> short cell-creation delay for digitized voice halfway between 32 and 64 (compromise!) Cell header Cell format 5: DataLink Layer 5-196 ATM cell header VCI: virtual channel ID will change from link to link thru net PT: Payload type (e.g. RM cell versus data cell) CLP: Cell Loss Priority bit CLP = 1 implies low priority cell, can be discarded if congestion HEC: Header Error Checksum cyclic redundancy check 5: DataLink Layer 5-197 ATM Physical Layer (more) Two pieces (sublayers) of physical layer: Transmission Convergence Sublayer (TCS): adapts ATM layer above to PMD sublayer below Physical Medium Dependent: depends on physical medium being used TCS Functions: Header checksum generation: 8 bits CRC Cell delineation With “unstructured” PMD sublayer, transmission of idle cells when no data cells to send 5: DataLink Layer 5-198 ATM Physical Layer Physical Medium Dependent (PMD) sublayer SONET/SDH: transmission frame structure (like a container carrying bits); bit synchronization; bandwidth partitions (TDM); several speeds: OC3 = 155.52 Mbps; OC12 = 622.08 Mbps; OC48 = 2.45 Gbps, OC192 = 9.6 Gbps TI/T3: transmission frame structure (old telephone hierarchy): 1.5 Mbps/ 45 Mbps unstructured: just cells (busy/idle) 5: DataLink Layer 5-199 IP-Over-ATM Classic IP only 3 “networks” (e.g., LAN segments) MAC (802.3) and IP addresses IP over ATM replace “network” (e.g., LAN segment) with ATM network ATM addresses, IP addresses ATM network Ethernet LANs Ethernet LANs 5: DataLink Layer 5-200 IP-Over-ATM app transport IP Eth phy IP AAL Eth ATM phy phy ATM phy ATM phy app transport IP AAL ATM phy 5: DataLink Layer 5-201 Datagram Journey in IP-over-ATM Network at Source Host: IP layer maps between IP, ATM dest address (using ARP) passes datagram to AAL5 AAL5 encapsulates data, segments cells, passes to ATM layer ATM network: moves cell along VC to destination at Destination Host: AAL5 reassembles cells into original datagram if CRC OK, datagram is passed to IP 5: DataLink Layer 5-202 IP-Over-ATM Issues: IP datagrams into ATM AAL5 PDUs from IP addresses to ATM addresses just like IP addresses to 802.3 MAC addresses! ATM network Ethernet LANs 5: DataLink Layer 5-203 ATM and “IP switching” ATM advantages Lookup of VCID = O(1), Lookup of IP routes O(log n) One-time route lookup and circuit establishment, all subsequent traffic switched ATM disadvantages Complex signaling and routing for establishing communication Difficulty in mapping IP traffic dynamically onto ATM circuits Goal Maintain IP infrastructure Accelerate it with labels to support O(1) lookups a la ATM Solution Ipsilon and “IP switching” http://pnewman.org/papers/infocom96.pdf 5: DataLink Layer 5-204 IP over ATM versus IP switching IP network control IP routing IP network control IP routing ATM network control ATM label switching IP network control IP routing IP network control ATM label switching IP network control IP routing 5: DataLink Layer 5-205 ATM and “IP switching” In a nutshell Start with ATM switch Rip out ATM signaling and routing Add IP routing software Add Flow classifier to map unknown flows to underlying ATM virtual circuit ID Attach VCID and allow downstream nodes to do the same Operation Upon arrival of first packet in flow • Record unknown incoming VCID • Lookup IP flow and map it to an outgoing virtual circuit ID (label) using IP routing software • Create incomingVCID to outgoingVCID table entry for subsequent packets Subsequent packets • Switched in hardware using VCID after flow classified at edge • IP packet forwarding done as label index lookup O(1) versus IP route lookup O(log n) 5: DataLink Layer 5-206 ATM and “IP switching” Later generalized as MPLS (multi-protocol label switching) “Layer 2 ½” Not tied to ATM Extensible to IPv6 Half-way in between data-link addresses and IP addresses • Labeling done within a cloud versus link-local (data-link addresses) and global (IP addresses) http://www.rfc-editor.org/rfc/rfc3031.txt Used as a tool for traffic engineering http://www.rfc-editor.org/rfc/rfc2702.txt 5: DataLink Layer 5-207 X.25 and Frame Relay Like ATM: wide area network technologies virtual circuit oriented origins in telephony world Not really a link layer but.... Viewed as link layers by IP protocol Used mostly to carry IP datagrams between IP routers Going the way of the dinosaurs.... 5: DataLink Layer 5-208 X.25 X.25 builds VC between source and destination for each user connection Per-hop control along path error control (with retransmissions) on each hop using LAP-B • variant of the HDLC protocol • developed when bit error rates over long-haul copper links were orders of magnitude higher per-hop flow control using credits • congestion arising at intermediate node propagates to previous node on path • back to source via back pressure 5: DataLink Layer 5-209 IP versus X.25 X.25: reliable in-sequence end-end delivery from end-to-end “intelligence in the network” built for dumb terminals accessing mainframes IP: unreliable, out-of-sequence end-end delivery “intelligence in the endpoints” 2000 gigabit routers: limited processing possible CPU capacity at end-hosts IP wins 5: DataLink Layer 5-210 Frame Relay Designed in late ‘80s, widely deployed in the ‘90s Second-generation X.25 Frame relay service: no error control no flow control End-to-end congestion control Some QoS mechanisms 5: DataLink Layer 5-211 Frame Relay (more) Designed to interconnect corporate customer LANs typically permanent VC’s: “pipe” carrying aggregate traffic between two routers switched VC’s: as in ATM corporate customer leases FR service from public Frame Relay network (eg, Sprint, ATT) 5: DataLink Layer 5-212 Frame Relay (more) flags address data CRC flags Flag bits, 01111110, delimit frame address: 10 bit VC ID field 3 congestion control bits • FECN: forward explicit congestion notification (frame experienced congestion on path) • BECN: congestion on reverse path • DE: discard eligibility Precursor to IP DiffServ and ECN 5: DataLink Layer 5-213 Frame Relay -VC Rate Control Committed Information Rate (CIR) defined, “guaranteed” for each VC negotiated at VC set up time customer pays based on CIR DE bit: Discard Eligibility bit Edge FR switch measures traffic rate for each VC; marks DE bit DE = 0: high priority, rate compliant frame; deliver at “all costs” DE = 1: low priority, eligible for discard when congestion Precursor to IP DiffServ Can be used to support higher layer QoS mechanisms 5: DataLink Layer 5-214 Coaxial cable Thick (10Base5) Large diameter 50-ohm cable N connectors Thin (10Base2) cables Small diameter 50-ohm cable BNC, RJ-58 connector Video cable 75-ohm cable BNC, RJ-59 connector Not compatible with RJ-58 5: DataLink Layer 5-215 Fiber connectors ESCON Duplex SC ST MT-RJ (multimode) Duplex LC 5: DataLink Layer 5-216