Chapter 5: The Data Link Layer Our goals: r understand principles behind data link layer services: m error detection, correction m sharing a broadcast channel: multiple access m link layer addressing m reliable data transfer, flow control: done! r instantiation and implementation of various link layer technologies 5: DataLink Layer 5-1
↳ Link Layer 3201 r 5.1 Introduction and r 5.6 Hubs and switches $ 101 . services r 5.7 PPP I r 5.2 Error detection point to point and correction . r 5.3Multiple access } Got . protocol protocols r 5.4 Link-Layer } lol Addressing r 5.5 Ethernet . 5: DataLink Layer 5-2
anti Link Layer: Introduction wt÷ “link” Some terminology: Et r hosts and routers are node des r communication channels that D connect adjacent nodes along a ¥ I communication path are lin links m wired links m wireless links m LANs r layer-2 packet is a fr frame me, encapsulates datagram - yer has responsibility of data-link laye da transferring datagram from one node to adjacent node over a link 5: DataLink Layer 5-3
Link layer: context transportation analogy r Datagram transferred by r trip from Princeton to different link protocols Lausanne over different links: m limo: Princeton to JFK m e.g., Ethernet on first link, m plane: JFK to Geneva frame relay on m train: Geneva to Lausanne intermediate links, 802.11 r tourist = datagram on last link r transport segment = r Each link protocol communication link provides different r travel agent = routing services algorithm m e.g., may or may not Traffic lights, r transportation access = provide rdt over link Airport control, link layer protocol Platform scheduling, 5-4
Link Layer Services . g- IT ¥ ⇒ I ? - q - ⑤ . . . r Framing, link access: . m encapsulate datagram into frame, adding header, trailer m channel access if shared medium m “MAC” addresses used in frame headers to identify } neo source, dest rain • different from IP address! r Reliable delivery between adjacent nodes I m we learned how to do this already (chapter 3)! m seldom used on low bit error link (fiber, some twisted pair) m wireless links: high error rates • Q: why both link-level and end-end reliability? 5: DataLink Layer 5-5
Link Layer Services (more) r Flow Control: m pacing between adjacent sending and receiving nodes Full r Error Detection : EJ . m errors caused by signal attenuation, noise. m receiver detects presence of errors: • signals sender for retransmission or drops frame r Error Correction: m receiver identifies and corrects bit error(s) without resorting to retransmission Half r Half-duplex and full-duplex m with half duplex, nodes at both ends of link can transmit, but not at same time Full El ← ¥ 5: DataLink Layer 5-6 . .
Adaptors Communicating datagram rcving link layer protocol sending node O node frame frame D → adapter adapter NIC = Nientfer face card r receiving side r link layer implemented in “adaptor” (aka NIC) m looks for errors, rdt, flow control, etc m Ethernet card, PCMCI card, 802.11 card m extracts datagram, passes to rcving node r sending side: r adapter is semi- m encapsulates datagram in autonomous a frame r link & physical layers m adds error checking bits, rdt, flow control, etc. 5: DataLink Layer 5-7
Link Layer r 5.1 Introduction and r 5.6 Hubs and switches services r 5.7 PPP r 5.2 Error detection } r 5.8 Link Virtualization: and correction ATM r 5.3Multiple access } protocols Point to Point r 5.4 Link-Layer ⇒ § Addressing r 5.5 Ethernet gi :nm8 5: DataLink Layer 5-8
' i:. ¥ 1 € Error Detection * ← * MAC MAC 1010001 Kill ¥ . 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 " " " H' ÷ refiner , .ee ? i 0 ¥ EDO 5: DataLink Layer 5-9
Parity Checking Two Dimensional Bit Parity : Single Bit Parity: Detect an De and correct si single bit t error ors Detect single bit errors De t÷ * ¥ : : 0 0 Etsy 5: DataLink Layer 5-10
Internet checksum Goal: detect “errors” (e.g., flipped bits) in transmitted segment (note: used at transport layer only ) Receiver: Sender: r compute checksum of received r treat segment contents segment as sequence of 16-bit r check if computed checksum integers equals checksum field value: r checksum: addition (1’s m NO - error detected complement sum) of m YES - no error detected. But segment contents maybe errors nonetheless? r sender puts checksum More later …. value into UDP checksum field 5: DataLink Layer 5-11
⇐ Link Layer r 5.1 Introduction and r 5.6 Hubs and switches services r 5.7 PPP r 5.2 Error detection r 5.8 Link Virtualization: and correction } ± ¥¥ ÷'÷i ATM r 5.3Multiple access protocols r 5.4 Link-Layer Addressing D B C A r 5.5 Ethernet I 5: DataLink Layer 5-12
÷÷i÷÷÷÷÷÷÷ :L ⑧ ⑥ ' 33 ' Cz ' In ⑦ ⑤ ④ 0 E- ceaYTY.%9coaiIIHE.HR question I have a say # equation nodes N BIN ⑦ P ÷÷÷÷#÷;i time r
cnet.IE ? opEE....P aanegap.TT ¥ t ¥ °÷÷÷÷÷÷÷÷f...÷ " deep :] ' X i :* :* . " ¥ ÷÷÷÷ / ¥ #i ¥ ÷÷÷÷:÷ e t ' - - ga - - - li÷÷÷÷÷ : - - tu la b oho .
Multiple Access Links and Protocols Two types of “links”: ⑤ Dae - r point-to-point m PPP for dial-up access m point-to-point link between Ethernet switch and host r broadcast (shared wire or medium) × ed m traditional Ethernet . m Bluetooth as lab ' m 802.11 wireless LAN ⑦ 5: DataLink Layer 5-13
Multiple Access protocols r single shared broadcast channel r two or more simultaneous transmissions by nodes: interference m collision if node receives two or more signals at the same time multiple access protocol r distributed algorithm that determines how nodes share channel, i.e., determine when node can transmit r communication about channel sharing must use channel itself! Project m no out-of-band channel for coordination Comm ? → Planning Comm ? . I control Comm ? → Execution Data 5: DataLink Layer 5-14
Ideal Multiple Access Protocol Broadcast channel of rate R bps 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: m no special node to coordinate transmissions m no synchronization of clocks, slots 4. Simple 5: DataLink Layer 5-15
MAC Protocols: a taxonomy Three broad classes: r Channel Partitioning m divide channel into smaller “pieces” (time slots, frequency, code) m allocate piece to node for exclusive use r Random Access m channel not divided, allow collisions m “recover” from collisions r “Taking turns” m Nodes take turns, but nodes with more to send can take longer turns 5: DataLink Layer 5-16
Channel Partitioning MAC protocols: TDMA TDMA: time division multiple access r access to channel in "rounds" r each station gets fixed length slot (length = pkt trans time) in each round r unused slots go idle r example: 6-station LAN, 1,3,4 have pkt, slots 2,5,6 idle 5: DataLink Layer 5-17
Channel Partitioning MAC protocols: FDMA FDMA: frequency division multiple access r channel spectrum divided into frequency bands r each station assigned fixed frequency band r unused transmission time in frequency bands go idle r example: 6-station LAN, 1,3,4 have pkt, frequency bands 2,5,6 idle time - frequency blocks -_ ij t i m e cate a phone that wants to transmit to frequency bands time " in 5: DataLink Layer 5-18 .
Random Access Protocols r When node has packet to send m transmit at full channel data rate R. m no a priori coordination among nodes r two or more transmitting nodes ➜ “collision”, r random access MAC protocol specifies: m how to detect collisions m how to recover from collisions (e.g., via delayed retransmissions) r Examples of random access MAC protocols: m slotted ALOHA m ALOHA m CSMA, CSMA/CD, CSMA/CA 5: DataLink Layer 5-19
Slotted ALOHA I ② ③ ⑧ ⑤ Assumptions Operation r all frames same size r when node obtains fresh ✓ frame, it transmits in next r time is divided into ✓ = slot equal size slots, time to transmit 1 frame r no collision, node can send new frame in next slot ÷ r nodes start to transmit frames only at r if collision, node beginning of slots retransmits frame in each subsequent slot with prob. r nodes are synchronized p until success r if 2 or more nodes transmit in slot, all nodes detect collision 5: DataLink Layer 5-20
Slotted ALOHA success slot # - - E A - total # slots l l ' success Empty Cons Pros collision r collisions, wasting slots r single active node can r idle slots continuously transmit at full rate of channel r nodes must be able to detect collision in less r highly decentralized: than time to transmit only slots in nodes packet need to be in sync r clock synchronization r simple 5: DataLink Layer 5-21
Recommend
More recommend