* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download slides - Fei Hu
Airborne Networking wikipedia , lookup
Cellular network wikipedia , lookup
IEEE 802.11 wikipedia , lookup
IEEE 802.1aq wikipedia , lookup
Serial digital interface wikipedia , lookup
Piggybacking (Internet access) wikipedia , lookup
Recursive InterNetwork Architecture (RINA) wikipedia , lookup
Internet protocol suite wikipedia , lookup
Week 5 Lecture 3 Data Link Layer 1 Data Link Layer location • 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 application transport network Data link physical – PPP, Ethernet • physical: bits “on the wire” 2 Link Layer: where? “link” Some terminology: • communication channels that connect adjacent nodes along communication path are links – wired links – wireless links • 2-PDU is a frame, encapsulates datagram data-link layer has responsibility of transferring frames from one node to adjacent node over a link 3 Link layer: Analogy • 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 4 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 5 (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 6 Data link layer: where? datagram sending node rcving node link layer protocol frame adapter • 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. frame adapter • 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 ! 7 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 8 1. Parity Checking Single Bit Parity: Detect single bit errors Two Dimensional Bit Parity: Detect and correct single bit errors 0 0 9 2. Internet checksum Goal: detect “errors” (e.g., flipped bits) in transmitted segment (note: used at transport layer only) 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 …. 10 3. Cyclic Redundancy Check • view data bits, D, as a binary number • choose r+1 bit pattern (generator), G • goal: choose r CRC 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) 11 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 R = remainder[ D.2r G ] Note: Not subtraction! Use XOR! 12 outline • 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 13 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 14 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 15 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. 16 1. Channel Partitioning MAC : FDMA FDMA: frequency division multiple access frequency bands • example: 6-station LAN, 1,3,4 have pkt, frequency bands 2,5,6 idle 17 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”) 18 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) 19 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! 20 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 21 3. “Taking Turns” MAC protocols Polling: • master node “invites” slave nodes to transmit in turn • concerns: Token passing: control token passed from one node to next sequentially. token message concerns: token overhead latency single point of failure (token) – polling overhead – latency – single point of failure (master) 22 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 23 Next week – Exam # 1 & Bluetooth 24