1 / 86

Chapter 5: Link layer

our goals: understand principles behind link layer services: error detection, correction shared channel access link layer addressing local area networks: Ethernet, VLANs instantiation, implementation of various link layer technologies. Chapter 5: Link layer. 5.1 introduction, services

jarah
Télécharger la présentation

Chapter 5: Link layer

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. our goals: understand principles behind link layer services: error detection, correction shared channel access link layer addressing local area networks: Ethernet, VLANs instantiation, implementation of various link layer technologies Chapter 5: Link layer Link Layer

  2. 5.1 introduction, services 5.2 error detection, correction 5.3 multiple access protocols 5.4LANs addressing, ARP Ethernet switches VLANS 5.5 data center networking 5.6a day in the life of a web request Outline Link Layer

  3. terminology: hosts and routers: nodes communication channels that connect adjacent nodes along communication path: links wired links wireless links link-layer packet: frame,encapsulates datagram Link layer: introduction global ISP data-link layer has responsibility of transferring datagram from one node to physically adjacent node over a link Link Layer

  4. 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 transportation mode = link layer protocol travel agent = routing algorithm Link layer: context • 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 Link Layer

  5. Link layer services • framing, link access: • encapsulate datagram into frame, adding header • channel access if shared medium (coordinate frame transmission in case of many nodes) • “MAC” addresses used in frame headers to identify source and dest (different from IP address!) • error detection: • errors caused by signal attenuation, electromagnetic noise. • receiver detects presence of errors (usually hardware-implemented) -> drops frame • error correction: • receiver identifies and corrects bit error(s) Link Layer

  6. 5.1introduction, services 5.2 error detection, correction 5.3 multiple access communication 5.4LANs addressing, ARP Ethernet switches VLANS 5.5 data center networking 5.6a day in the life of a web request Link layer, LANs: outline Link Layer

  7. sender: treat segment contents as sequence of 16-bit integers checksum: addition (1’s complement sum) of segment contents sender puts checksum value into 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? Internet checksum (review) goal: detect “errors” (e.g., flipped bits) in transmitted packet (note: used at transport layer only) Link Layer

  8. Error detection at link layer • augment frame with Error Detection and Correction (EDC)bits • D = Data protected by error checking, may include header fields of frame • Error detection not 100% reliable! • protocol may miss some errors, but rarely • larger EDC field yields better detection and correction otherwise Link Layer

  9. Parity checking • two-dimensional bit parity: • detect and correct single bit errors • divide d data bits in i rows and j columns • single bit parity: • detect single bit errors • even parity scheme: number of ones is even (includes parity bit) • odd parity scheme: number of ones is odd • good if single bit errors occur 0 0 odd scheme Q: Which errors can not be detected? Link Layer

  10. Cyclic redundancy check • more powerful error-detection coding (strength depends on chosen generator) • widely used in practice (Ethernet, 802.11 WiFi, ATM) • see file crc.pdf Link Layer

  11. 5.1introduction, services 5.2error detection, correction 5.3 multiple access communication 5.4LANs addressing, ARP Ethernet switches VLANS 5.5 data center networking 5.6a day in the life of a web request Link layer, LANs: outline Link Layer

  12. Multiple access links, protocols two types of “links”: • point-to-point • PPP for dial-up access • point-to-point link between Ethernet switch, host • broadcast (shared wire or radio frequency) • old-fashioned Ethernet • satellite • 802.11 wireless LAN shared RF (e.g., 802.11 WiFi) shared RF (satellite) shared wire (e.g., cabled Ethernet) humans at a cocktail party (shared air, acoustical) Link Layer

  13. Multiple access protocols • single shared broadcast channel • two or more simultaneous transmissions by nodes: interference • collision if node receives two or more signals at the same time => frames involved in a collision are typically lost multiple access protocol • distributed algorithm that determines how nodes share channel, i.e., determine when node can transmit • communication about channel sharing must use channel itself! • no out-of-band channel for coordination Link Layer

  14. An ideal multiple access protocol given:broadcast channel of rate R bps desired: 1. when single 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 4. simple Link Layer

  15. Multiple access protocols: taxonomy three broad classes: • channel partitioning • divide channel into smaller “pieces” time slots, frequency, code (Code Division Multiple Access (CDMA); use special coding scheme => Chapter 6) • allocate piece to node for exclusive use • random access • channel not divided, allow collisions • “recover” from collisions • “taking turns” • nodes take turns, but nodes with more to send can take longer turns Link Layer

  16. Channel partitioning: TDMA TDMA: time division multiple access • access to channel in "rounds" • each station gets fixed length time 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 6-slot frame 6-slot frame 3 3 4 4 1 1 time frames: here the term “frame” does not refer to link-layer msgs (= frames) Link Layer

  17. Channel partitioning: TDMA Disadvantages • slots are unused => associated capacity lost • participants must synchronize on internal clock 6-slot frame 6-slot frame 3 3 4 4 1 1 time frames: here the term “frame” does not refer to link-layer msgs (= frames) Link Layer

  18. Channel partitioning MAC protocols: FDMA FDMA: frequency division multiple access • channel spectrum divided into different frequency bands • each station assigned fixed frequency band • unused transmission time in frequency bands go idle • example: 6-station LAN, 1,3,4 have pkt, frequency bands 2,5,6 idle time frequency bands channel Link Layer

  19. Channel partitioning MAC protocols: FDMA Disadvantages • if frequency band is only rarely used => associated capacity lost (same for TDMA!) • neighboring channels interfere because of physical effects frequency bands channel Link Layer

  20. Random access protocols • 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 protocol specifies: • how to detect collisions • how to recover from collisions (e.g., via delayed retransmissions) • examples of random access protocols: • slotted ALOHA • ALOHA • CSMA Link Layer

  21. assumptions: all frames same size time divided into equal size slots (time to transmit one frame) nodes start to transmit only at beginning of slot nodes are synchronized (know when slot begins) if 2 or more nodes transmit in slot, all nodes detect collision operation: when node obtains fresh frame, transmits in next slot if no collision: node can send new frame in next slot if collision: node retransmits frame in each subsequent slot with probability p until success Slotted ALOHA Link Layer

  22. Pros: single active node can continuously transmit at full rate of channel highly decentralized: only slots in nodes need to be in sync simple Cons: collisions, wasting slots idle slots clock synchronization 1 1 1 1 node 1 2 2 2 node 2 node 3 3 3 3 Slotted ALOHA C – Collision E – Empty S - Successful C E S C S E C E S Link Layer

  23. suppose:N nodes with many frames to send, each transmits in slot with probability p prob that given node has success in a slot: prob that any node has a success: max efficiency: Slotted ALOHA: efficiency efficiency: long-run fraction of successful slots (many nodes, all with many frames to send) find p* that maximizes Np(1-p)N-1 (homework) for many nodes, let N go to infinity in Np*(1-p*)N-1 : max efficiency = 1/e = .37 (homework) ! at best: channel used for useful transmissions 37% of time! p(1-p)N-1 Np(1-p)N-1 Link Layer

  24. Pure (unslotted) ALOHA • unslotted Aloha: simpler, no synchronization • when frame ready for transmissiontransmit immediately • assumption: • transmission time of all frames is one time unit • backoff time is one time unit • collision probability increases: frame sent at t0 collides with other frames sent in [t0-1,t0+1] (if transmission takes one unit of time) Link Layer

  25. Pure ALOHA efficiency P(success by given node) = P(node transmits at t0) . P(no other node transmits in [t0-1,t0] . P(no other node transmits in [t0,t0+1] = p . (1-p)N-1 . (1-p)N-1 =p . (1-p)2(N-1) … choosing optimum p and then letting n go to infinite = 1/(2e) = .18 even worse than slotted Aloha! Link Layer

  26. CSMA (carrier sense multiple access) carrier sense: listen before transmit: if channel sensed idle: transmit entire frame • if channel sensed busy, defer transmission • human analogy: don’t interrupt others! Link Layer

  27. collisions can still occur: propagation delay => two nodes may not hear each other’s transmission collision: entire packet transmission time wasted distance & propagation delay play role in determining collision probability CSMA collisions spatial layout of nodes A B C D Link Layer

  28. CSMA/CD (collision detection) CSMA/CD:carrier sensing with collision detection • 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: received weak signal strength overwhelmed by strong local transmission strength => hardware for collision detection is too costly • human analogy: the polite conversationalist Link Layer

  29. CSMA/CD (collision detection) spatial layout of nodes Link Layer

  30. NIC receives datagram from network layer, creates frame If NIC senses channel idle, starts frame transmission. If NIC senses channel busy, waits until channel idle, then transmits. If NIC transmits entire frame without detecting another transmission, NIC is done with frame ! If NIC detects another transmission while transmitting, aborts and sends jam signal (special pattern) to inform the other stations that they must not transmit. After aborting, NIC enters binary (exponential) backoff: after m-th collision, NIC chooses K at random from {0,1,2, …, 2m-1}. NIC waits K·512 bit times, returns to Step 2 => longer backoff interval with more collisions (why?) Ethernet CSMA/CD algorithm (m=1 gives {0,1}, m=2 gives {0,1,2}, m=3 gives {0,1,2,3,4}, etc.) => choose uniformly from larger set Link Layer

  31. CSMA/CD efficiency efficiency: long-run fraction of time during which frames are being transmitted without collisions assuming a large number of active nodes with many frames to transmit Link Layer

  32. CSMA/CD efficiency • assume “minislots” • k is number of slots for transmission of one packet • maximum efficiency: k/(k+e-1) • see CSMA_CD_efficiency.pdf • efficiency goes to 1 • as k goes to infinity (=> channel is busy with single frame for very long time) • better performance than ALOHA: and simple, cheap, decentralized! Link Layer

  33. “Taking turns” multiple access protocols channel partitioning MAC protocols: • share channel efficiently and fairly at high load • inefficient at low load: delay in channel access (time division), 1/N bandwidth allocated even if only 1 active node! random access MAC protocols • efficient at low load: single node can fully utilize channel • high load: collision overhead “taking turns” protocols look for best of both worlds! Link Layer

  34. data data poll “Taking turns” MAC protocols polling: • master node “invites” slave nodes to transmit in turn • concerns: • polling overhead (extra messages) • latency (wait for invitation from master) • single point of failure (master) master slaves Link Layer

  35. “Taking turns” MAC protocols token passing: • control token (special frame)passed from one node to next sequentially • no master • concerns: • token overhead • latency • single point of failure (token) T (nothing to send) T data Link Layer

  36. ISP Case study: Cable access network Downstream channel: broadcasts Internet frames,TV channels; is divided into multiple frequency channels; single sender => no multiple access problems … cable headend cable modem splitter CMTS … cable modem termination system upstream Internet frames, TV control; divided into multiple frequencies and time slots; has lots of senders!! • multipledownstream (broadcast) channels • single CMTS transmits into channels • multipleupstream channels • multiple access: all users compete for certain upstream channel time slots (other slots are assigned)

  37. Cable access network cable headend permission for Interval [t1, t2] • DOCSIS: data over cable service interface specification • FDM over upstream, downstream frequency channels • TDM upstream: some slots assigned, some have contention (“Zugangskonflikt”) Downstream channel i CMTS Upstream channel j t1 t2 Residences with cable modems Minislots containing minislots request frames Assigned minislots containing cable modem upstream data frames Link Layer

  38. Cable access network cable headend permission for Interval [t1, t2] • DOCSIS: data over cable service interface specification • modems send requests for upstream slots in selected slots but using random access (collisions may occur and are detected by not receiving a response to request) => binary backoff • CMTS explicitly assigns upstream slots to certain modems => upstream data transmission Downstream channel i CMTS Upstream channel j t1 t2 Residences with cable modems Minislots containing minislots request frames Assigned minislots containing cable modem upstream data frames Link Layer

  39. Summary of MAC protocols • channel partitioning, by time, frequency or code • Time Division, Frequency Division • random access(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 central site, token passing • polling is used for the Bluetooth protocol Link Layer

  40. 5.1introduction, services 5.2error detection, correction 5.3multiple access protocols 5.4 Switched Local Area Networks addressing, Address Resolution Protocol Ethernet switches Virtual LANS 5.5 data center networking 5.6a day in the life of a web request Link layer, LANs: outline Link Layer

  41. MAC addresses and ARP • 32-bit IP address: • network-layer address for interface • used for network layer forwarding • MAC (or LAN or physical or Ethernet) address: • purpose of MAC address:used ‘locally” to get frame from one interface to another physically-connected interface • permanent 48 bit MAC address (for most LANs) of NIC (sometimes software settable) • e.g.: 1A-2F-BB-76-09-AD hexadecimal (base 16) notation (each “number” represents 4 bits) Link Layer

  42. MAC addresses and ARP • e.g.: 1A-2F-BB-76-09-AD Link Layer

  43. LAN addresses and ARP each adapter on LAN has unique LAN address (=MAC addr) 1A-2F-BB-76-09-AD LAN (wired or wireless) adapter 71-65-F7-2B-08-53 58-23-D7-FA-20-B0 0C-C4-11-6F-E3-98 Link Layer

  44. LAN addresses (more) • MAC address allocation administered by IEEE • manufacturer buys portion of MAC address space (to assure uniqueness) • analogy: • MAC address: like Social Security Number • IP address: like postal address • no hierarchical structure ➜portability • can move LAN card from one LAN to another • IP hierarchical address not portable • address depends on IP subnet to which node is attached Link Layer

  45. Question: how to determine interface’s MAC address, knowing its IP address (destination of some datagram)? ARP: address resolution protocol ARP table: each IP node (host, router) on LAN has table • IP/MAC address mappings for some LAN nodes: < IP address; MAC address; TTL> • TTL (Time To Live): time after which address mapping will be forgotten (typically 20 min) 137.196.7.78 1A-2F-BB-76-09-AD 137.196.7.23 137.196.7.14 LAN 71-65-F7-2B-08-53 58-23-D7-FA-20-B0 0C-C4-11-6F-E3-98 137.196.7.88 Link Layer

  46. A wants to send datagram to B B’s MAC address not in A’s ARP table. send broadcast ARP query (special link-layer frame), containing B's IP address dest MAC address = FF-FF-FF-FF-FF-FF all nodes on LAN receive ARP query B receives ARP packet, replies to A with its (B's) MAC address frame sent to A’s MAC address (unicast) A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) information that times out (goes away) unless refreshed (called soft state) ARP is “plug-and-play”: nodes create their ARP tables without intervention from net administrator ARP protocol: same LAN Link Layer

  47. 111.111.111.110 E6-E9-00-17-BB-4B 222.222.222.222 49-BD-D2-C7-56-2A Addressing: routing to another LAN walkthrough: send datagram from A to B via R • note that R has two interfaces with corr. IP and MAC addresses • focus on addressing – at IP (datagram) and MAC layer (frame) • assume A knows B’s IP address • assume A knows IP address of first hop router, R (how?) • assume A knows R’s MAC address (how?) B A R 111.111.111.111 74-29-9C-E8-FF-55 222.222.222.220 1A-23-F9-CD-06-9B 222.222.222.221 111.111.111.112 88-B2-2F-54-1A-0F CC-49-DE-D0-AB-7D Link Layer

  48. MAC src: 74-29-9C-E8-FF-55 MAC dest: E6-E9-00-17-BB-4B IP src: 111.111.111.111 IP dest: 222.222.222.222 IP Eth Phy 111.111.111.110 E6-E9-00-17-BB-4B 222.222.222.222 49-BD-D2-C7-56-2A Addressing: routing to another LAN • A creates IP datagram with IP source A, destination B • A creates link-layer frame with R's MAC address as dest, frame contains A-to-B IP datagram B A R 111.111.111.111 74-29-9C-E8-FF-55 222.222.222.220 1A-23-F9-CD-06-9B 222.222.222.221 111.111.111.112 88-B2-2F-54-1A-0F CC-49-DE-D0-AB-7D Link Layer

  49. MAC src: 74-29-9C-E8-FF-55 MAC dest: E6-E9-00-17-BB-4B IP src: 111.111.111.111 IP dest: 222.222.222.222 IP Eth Phy IP src: 111.111.111.111 IP dest: 222.222.222.222 IP Eth Phy 111.111.111.110 E6-E9-00-17-BB-4B 222.222.222.222 49-BD-D2-C7-56-2A Addressing: routing to another LAN • frame sent from A to R • frame received at R, datagram removed, passed up to IP • => find interface by checking forwarding table in R B A R 111.111.111.111 74-29-9C-E8-FF-55 222.222.222.220 1A-23-F9-CD-06-9B 222.222.222.221 111.111.111.112 88-B2-2F-54-1A-0F CC-49-DE-D0-AB-7D Link Layer

  50. IP Eth Phy MAC src: 1A-23-F9-CD-06-9B MAC dest: 49-BD-D2-C7-56-2A IP Eth Phy IP src: 111.111.111.111 IP dest: 222.222.222.222 111.111.111.110 E6-E9-00-17-BB-4B 222.222.222.222 49-BD-D2-C7-56-2A Addressing: routing to another LAN • R forwards datagram with IP source A, destination B • R creates link-layer frame with B's MAC address as dest, frame contains A-to-B IP datagram B A R 111.111.111.111 74-29-9C-E8-FF-55 222.222.222.220 1A-23-F9-CD-06-9B 222.222.222.221 111.111.111.112 88-B2-2F-54-1A-0F CC-49-DE-D0-AB-7D Link Layer

More Related