1 / 91

The Data-Link Layer: Ethernet, ARP and LANs

The Data-Link Layer: Ethernet, ARP and LANs. Based on slides from the Computer Networking: A Top Down Approach Featuring the Internet by Kurose and Ross. The Data Link Layer. Our goals: Understand principles behind data link layer services: Sharing a broadcast channel: multiple access.

keilah
Télécharger la présentation

The Data-Link Layer: Ethernet, ARP and LANs

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. The Data-Link Layer:Ethernet, ARP and LANs Based on slides from the Computer Networking: A Top Down Approach Featuring the Internet by Kurose and Ross

  2. The Data Link Layer Our goals: • Understand principles behind data link layer services: • Sharing a broadcast channel: multiple access. • Link layer addressing. • Interconnection of different LAN segments. • Instantiation and implementation of various link layer technologies

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

  4. 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 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

  5. Physical Media • physical link: Transmitted data bit propagates across link. • guided media: signals propagate in solid media (e.g. copper, fiber). • unguided media: signals propagate freely (e.g. radio bands). • The physical Layer defines the “representation” of bits. It’s also provides protection by both detecting and correcting corrupted bits (See how it works).

  6. Physical Media (Examples) Twisted Pair (TP) • Two insulated copper wires. May be shielded or not. • Category 3 Traditional phone wires. Supports 10-Mbps Ethernet. • Category 5 Supports 100Mbps Ethernet (“Fast-Ethernet”).

  7. Physical Media (Examples) Coaxial cable • Two concentric shielded wires. • Baseband single channel on cable. • broadband: multiple channel on cable. • common uses for 10-Mbps Ethernet and TV cables.

  8. Physical Media (Examples) Fiber • Glass fiber carrying light pulses. • Single mode or multi mode. • High point-to-point speed. • Very low error rate (caused by low fiber’s attenuation). • Secured. • Common used for 100-Mbps Ethernet and 1000-Mbps Ethernet (“Gigabit Ethernet”).

  9. Physical Media (Examples) • Many more: • Radio bands (WiFi, high bit error rate). • Microwave (Requires hosts in light of sight). • Satellite (very slow RTT).

  10. Link Layer Services • Recall that we're actually considering the MAC layer in the IEEE 802 model. • Framing (Frame structure) encapsulate datagram into frame, adding header, trailer • Link Access (The protocol): • Addressing: Introduces “MAC” addresses used in frame headers to identify hosts (actually NICs) who are part of the network. Different for IP addresses! • Channel Access: Defines the set of rules which allows the hosts to use the (possibly shared) medium.

  11. Link Layer Services • 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 • Half-duplex and full-duplex: • with half duplex, nodes at both ends of link can transmit, but not at same time • RDT: • Offers some reliability between the hosts (Why is this redundant?).

  12. frame frame Link Layer Services • 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 datagram rcving node link layer protocol sending node adapter adapter

  13. Link Types Three types of “links”: • point-to-point (P2P) • PPP for dial-up access. • Point-to-point link between Ethernet switch and host. • Switched Networks • ATM (used for WAN). • Broadcast • Traditional Ethernet and its predecessors. • Upstream HFC. • 802.11 wireless LAN. • We’ll focus on Broadcast media.

  14. 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 Multiple ACcess (MAC) 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 Ossi Mokryn - Data link layer

  15. Human Analogy • Rules for ‘party conversation’: • "Give everyone a chance to speak." • "Don't speak until you are spoken to."  • "Don't monopolize the conversation."  • "Raise your hand if you have a question."  • "Don't interrupt when someone is speaking."  • "Don't fall asleep when someone else is talking

  16. MAC Protocols measures • Assume a shared medium with a channel rate of R [bpsec]. • Efficient When one node wants to transmit it ca send at rate R. • Fair When N users want to transmit, each can send at average rate R/N. • Decentralized No special node uses to coordinate transmission (no “leader”). No synchronization of clocks or slots. Fault tolerant. • Simple Should be very fast and implemented in NICs firmware.

  17. MAC Protocol Types Three broad classes: • Channel Partitioning • Divide channel into smaller “pieces” (Time-Slots, Frequancy-Bands or by code). • allocate piece to a node for exclusive its 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. • Might uses a leader to coordinate the turns.

  18. Channel Partitioning MAC protocols: TDMA TDMA (Time Division Multiple Access) • Access the channel in "rounds“. • Each station gets fixed length slot (length = packets trans time) in each round. Each slot called a Time-Slot. • Unused slots go idle. • Example: 6-station LAN, 1,3,4 have packtes, slots 2,5,6 idle

  19. Channel Partitioning MAC protocols: FDMA FDMA (Frequency Division Multiple Access) • Channel spectrum divided into frequency bands. • Each station assigned fixed frequency band. • Unused transmission time in frequency bands go idle. • example: 6-station LAN, 1,3,4 have packets, frequency bands 2,5,6 idle time frequency bands

  20. TDM / FDM summary • FDM: Enables the division of a channel with capacity C bits per seconds to N sub-channels, each gets a different frequency range and capacity of C/N. • TDM: The division of channel to N sub-channels, each gets C/N capacity, by giving the entire channel to each of the N stations for 1/N of the time. •  The division makes each sub channel less busy, but the overall waiting time is bigger by a factor of N compared to having one channel (Little theorem).

  21. Channel Partitioning MAC protocols: CDMA • Code Division Multiple Access (CDMA) • used in several wireless broadcast channels (cellular, satellite, etc) standards • unique “code” assigned to each user; i.e., code set partitioning • 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”)

  22. Random Access MAC Protocols • From here on, we’ll focus on Random Access MAC 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 MAC protocol specifies: • How to detect collisions • How to recover from collisions. • Examples of random access MAC protocols: • ALOHA. • slotted ALOHA. • CSMA/CD (Ethernet). • CSMA/CA (Wireless).

  23. Aloha Protocol • Invented at the ’70s in Hawaii. • Intended for Radio networks, but suitable for every network where the station can listen to the channel while broadcasting, and determine whether others also transmit. • Basic idea: every station may transmit when it wants to. If collision is detected between frames, back off and try again later. • If two frames are broadcast at the same time on the channel, a collision occurs and the both need to retransmit.

  24. Aloha Protocol • All hosts: • Transmit on one frequency (fT). • Receive on other frequency (fR). • There is a central node which repeats whatever it receives from fT frequency on the other fR frequency. • The central node used as a repeater. • Collisions are detected by the hosts: Receiving corrupted data (host knows what should be received).

  25. Aloha Protocol • Accept a new frame arrives • Transmit immediately and listen: If a collision occurred, wait a random time, and repeat to stage 2. Otherwise, go back to stage 1 to handle a new frame.

  26. Aloha Protocol • Simple. • Robust against failure of a host. • Distributed (excluding the central node, which uses as a repeater). • High load implicates low utilization of the channel and high delays.

  27. Aloha - efficiency Efficiency is the long-run fraction of successful transmissions when there are many nodes, each with many frames to send • Only 18%... • Suppose there are n stations, and the probability that a station starts transmitting in a time unit is p. • Then: The probability that exactly one node transmits in a time unit is

  28. Aloha - efficiency Efficiency is the long-run fraction of successful transmissions when there are many nodes, each with many frames to send • Only 18%... • Maximize the utilization function by differentiation yields maximum point at with utilization of . • Trivial improvement: Why be vulnerable for 2 time units? Synchronize, and use slotted time. May transmit only at integer times

  29. Slotted Aloha Assumptions • all frames same size • time is divided into equal size slots, time to transmit 1 frame • nodes start to transmit frames only at beginning of slots • nodes are synchronized • if 2 or more nodes transmit in slot, all nodes detect collision Operation • when node obtains fresh frame, it transmits in next slot • no collision, node can send new frame in next slot • if collision, node retransmits frame in each subsequent slot with prob. p until success

  30. Slotted Aloha 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 • nodes may be able to detect collision in less than time to transmit packet • clock synchronization

  31. Slotted Aloha - efficiency Efficiency is the long-run fraction of successful slots when there are many nodes, each with many frames to send • Suppose N nodes with many frames to send, each transmits in slot with probability p • prob that node 1 has success in a slot = p(1-p)N-1 • prob that any node has a success = Np(1-p)N-1 • For max efficiency with N nodes, find p* that maximizes Np(1-p)N-1 • For many nodes, take limit of Np*(1-p*)N-1 as N goes to infinity, gives 1/e = .37 At best: channel used for useful transmissions 37% of time!

  32. Aloha - Summary • Very popular at the beginning of time (i.e., 70s to 80s). • Very simple to handle. • Lots and lots of basic probabilities calculations for students! • Major problem: Nodes don’t check what’s going on in the channel, each acting on its own. No manners!

  33. CSMA (Carrier Sense Multiple Access) • CSMA: listen before transmit: • Protocol: • Listen to the channel • If channel sensed idle, transmit entire frame • If channel sensed busy, defer transmission by. • 1-Persistent CSMA:Wait until channel is quiet and transmit immediately. If collision occurs, wait a random time and listen again (go to 1). • Non-Persistent CSMA:Wait a random time and listen again (go to 1). • They differ only by the treatment of 1st transmission. • CSMA human analogy: don’t interrupt others!

  34. CSMA/CD (Collision Detection) • CSMA/CD: carrier sensing, deferral as in CSMA • When transmitting, try to sense if there is a collision. • 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

  35. CSMA/CD Minimum Packet Size

  36. Ethernet uses CSMA/CD • No slots • adapter doesn’t transmit if it senses that some other adapter is transmitting, that is, carrier sense • transmitting adapter aborts when it senses that another adapter is transmitting, that is, collision detection • Before attempting a retransmission, adapter waits a random time, that is, random access

  37. Unreliable, connectionless service • Connectionless: No handshaking between sending and receiving adapter. • Unreliable: receiving adapter doesn’t send acks or nacks to sending adapter • stream of datagrams passed to network layer can have gaps • gaps will be filled if app is using TCP • otherwise, app will see the gaps

  38. Ethernet’s CSMA/CD (more) Jam Signal: make sure all other transmitters are aware of collision; 48 bits Bit time: .1 microsec for 10 Mbps Ethernet ;for K=1023, wait time is about 50 msec Exponential Backoff: • Goal: adapt retransmission attempts to estimated current load • heavy load: random wait will be longer • first collision: choose K from {0,1}; delay is K· 512 bit transmission times • after second collision: choose K from {0,1,2,3}… • after ten collisions, choose K from {0,1,2,3,4,…,1023} See/interact with Java applet on AWL Web site: highly recommended !

  39. 802.3 CSMA/CD (Ethernet) Algorithm

  40. Ethernet CSMA/CD algorithm 1. Adaptor receives datagram from net layer & creates frame 2. If adapter senses channel idle, it starts to transmit frame. If it senses channel busy, waits until channel idle and then transmits 3. If adapter transmits entire frame without detecting another transmission, the adapter is done with frame ! 4. If adapter detects another transmission while transmitting, aborts and sends jam signal 5. After aborting, adapter enters exponential backoff: after the mth collision, adapter chooses a K at random from {0,1,2,…,2m-1}. Adapter waits K·512 bit times and returns to Step 2

  41. Ethernet Minimum Packet Size

  42. Summary of MAC protocols • What do you do with a shared media? • Channel Partitioning, by time, frequency or code • Time Division, Frequency Division, Code 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 • CSMA/CA used in 802.11 (Wireless).

  43. LAN technologies Data link layer so far: • MAC protocols. The random protocol approach. Next: LAN technologies • Addressing • Ethernet • Hubs, bridges and switches

  44. MAC Addresses and ARP • 32-bit IP address: • network-layer address • used to get datagram to destination IP subnet • MAC (or LAN or physical or Ethernet) address: • used to get datagram from one interface to another physically-connected interface (same network) • 48 bit MAC address (for most LANs) burned in the adapter ROM, but can be modified.

  45. 1A-2F-BB-76-09-AD LAN (wired or wireless) 71-65-F7-2B-08-53 58-23-D7-FA-20-B0 0C-C4-11-6F-E3-98 LAN Addresses and ARP Each adapter on LAN has unique LAN address Broadcast address = FF-FF-FF-FF-FF-FF = adapter

  46. LAN Address (more) • MAC address allocation administered by IEEE. • manufacturer buys portion of MAC address space (to assure uniqueness) • Analogy: (a) MAC address: like Social Security Number (b) IP address: like postal address • MAC flat address ➜ portability • can move LAN card from one LAN to another • IP hierarchical address NOT portable • depends on IP subnet to which node is attached

  47. Question: how to determine MAC address of B knowing B’s IP address? ARP: Address Resolution Protocol • Each IP node (Host, Router) on LAN has ARP table • ARP 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) 237.196.7.78 1A-2F-BB-76-09-AD 237.196.7.23 237.196.7.14 LAN 71-65-F7-2B-08-53 58-23-D7-FA-20-B0 0C-C4-11-6F-E3-98 237.196.7.88

  48. ARP protocol: Same LAN (network) • A wants to send datagram to B, and B’s MAC address not in A’s ARP table. • A broadcasts ARP query packet, containing B's IP address • Dest MAC address = FF-FF-FF-FF-FF-FF • all machines 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) • soft state: information that times out (goes away) unless refreshed • ARP is “plug-and-play”: • nodes create their ARP tables without intervention from net administrator

  49. Routing to another LAN walkthrough: send datagram from A to B via R assume A know’s B IP address • Two ARP tables in router R, one for each IP network (LAN) • In routing table at source Host, find router 111.111.111.110 • In ARP table at source, find MAC address E6-E9-00-17-BB-4B, etc A R B

  50. A creates datagram with source A, destination B • A uses ARP to get R’s MAC address for 111.111.111.110 • A creates link-layer frame with R's MAC address as dest, frame contains A-to-B IP datagram • A’s adapter sends frame • R’s adapter receives frame • R removes IP datagram from Ethernet frame, sees its destined to B • R uses ARP to get B’s MAC address • R creates frame containing A-to-B IP datagram sends to B A R B Ossi Mokryn - Data link layer

More Related