240 likes | 258 Views
Discover the Data Link Layer's role in transferring frames between nodes, encapsulating datagrams into frames, and providing various services such as channel access, error detection, and correction. Learn about link protocols, terminology, and the importance of reliability in data transfer.
E N D
application: supporting network applications FTP, SMTP, STTP transport: host-host data transfer TCP, UDP network: routing of datagrams from source to destination IP, routing protocols link: data transfer between neighboring network elements PPP, Ethernet physical: bits “on the wire” application transport network Data link physical Data Link Layer location
Some terminology: communication channels that connect adjacent nodes along communication path are links wired links wireless links 2-PDU is a frame,encapsulates datagram “link” Link Layer: where? data-link layer has responsibility of transferring frames from one node to adjacent node over a link
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 Each link protocol provides different services e.g., may or may not provide RDT over link transportation analogy trip from Princeton to Lausanne limo: Princeton to JFK plane: JFK to Geneva train: Geneva to Lausanne tourist = datagram transport segment = communication link Concrete transportation mode = link layer protocol travel agent = routing algorithm Link layer: Analogy
Think: why put the following functions in Data Link Layer? • (most important) channel access: channel access if shared medium • Framing, • encapsulate datagram into frame, adding header, trailer • ‘physical addresses’ used in frame headers to identify source, dest • different from IP address! • (may not exist) Reliable delivery between adjacent nodes -- seldom used on low bit-error-rate link (fiber, some twisted pair) • wireless links: high error rates • Q: why both link-level and end-end reliability (TCP)?
Link Layer Services (more) • Flow Control: • pacing between adjacent sending and receiving nodes • 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
link layer implemented in “adaptor” (aka NIC) Ethernet card, PCMCI card, 802.11 card sending side: encapsulates datagram in a frame adds error checking bits, rdt, flow control, etc. receiving side looks for errors, rdt, flow control, etc extracts datagram, passes to rcving node adapter is semi-autonomous link & physical layers in one board ! frame frame Data link layer: where? datagram rcving node link layer protocol sending node adapter adapter
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
1. Parity Checking Two Dimensional Bit Parity: Detect and correct single bit errors Single Bit Parity: Detect single bit errors 0 0
Sender: treat segment contents as sequence of 16-bit integers checksum: addition (1’s complement sum) of segment contents sender puts checksum value into UDP checksum field Receiver: compute checksum of received segment check if computed checksum equals checksum field value: NO - error detected YES - no error detected. But maybe errors nonetheless? More later …. 2. Internet checksum Goal: detect “errors” (e.g., flipped bits) in transmitted segment (note: used at transport layer only)
3. Cyclic Redundancy Check • view data bits, D, as a binary number • choose r+1 bit pattern (generator), G • goal: choose rCRC 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)
CRC Example Want: D.2r XOR R = nG equivalently: D.2r = nG XOR R equivalently: if we divide D.2r by G, want remainder R Note: Not subtraction! Use XOR! D.2r G R = remainder[ ]
1 Introduction and services 2 Error detection and correction 3 Multiple access protocols 4 LAN addresses and ARP 5 Ethernet 6 Hubs, bridges, and switches outline
Why Multiple Access protocols? • single shared broadcast 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 nodes share channel, i.e., determine when node can transmit
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
1. Channel Partitioning MAC: TDMA TDMA: time division multiple access • access to channel in "rounds" • 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 • TDM (Time Division Multiplexing): channel divided into N time slots, one per user; inefficient with low duty cycle users and at light load. • FDM (Frequency Division Multiplexing): frequency subdivided.
1. Channel Partitioning MAC : FDMA FDMA: frequency division multiple access • example: 6-station LAN, 1,3,4 have pkt, frequency bands 2,5,6 idle time frequency bands
1. Channel Partitioning (CDMA) CDMA (Code Division Multiple Access) • unique “code” assigned to each user; i.e., code set partitioning • used mostly in wireless broadcast channels (cellular, satellite, etc) • all users share same frequency, but each user has own “chipping” sequence (i.e., 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”)
2. Random Access Protocols -- Ethernet • 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”, • random access MAC protocol specifies: • how to detect collisions • how to recover from collisions (e.g., via delayed retransmissions)
CSMA (Carrier Sense Multiple Access) CSMA: listen before transmit: • If channel sensed idle: transmit entire frame • If channel sensed busy, defer transmission • Human analogy: don’t interrupt others!
CSMA/CD (Collision Detection) CSMA/CD: carrier sensing, deferral as in CSMA • collisions detected within short time • colliding transmissions aborted, reducing channel wastage • collision detection: • easy in wired LANs: measure signal strengths, compare transmitted, received signals • difficult in wireless LANs: receiver shut off while transmitting • human analogy: the polite conversationalist
3. “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) Polling: • master node “invites” slave nodes to transmit in turn • concerns: • polling overhead • latency • single point of failure (master)
Summary of MAC protocols • What do you do with a shared media? • Channel Partitioning, by time, frequency or code • Time Division,Code Division, Frequency 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 • Taking Turns • polling from a central site, token passing