Presentation is loading. Please wait.

Presentation is loading. Please wait.

Network Layer4-1 Chapter 5: The Data Link Layer Our goals: r understand principles behind data link layer services: m error detection, correction m sharing.

Similar presentations


Presentation on theme: "Network Layer4-1 Chapter 5: The Data Link Layer Our goals: r understand principles behind data link layer services: m error detection, correction m sharing."— Presentation transcript:

1 Network Layer4-1 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: done! r instantiation and implementation of various link layer technologies

2 Network Layer4-2 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

3 Network Layer4-3 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!

4 Network Layer4-4 Link Layer Services (more) 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

5 Network Layer4-5 Data link: usual approach r Usual approach m Data link breaks the bit stream up into discrete frames computes the checksum for each frame –This checksum is recomputed at the destination r Breaking bit stream up m Character count m Flag bytes with byte stuffing m Starting and ending flags with bit stuffing

6 Network Layer4-6 Framing r First method m Uses a field in the header specifying # characters r Trouble m Count can be garbled by a transmission error

7 Network Layer4-7 Framing (cont’d) r Starting and ending delimiters m => flag bytes r Flag byte pattern occurring in the data m => byte stuffing

8 Network Layer4-8 If an escape byte occurs in the middle of the data r A framing flag byte can be m Distinguished from one in the data By the absence or presence of an escape byte before it r If an escape byte occurs in data m It is stuffed with an escape byte m Example of byte sequences after stuffing Single escape byte => part of an escape sequence Double one => a single escape occurred in the data m In all cases, delivered byte sequence same as original

9 Network Layer4-9 Bit stuffing r Frame begins and ends with 01111110 r If sender encounters 5 consecutive 1s m Sender stuffs a 0 bit into the outgoing bit stream m Receiver destuffs the 0 bit

10 Network Layer4-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 Network Layer4-11 Error detection and correction r Transmission errors are common on local loops m transmission errors are going to be with us for years r => need for error correcting or detecting codes m Error correcting codes include enough redundant information along with block of data –To enable receiver to deduce what transmitted data was –Suitable for channels that make many errors m Error detecting codes include only enough redundancy to allow –Receiver to deduce that an error occurred, not which error –Suitable for highly reliable channels

12 Network Layer4-12 Error correcting and detecting codes: terminology r A frame consists of m data bits m And r redundant, or check, bits => total length n = m + r m The n bit (data + check bits) => n-bit codeword r Hamming distance m The # bit positions in which 2 codewords differ Example: given 1001001 and 10110001, –3 bits differ => hamming distance = 3

13 Network Layer4-13 Error correcting and detecting code: rules r To detect d errors, you need a distance d+1 code m Example: code in which single parity bit is appended The parity bit is chosen so that # of 1 bits is even (or odd) A code with single parity bit has a distance 2 –=> it can be used to detect single errors r To correct d errors, you need a distance 2d+1 code m Example: 0000000000, 0000011111, 1111100000 This code has a distance 5 => can correct double errors If 0000000111 arrives => original must have been 0000011111

14 Network Layer4-14 Lower limit on the number of check bits r We want to design a code m with m message bits and r check bits Allowing all single errors to be corrected m This requirement becomes m This put a lower limit on the number of check bits Needed to correct a single error

15 Network Layer4-15 Error correcting code: Hamming code r A data bit in position k m is checked by just those check bits occurring in its expansion

16 Network Layer4-16 Use of Hamming code to correct burst errors

17 Network Layer4-17 Error detecting codes r Cyclic Redundancy Check (CRC) m is in widespread use, and called polynomial code treats bits as 0 and 1 coefficients of polynomials –For example: 110001 represents x 5 +x 4 + x 0 m Sender and receiver agree upon a generator polynomial G(x) To compute the checksum for some frame of m bits M(x) => append a checksum to the end of frame –such that polynomial is divisible by G(x) Receiver divides check-summed frame by G(x) –If there is a remainder => there has been an error

18 Network Layer4-18 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 (Ethernet, 802.11 WiFi, ATM)

19 Network Layer4-19 Algorithm for computing the checksum r Let r be the degree of G(x) m Append r zeros to the low-order end of the frame m => x r M(x) r Divide the bit string corresponding to G(x) m Into the bit string corresponding x r M(x) using Modulo 2 division r Subtract the remainder from x r M(x) m The result is the checksumed frame to be transmitted

20 Network Layer4-20 Error detecting codes: example Calculation of the polynomial code checksum.

21 Network Layer4-21 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


Download ppt "Network Layer4-1 Chapter 5: The Data Link Layer Our goals: r understand principles behind data link layer services: m error detection, correction m sharing."

Similar presentations


Ads by Google