Chapter 5: The Data Link Layer Our goals:  principles behind data link layer services:  error detection correction  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 11/17/2013 Data Link Layer (SSL) 5-1 Link layer, LANs 5.1 introduction, 5.5 link virtualization: services MPLS 5.2 error detection, , 5.6 data center correction networks 5.3 multiple access 5.7 a day in the life of protocols a web request 5.4 LANs (play animation in .ppt slides on your own) y )  addressing, ARP addressing, ARP  Ethernet  switches  VLANS 11/17/2013 Data Link Layer (SSL) 5-2 1
Link Layer: context  A link connects two  IP datagram transferred by adjacent IP nodes (layer 3) different link protocols over different along a path links which may provide different services 11/17/2013 Data Link Layer (SSL) 5-3 Link Layer: context  Link can be  unit of data: frame , wire which encapsulates an  IP datagram wireless   IP expects no service  IP expects no service LAN (layer 2) LAN (layer 2)   guarantee from links WAN (virtual link)  M application transport H t M network t k network k H n H t M data link protocol link link H l H n H t M H l H n H t M physical physical frame phys. link trailer adapter card 11/17/2013 Data Link Layer (SSL) 5-4 2
Link Layer Services  Framing  Encapsulate datagram with header and trailer  Error Detection  errors caused by signal attenuation, noise. d b i l tt ti i  receiver detects presence of errors  Error Correction  receiver identifies and corrects bit error(s) without resorting to retransmission  Link access  access protocol for shared channel access  “MAC” addresses used in frame headers to identify MAC addresses used in frame headers to identify  source, destination  different from IP addresses  why both MAC and IP addresses? 11/17/2013 Data Link Layer (SSL) 5-5 Link Layer Services (more)  Half-duplex and full-duplex  with half duplex, nodes at both ends of link can transmit, but not at same time  Flow Control  pacing between sender and receiver(s)  Reliable delivery between two physically connected devices  we learned how to do this already (chapter 3)  seldom used on low error-rate links (fiber some twisted  seldom used on low error-rate links (fiber, some twisted pair)  wireless links: high error rates Q: why both link-level and end-end reliability? 11/17/2013 Data Link Layer (SSL) 5-6 3
Link layer, LANs 5.1 introduction, 5.5 link virtualization: services MPLS 5.2 error detection, , 5.6 data center correction networks 5.3 multiple access 5.7 a day in the life of protocols a web request 5.4 LANs (play animation in .ppt slides on your own) y )  addressing, ARP addressing, ARP  Ethernet  switches  VLANS 11/17/2013 Data Link Layer (SSL) 5-7 Error Detection EDC= Error Detection and Correction bits (redundant check bits) D = Data protected by error checking, may include header fields • Error detection not 100% reliable • protocol may miss some errors • more check bits yield better detection and correction 11/17/2013 Data Link Layer (SSL) 5-8 4
Parity Checking Two Dimensional Bit Parity : Single Bit Parity: Detect and correct single bit errors Detect single bit errors error Even parity: total number of 1s total number of 1s is odd means there is a bit error or, 0 0 more precisely, an odd number of bit errors 11/17/2013 Data Link Layer (SSL) 5-9 Cyclic Redundancy Check (CRC) - sender  View data bits, D, as a  Goal : choose r CRC binary number bits, R, such that <D,R> is exactly divisible by is exactly divisible by G using modulo 2 arithmetic  Modulo 2 arithmetic  there is no carry in  Choose r+1 bit pattern addition, and no borrow (generator), G ( t ) G in subtraction  addition and subtraction same as bitwise exclusive OR (XOR) 11/17/2013 Data Link Layer (SSL) 5-10 5
Cyclic Redundancy Check (CRC) - receiver  Receiver knows G,  Bit string <D,R> sent performs division. If is exactly divisible by non-zero remainder, non zero remainder, G G error detected !  can detect all burst errors less than r+1 bits;  longer burst errors are detectable with are detectable with probability 1-(0.5) r 11/17/2013 Data Link Layer (SSL) 5-11 CRC Theory and Example Want: (D*2r) XOR R = nG add R to both sides: D*2r = (nG) XOR R r Equivalently: the remainder from dividing D*2r by G is equal to R; the desired CRC bit string is st i is D*2r R = remainder[ ] G 11/17/2013 Data Link Layer (SSL) 5-12 6
Link layer, LANs 5.1 introduction, 5.5 link virtualization: services MPLS 5.2 error detection, , 5.6 data center correction networks 5.3 multiple access 5.7 a day in the life of protocols a web request 5.4 LANs (play animation in .ppt slides on your own) y )  addressing, ARP addressing, ARP  Ethernet  switches  VLANS 11/17/2013 Data Link Layer (SSL) 5-13 Multiple Access Links and Protocols Two types of “links”:  point-to-point  fiber optic link f p  link between Ethernet switch and host  broadcast (shared wire or medium)  old-fashioned Ethernet  upstream channel of HFC (hybrid fiber cable)  wireless (802.11 LAN and others), etc. humans at a party shared cable (e.g., (shared air, acoustics) shared RF shared RF old Ethernet) (e.g., 802.11 WiFi) (satellite) 11/17/2013 Data Link Layer (SSL) 5-14 7
Multiple Access protocols single shared broadcast channel  two or more simultaneous transmissions by nodes may interfere with each other  collision if a node receives two or more signals at the same time  Need a protocol to determine when nodes can transmit  no out-of-band channel for coordination 11/17/2013 Data Link Layer (SSL) 5-15 Ideal Multiple Access Protocol Broadcast channel of rate R bps 1 when one node wants to transmit it can send at 1. when one node wants to transmit, it can send at rate R. 2. 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, time slots h i ti f l k ti l t 4. simple 11/17/2013 Data Link Layer (SSL) 5-16 8
MA Protocols: a taxonomy Three broad classes:  Channel Partitioning  di id h  divide channel into smaller “pieces” (time slots, frequency l i t sm ll “ i s” (tim sl ts f bands, codes)  allocate a piece to each node for exclusive use  Random Access  shared channel, collisions allowed  “recover” from collisions  “Taking turns”  nodes take turns  a node with more to send can take a longer turn 11/17/2013 Data Link Layer (SSL) 5-17 Channel Partitioning protocols TDMA: time division multiple access*  each station gets fixed length slot (length = pkt trans time) in each frame tran t m ) n ach fram  requires time synchronization  unused slots go idle 6-slot frame 3 1 3 4 1 4 * there are multiple transmitters 11/17/2013 Data Link Layer (SSL) 5-18 9
Channel Partitioning protocols FDMA: frequency division multiple access  each station assigned a fixed frequency band  unused transmission time in frequency bands go idle frequency bands FDM cable 11/17/2013 Data Link Layer (SSL) 5-19 Random Access Protocols  When node has packet to send  transmit at full channel data rate  no a priori coordination among nodes  two or more transmitting nodes ➜ “collision”  random access MA protocol specifies:  how to detect collision  how to recover from collision (e.g., via delayed retransmissions)  examples:  slotted ALOHA  ALOHA  CSMA, CSMA/CD, CSMA/CA 11/17/2013 Data Link Layer (SSL) 5-20 10
Slotted Aloha  time is divided into equal size slots (pkt trans. times)  requires time synchronization  node with new arriving pkt: transmit at beginning of next slot t l t  if collision: retransmit pkt in a future slot with probability p (or one of K slots at random), until successful. Success (S), Collision (C), Empty (E) slots 11/17/2013 Data Link Layer (SSL) 5-21 Slotted Aloha efficiency Long-term fraction of time slots that are successful? Suppose N nodes have packets to send  each transmits in slot with probability p  prob. successful transmission S is by a particular node: S = p (1-p) (N-1) by any of N nodes: S = Prob [one of N nodes transmits] = N p (1-p) (N-1) Channel occupied by useful … choosing optimum p, let N -> infinity transmissions < 37% of time = 1/e = .37 as N -> infinity 11/17/2013 Data Link Layer (SSL) 5-22 11
Recommend
More recommend