
55:054, fall, 2008 Chapter 5 Chapter 5: The Data Link Layer Link Layer and LANs Our goals: understand principles behind data link layer services: error detection, correction sharing a broadcast channel: multiple access link layer addressing Computer Networking: reliable data transfer, flow control: done! A Top Down Approach instantiation and implementation of various link th 4 edition. layer technologies Jim Kurose, Keith Ross Addison-Wesley, July 2007. All material copyright 1996-2007 J.F Kurose and K.W. Ross, All Rights Reserved 5: DataLink Layer 5-1 5: DataLink Layer 5-2 Link Layer Link Layer: Introduction Some terminology: 5.1 Introduction and 5.6 Link-layer switches hosts and routers are nodes services 5.7 PPP communication channels that 5.2 Error detection connect adjacent nodes along 5.8 Link virtualization: communication path are links and correction ATM, MPLS wired links 5. 3Multiple access wilireless liklinks protocols LANs 5.4 Link-layer layer-2 packet is a frame, Addressing encapsulates datagram 5.5 Ethernet data-link layer has responsibility of transferring datagram from one node to adjacent node over a link 5: DataLink Layer 5-3 5: DataLink Layer 5-4 J. Kuhl 1 55:054, fall, 2008 Link layer: context Link Layer Services datagram transferred by transportation analogy framing, link access: different link protocols trip from Princeton to Lausanne over different links: encapsulate datagram into frame, adding header, trailer limo: Princeton to JFK channel access if shared medium e.g., Ethernet on first link, plane: JFK to Geneva frame relay on “MAC” addresses used in frame headers to identify intermediate links, 802.11 train: Geneva to Lausanne source, dest on last lklink tourist = datagram • differen t from IP address ! each link protocol transport segment = reliable delivery between adjacent nodes provides different communication link we learned how to do this already (chapter 3)! services transportation mode = seldom used on low bit-error link (fiber, some twisted pair) e.g., may or may not link layer protocol provide rdt over link wireless links: high error rates travel agent = routing • Q: why both link-level and end-end reliability? algorithm 5: DataLink Layer 5-5 5: DataLink Layer 5-6 Link Layer Services (more) Where is the link layer implemented? in each and every host flow control: link layer implemented in pacing between adjacent sending and receiving nodes “adaptor” (aka network host schematic error detection: interface card NIC) application transport errors caused by signal attenuation, noise. Ethernet card, PCMCI network cpu memory link receiver detects presence of errors: card, 802.11 card • signals sender for retransmission or drops frame implements link, physical host bus layer controller (e.g., PCI) error correction: link physical attaches into host’s physical receiver identifies and corrects bit error(s) without transmission resorting to retransmission system buses half-duplex and full-duplex combination of network adapter card with half duplex, nodes at both ends of link can transmit, hardware, software, but not at same time firmware 5: DataLink Layer 5-7 5: DataLink Layer 5-8 J. Kuhl 2 55:054, fall, 2008 Adaptors Communicating Link Layer 5.1 Introduction and 5.6 Link-layer switches datagram datagram services 5.7 PPP controller controller 5.2 Error detection 5.8 Link Virtualization: and correction sending host receiving host ATM. MPLS datagram 5. 3Multiple access frame protocols 5.4 Link-layer sending side: receiving side Addressing encapsulates datagram in looks for errors, rdt, flow frame control, etc 5.5 Ethernet adds error checking bits, extracts datagram, passes rdt, flow control, etc. to upper layer at receiving side 5: DataLink Layer 5-9 5: DataLink Layer 5-10 Error Detection Parity Checking EDC= Error Detection and Correction bits (redundancy) Two Dimensional Bit Parity: D = Data protected by error checking, may include header fields Single Bit Parity: Detect single bit errors Detect and correct single bit errors • Error detection not 100% reliable! • protocol may miss some errors, but rarely • larger EDC field yields better detection and correction otherwise 0 0 5: DataLink Layer 5-11 5: DataLink Layer 5-12 J. Kuhl 3 55:054, fall, 2008 Internet checksum (review) Checksumming: Cyclic Redundancy Check Goal: detect “errors” (e.g., flipped bits) in transmitted view data bits, D, as a binary number packet (note: used at transport layer only) choose r+1 bit pattern (generator), G goal: choose r CRC bits, R, such that Receiver: <D,R> exactly divisible by G (modulo 2) Sender: receiver knows G, divides <D,R> by G. If non-zero remainder: compute checksum of treat segment contents error detected! received segment as sequence of 16-bit can detect all burst errors less than r+1 bits check if computed checksum integers widely used in practice (802.11 WiFi, ATM) equals checksum field value: checksum: addition (1’s complement sum) of NO - error detected segment contents YES - no error detected. sender puts checksum But maybe errors value into UDP checksum nonetheless? field 5: DataLink Layer 5-13 5: DataLink Layer 5-14 CRC Example Link Layer Want: D.2r XOR R = nG 5.1 Introduction and 5.6 Link-layer switches services equivalently: 5.7 PPP 5.2 Error detection D.2r = nG XOR R 5.8 Link Virtualization: and correction ATM, MPLS eqqyuivalently: 5. 3Multiple access . r if we divide D 2 by protocols G, want remainder R 5.4 Link-layer Addressing 5.5 Ethernet D.2r R = remainder[ ] G 5: DataLink Layer 5-15 5: DataLink Layer 5-16 J. Kuhl 4 55:054, fall, 2008 Multiple Access Links and Protocols Multiple Access protocols Two types of “links”: single shared broadcast channel point-to-point PPP for dial-up access two or more simultaneous transmissions by nodes: point-to-point link between Ethernet switch and host interference broadcast (shared wire or medium) collision if node receives two or more signals at the same time old-fashioned Ethernet multiple access protocol upstream HFC distributed algorithm that determines how nodes 802.11 wireless LAN share channel, i.e., determine when node can transmit communication about channel sharing must use channel itself! no out-of-band channel for coordination humans at a shared wire (e.g., shared RF shared RF cocktail party cabled Ethernet) (e.g., 802.11 WiFi) (satellite) (shared air, acoustical) 5: DataLink Layer 5-17 5: DataLink Layer 5-18 Ideal Multiple Access Protocol MAC Protocols: a taxonomy Three broad classes: Broadcast channel of rate R bps Channel Partitioning 1. when one node wants to transmit, it can send at divide channel into smaller “pieces” (time slots, rate R. frequency, code) 2. when M nodes want to transmit, each can send at allocate piece to node for exclusive use average rate R/M Random Access 3. fully decentralized: channel not divided, allow collisions no special node to coordinate transmissions “recover” from collisions no synchronization of clocks, slots “Taking turns” 4. simple nodes take turns, but nodes with more to send can take longer turns 5: DataLink Layer 5-19 5: DataLink Layer 5-20 J. Kuhl 5 55:054, fall, 2008 Channel Partitioning MAC protocols: TDMA Channel Partitioning MAC protocols: FDMA TDMA: time division multiple access FDMA: frequency division multiple access access to channel in "rounds" channel spectrum divided into frequency bands each station gets fixed length slot (length = pkt each station assigned fixed frequency band trans time) in each round unused transmission time in frequency bands go idle unused slots go idle example: 6-station LAN, 1, 3, 4 have pkt, frequency example: 6-station LAN, 1,3,4 have pkt, slots 2,5,6 bands 2,5,6 idle idle 6-slot frame 1 3 4 1 3 4 FDM cable frequency bands 5: DataLink Layer 5-21 5: DataLink Layer 5-22 Random Access Protocols Slotted ALOHA When node has packet to send Assumptions: Operation: transmit at full channel data rate R. all frames same size when node obtains fresh no a priori coordination among nodes time divided into equal frame, transmits in next slot two or more transmitting nodes ➜ “collision”, size slots (time to transmit 1 frame) if no collision: node can random access MAC protocol specifies: nodes start to transmit send new frame in next how to detect collisions only slot beginning slot how to recover from collisions (e.g., via delayed nodes are synchronized if collision: node retransmissions) retransmits frame in Examples of random access MAC protocols: if 2 or more nodes transmit in slot, all each subsequent slot slotted ALOHA nodes detect collision with prob. p until ALOHA success CSMA, CSMA/CD, CSMA/CA 5: DataLink Layer 5-23 5: DataLink Layer 5-24 J. Kuhl 6 55:054, fall, 2008 Slotted ALOHA Slotted Aloha efficiency Efficiency : long-run max efficiency: find fraction of successful slots p* that maximizes (many nodes, all with many Np(1-p)N-1 frames to send) for many nodes, take limit of Np*(1-p*)N-1 suppose: N nodes with as N ggyoes to infinity, Cons PsPros many frames to send, gives: single active node can collisions, wasting slots each transmits in slot Max efficiency = 1/e = .37 continuously transmit idle slots with probability p at full rate of channel nodes may be able to prob that given node At best: channel detect collision in less highly decentralized: has success in a slot = used for useful than time to transmit only slots in nodes p(1-p)N-1 transmissions 37% packet need to be in sync prob that any node has of time! ! clock synchronization simple a success = Np(1-p)N-1 5: DataLink Layer 5-25 5: DataLink Layer 5-26 Pure (unslotted) ALOHA Pure Aloha efficiency unslotted Aloha: simpler, no synchronization P(success by given node) = P(node transmits) .
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages27 Page
-
File Size-