Presentation is loading. Please wait.

Presentation is loading. Please wait.

5: DataLink Layer5-1 Chapter 5 Link Layer and LANs A note on the use of these ppt slides: We’re making these slides freely available to all (faculty, students,

Similar presentations


Presentation on theme: "5: DataLink Layer5-1 Chapter 5 Link Layer and LANs A note on the use of these ppt slides: We’re making these slides freely available to all (faculty, students,"— Presentation transcript:

1 5: DataLink Layer5-1 Chapter 5 Link Layer and LANs A note on the use of these ppt slides: We’re making these slides freely available to all (faculty, students, readers). They’re in PowerPoint form so you can add, modify, and delete slides (including this one) and slide content to suit your needs. They obviously represent a lot of work on our part. In return for use, we only ask the following:  If you use these slides (e.g., in a class) in substantially unaltered form, that you mention their source (after all, we’d like people to use our book!)  If you post any slides in substantially unaltered form on a www site, that you note that they are adapted from (or perhaps identical to) our slides, and note our copyright of this material. Thanks and enjoy! JFK/KWR All material copyright 1996-2007 J.F Kurose and K.W. Ross, All Rights Reserved Computer Networking: A Top Down Approach 4 th edition. Jim Kurose, Keith Ross Addison-Wesley, July 2007.

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

3 5: DataLink Layer5-3 Link Layer r 5.1 Introduction and services r 5.2 Error detection and correction r 5.3Multiple access protocols r 5.4 Link-layer Addressing r 5.5 Ethernet r 5.6 Link-layer switches r 5.7 PPP r 5.8 Link virtualization: ATM, MPLS

4 5: DataLink Layer5-4 Link Layer: Introduction Some terminology: r hosts and routers are nodes r communication channels that connect adjacent nodes along communication path are links m wired links m wireless links m LANs 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 5: DataLink Layer5-5 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

6 5: DataLink Layer5-6 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 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?

7 5: DataLink Layer5-7 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

8 5: DataLink Layer5-8 Where is the link layer implemented? r in each and every host r link layer implemented in “adaptor” (aka network interface card NIC) m Ethernet card, PCMCI card, 802.11 card m implements link, physical layer r attaches into host’s system buses r combination of hardware, software, firmware controller physical transmission cpu memory host bus (e.g., PCI) network adapter card host schematic application transport network link physical

9 5: DataLink Layer5-9 Adaptors Communicating r sending side: m encapsulates datagram in frame m adds error checking bits, rdt, flow control, etc. r receiving side m looks for errors, rdt, flow control, etc m extracts datagram, passes to upper layer at receiving side controller sending host receiving host datagram frame

10 5: DataLink Layer5-10 Link Layer r 5.1 Introduction and services r 5.2 Error detection and correction r 5.3Multiple access protocols r 5.4 Link-layer Addressing r 5.5 Ethernet r 5.6 Link-layer switches r 5.7 PPP r 5.8 Link Virtualization: ATM. MPLS

11 5: DataLink Layer5-11 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 otherwise

12 5: DataLink Layer5-12 Parity Checking Single Bit Parity: Detect single bit errors Two Dimensional Bit Parity: Detect and correct single bit errors 0 0

13 5: DataLink Layer5-13 Internet checksum 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? Goal: detect “errors” (e.g., flipped bits) in transmitted packet (note: used at transport layer only)

14 5: DataLink Layer5-14 Internet Checksum Example r Note m When adding numbers in 1’s complement notation, a carry-over from the most significant bit needs to be added to the result r Example: add two 16-bit integers 1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0 1 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1 sum add wraparound checksum

15 5: DataLink Layer5-15 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 exactly divisible by G (modulo 2) m receiver knows G, divides by G. If non-zero remainder: error detected! m can detect all burst errors less than r+1 bits r widely used in practice (802.11 WiFi, ATM)

16 5: DataLink Layer5-16 Checksumming: Cyclic Redundancy Check r Sender has data D, which is d bits long. r Sender computes R, an r-bit CRC of those d bits m r is usually 8, 12, 16, or 32 r Sender sends D followed by R to the receiver r Receiver computes the CRC of the received data m If no match, there were certainly errors m If match, no error detected

17 5: DataLink Layer5-17 Checksumming: Cyclic Redundancy Check r Better at detecting errors than other methods we've seen m Can detect all burst errors up to r bits m But much more complicated to compute r Since the link layer is handled semi-autonomously in adapter hardware, CRCs are more appropriate for the link layer than for higher layers in the protocol stack. r The mathematical details are in the text.

18 5: DataLink Layer5-18 CRC Example Want: D. 2 r XOR R = nG equivalently: D. 2 r = nG XOR R equivalently: if we divide D. 2 r by G, want remainder R R = remainder[ ] D.2rGD.2rG

19 5: DataLink Layer5-19 Link Layer r 5.1 Introduction and services r 5.2 Error detection and correction r 5.3Multiple access protocols r 5.4 Link-Layer Addressing r 5.5 Ethernet r 5.6 Hubs and switches r 5.7 PPP r 5.8 Link Virtualization: ATM

20 5: DataLink Layer5-20 Point to Point Data Link Control r one sender, one receiver, one link: easier than broadcast link: m no Media Access Control m no need for explicit MAC addressing m e.g., dialup link, ISDN line r most popular point-to-point DLC protocol: m PPP (point-to-point protocol) m probably use this at home: Dailup : Plain PPP ADSL : PPP over Ethernet (PPPoE)

21 5: DataLink Layer5-21 PPP Design Requirements [RFC 1557] r packet framing: encapsulation of network-layer datagram in data link frame m carry network layer data of any network layer protocol (not just IP) at same time m ability to demultiplex upwards r bit transparency: must carry any bit pattern in the data field r error detection (no correction) r connection liveness: detect, signal link failure to network layer r network layer address negotiation: endpoint can learn/configure each other’s network address

22 5: DataLink Layer5-22 PPP non-requirements r no error correction/recovery r no flow control r out of order delivery OK r no need to support multipoint links (e.g., polling) Error recovery, flow control, data re-ordering all relegated to higher layers!

23 5: DataLink Layer5-23 PPP Data Control Protocol Before exchanging network- layer data, data link peers must r configure PPP link (max. frame length, authentication) r learn/configure network layer information m for IP: carry IP Control Protocol (IPCP) msgs (protocol field: 8021) to configure/learn IP address

24 5: DataLink Layer5-24 PPP Data Frame r Flag: delimiter (framing) r Address: does nothing (only one option) r Control: does nothing; in the future possible multiple control fields r Protocol: upper layer protocol to which frame delivered (eg, PPP-LCP, IP, IPCP, etc)

25 5: DataLink Layer5-25 PPP Data Frame r info: upper layer data being carried r check: cyclic redundancy check for error detection

26 5: DataLink Layer5-26 Byte Stuffing “Data transparency” requirement: protocol, info, checksum fields must be allowed to include flag pattern □ Q: is received the closing flag, or part of some other field? Sender: adds (“stuffs”) escape sequence byte before: □ each non-flag byte □ each byte Receiver: □ discard byte and treat next as data □ single : flag byte

27 5: DataLink Layer5-27 Byte Stuffing flag byte pattern in data to send flag byte pattern plus stuffed byte in transmitted data


Download ppt "5: DataLink Layer5-1 Chapter 5 Link Layer and LANs A note on the use of these ppt slides: We’re making these slides freely available to all (faculty, students,"

Similar presentations


Ads by Google