Chapter 5 Link Layer and LANs Computer Networking

  • Slides: 22
Download presentation
Chapter 5 Link Layer and LANs Computer Networking: A Top Down Approach Featuring the

Chapter 5 Link Layer and LANs Computer Networking: A Top Down Approach Featuring the Internet, 3 rd edition. Jim Kurose, Keith Ross Addison-Wesley, July 2004. 5: Data. Link Layer 1

Chapter 5: The Data Link Layer Our goals: r understand principles behind data link

Chapter 5: The Data Link Layer Our goals: r understand principles behind data link layer services: m m error detection, correction sharing a broadcast channel: multiple access link layer addressing reliable data transfer, flow control: done! r instantiation and implementation of various link layer technologies 5: Data. Link Layer 2

Link Layer r 5. 1 Introduction and r r services 5. 2 Error detection

Link Layer r 5. 1 Introduction and r r services 5. 2 Error detection and correction 5. 3 Multiple access protocols 5. 4 Link-Layer Addressing 5. 5 Ethernet r 5. 6 Hubs and switches r 5. 7 PPP r 5. 8 Link Virtualization: ATM and MPLS 5: Data. Link Layer 3

Link Layer: Introduction Some terminology: “link” r hosts and routers are nodes r communication

Link Layer: Introduction Some terminology: “link” r hosts and routers are nodes r communication channels that connect adjacent nodes along communication path are links m m wired links wireless links r 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: Data. Link Layer 4

Link layer: context r Datagram transferred by different link protocols over different links: m

Link layer: context r Datagram transferred by different link protocols over different links: m e. g. , Ethernet on first link, frame relay on intermediate links, 802. 11 on last link r Each link protocol provides different services m e. g. , may or may not provide rdt over link transportation analogy r trip from Princeton to Lausanne m limo: Princeton to JFK m plane: JFK to Geneva m train: Geneva to Lausanne r tourist = datagram r transport segment = communication link r transportation mode = link layer protocol r travel agent = routing algorithm 5: Data. Link Layer 5

Link Layer Services r Framing, link access: m encapsulate datagram into frame, adding header,

Link Layer Services 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 source, dest • different from IP address! r Reliable delivery between adjacent nodes 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: Data. Link Layer 6

Link Layer Services (more) r Flow Control: m pacing between adjacent sending and receiving

Link Layer Services (more) r Flow Control: m pacing between adjacent sending and receiving nodes r Error Detection: 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 r Half-duplex and full-duplex m with half duplex, nodes at both ends of link can transmit, but not at same time 5: Data. Link Layer 7

Adaptors Communicating datagram sending node rcving node link layer protocol frame adapter r link

Adaptors Communicating datagram sending node rcving node link layer protocol frame adapter r link layer implemented in r receiving side “adaptor” (aka NIC) m looks for errors, rdt, flow control, etc m Ethernet card, PCMCI m extracts datagram, passes card, 802. 11 card to rcving node r sending side: m m encapsulates datagram in a frame adds error checking bits, rdt, flow control, etc. r adapter is semi- autonomous r link & physical layers 5: Data. Link Layer 8

Link Layer r 5. 1 Introduction and r r services 5. 2 Error detection

Link Layer r 5. 1 Introduction and r r services 5. 2 Error detection and correction 5. 3 Multiple access protocols 5. 4 Link-Layer Addressing 5. 5 Ethernet r 5. 6 Hubs and switches r 5. 7 PPP r 5. 8 Link Virtualization: ATM 5: Data. Link Layer 9

Error Detection EDC= Error Detection and Correction bits (redundancy) D = Data protected by

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: Data. Link Layer 10

Parity Checking Single Bit Parity: Detect single bit errors Two Dimensional Bit Parity: Detect

Parity Checking Single Bit Parity: Detect single bit errors Two Dimensional Bit Parity: Detect and correct single bit errors 0 0 5: Data. Link Layer 11

Internet checksum Goal: detect “errors” (e. g. , flipped bits) in transmitted segment (note:

Internet checksum Goal: detect “errors” (e. g. , flipped bits) in transmitted segment (note: used at transport layer only) Sender: r treat segment contents as sequence of 16 -bit integers r checksum: addition (1’s complement sum) of segment contents r sender puts checksum value into UDP checksum field Receiver: r compute checksum of received segment r check if computed checksum equals checksum field value: m NO - error detected m YES - no error detected. But maybe errors nonetheless? More later …. 5: Data. Link Layer 12

Checksumming: Cyclic Redundancy Check r view data bits, D, as a binary number r

Checksumming: Cyclic Redundancy Check r view data bits, D, as a binary number r choose r+1 bit pattern (generator), G r goal: choose r CRC bits, R, such that m m m <D, R> exactly divisible by G receiver knows G, divides <D, R> by G. If non-zero remainder: error detected! can detect all burst errors less than r+1 bits r widely used in practice (ATM, HDCL) 5: Data. Link Layer 13

CRC Example Want: D. 2 r XOR R = n. G equivalently: D. 2

CRC Example Want: D. 2 r XOR R = n. G equivalently: D. 2 r = n. G XOR R equivalently: if we divide D. 2 r by G, want remainder R R = remainder[ D. 2 r G ] 5: Data. Link Layer 14

Link Layer r 5. 1 Introduction and r r services 5. 2 Error detection

Link Layer r 5. 1 Introduction and r r services 5. 2 Error detection and correction 5. 3 Multiple access protocols 5. 4 Link-Layer Addressing 5. 5 Ethernet r 5. 6 Hubs and switches r 5. 7 PPP r 5. 8 Link Virtualization: ATM 5: Data. Link Layer 15

Multiple Access Links and Protocols Two types of “links”: r point-to-point m PPP for

Multiple Access Links and Protocols Two types of “links”: r point-to-point m PPP for dial-up access r broadcast (shared wire or medium) m traditional Ethernet m 802. 11 wireless LAN 5: Data. Link Layer 16

Multiple Access protocols r single shared broadcast channel r two or more simultaneous transmissions

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! m no out-of-band channel for coordination 5: Data. Link Layer 17

Ideal Multiple Access Protocol Broadcast channel of rate R bps 1. When one node

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 m no special node to coordinate transmissions no synchronization of clocks, slots 4. Simple 5: Data. Link Layer 18

MAC Protocols: a taxonomy Three broad classes: r Channel Partitioning m m divide channel

MAC Protocols: a taxonomy Three broad classes: r Channel Partitioning m m divide channel into smaller “pieces” (time slots, frequency, code) 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: Data. Link Layer 19

Channel Partitioning MAC protocols: TDMA: time division multiple access r access to channel in

Channel Partitioning MAC protocols: 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: Data. Link Layer 20

Channel Partitioning MAC protocols: FDMA: frequency division multiple access r channel spectrum divided into

Channel Partitioning MAC protocols: 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 frequency bands time 5: Data. Link Layer 21

Random Access Protocols r When node has packet to send m transmit at full

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 CSMA, CSMA/CD, CSMA/CA 5: Data. Link Layer 22