Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS4470 Computer Networking Protocols

Similar presentations


Presentation on theme: "CS4470 Computer Networking Protocols"— Presentation transcript:

1 CS4470 Computer Networking Protocols
2/10/2018 CS Computer Networking Protocols 3. Data Link Layer Huiping Guo Department of Computer Science California State University, Los Angeles

2 Outline Overview of data link layer Framing Error detection
2/10/2018 Outline Overview of data link layer Framing Error detection 3. Link CS470

3 Data link layer overview
2/10/2018 Data link layer overview Network layer Network layer Data Data Data H T frame Link layer Link layer Data H T Physical layer Physical layer 3. Link CS470

4 Data link layer overview (cont.)
Achieve reliable, efficient communication between two physically connected machines Make use of services provided by the physical layer Get a series of bits Provide services to the network layer The kind of services depends on the link layer protocol How to make a link appear reliable A link may corrupt frame from time to time 3. Link CS470

5 Design issues Services interface to the network layer
How to group bits into frames (framing) How to deal with errors (error control) Errors in the physical layer How to mediate access to a link if the link is shared by multiple hosts 3. Link CS470

6 Framing Break the bit stream into frames Why framing?
Raw bit stream cannot provide any error detection capability. Bits may change (lightning strikes). Bits may get lost (clock drift). Challenge How to delimitate frames? 3. Link CS470

7 How to do framing Character count Flag bytes with byte stuffing
Starting and ending flags with bit stuffing 3. Link CS470

8 Character count Uses a field in the header to specify the number of characters in the frame frame1 frame2 frame3 frame4 Problem: What if the count is corrupted error frame1 frame2: wrong ! 3. Link CS470

9 Flag bytes with byte stuffing
Each frame start and end with special bytes Soh block of data in frame eot Flag bytes Start of header: soh End of text: eot 3. Link CS470

10 What if the data contains the flag?
Byte stuffing Uses another special flag. Translates the data to alternative form 3. Link CS470

11 Illustration of Frame with byte stuffing
After byte stuffing, the characters soh and eot do not occur in the data Stuffed frame longer than original 3. Link CS470

12 Disadvantages of byte stuffing
It is closely tied to the use of 8-bit characters Not all character codes use 8-bit characters UNICODE uses 16-bit characters How to support flags with arbitrary sized characters? 3. Link CS470

13 Bit stuffing Allows data frames to contain an arbitrary number of bits
Allows character codes with an arbitrary number of bits per character Each frame begins and ends with a special bit pattern ( ) It’s like flag byte 3. Link CS470

14 Bit stuffing (cont.) Receiver hunts for flag sequence to synchronize
To avoid confusion with data containing 0 inserted after every sequence of five 1s If receiver detects five 1s it checks next bit If 0, it is deleted If 1 and seventh bit is 0, accept as flag If sixth and seventh bits 1, sender is indicating abort 3. Link CS470

15 Bit Stuffing 3. Link CS470

16 Exercise 2. Suppose the following sequence of bits arrive over a link
Assuming a framing protocol that uses bit stuffing, show the bit sequence transmitted over the link when the frame contains the following bit sequence 2. Suppose the following sequence of bits arrive over a link Show the resulting frame after any stuffed bits have been removed. 3. Link CS470

17 Error Detection Parity bits Checksum Cyclic Redundancy Code (CRC)
3. Link CS470

18 Parity Checking Single Bit Parity:
Detect single bit errors 1 Count the number of 1s in the received d+1 bits. An odd number indicates at least one bit errors with an even parity scheme. 3. Link CS470

19 Parity Checking Two Dimensional Bit Parity:
d bits are organized into ixj bit array Parity checking for each column and row Resulting i+j+1 parity bits Detect and correct single bit errors Forward error correction (FEC) Can also detect any combinations of two bit errors 3. Link CS470

20 Checksum Sender: Receiver: treat data as sequence of 16-bit integers
checksum: addition (1’s complement sum) of segment contents Attach the checksum to the end of data segments Receiver: Sum up data and checksum The results are all 1s? Yes, no errors No, errors. 3. Link CS470

21 2/10/2018 Checksum Example Note When adding numbers, a carryout from the most significant bit needs to be added to the result Example: add two 16-bit integers wraparound Kurose and Ross forgot to say anything about wrapping the carry and adding it to low order bit sum checksum 3. Link CS470

22 Exercise Calculate the checksum for the following binary numbers. Give the result in binary. Use the 16-bit format.         3. Link CS470

23 Cyclic Redundancy Check
A major goal in designing error detection algorithm is to maximize the probability of detecting errors using only a small number of redundant bits CRC uses some fairly powerful mathematics to achieve this goal The theoretical foundation of the CRC is finite field 3. Link CS470

24 Cyclic Redundancy Check
An (n+1) bit message is represented by an n degree polynomial, a polynomial whose highest-order term is xn. The message is represented by a polynomial The value of each bit in the message is as the coefficient for each term in the polynomial The most significant bit represents the hightest-order term Eg. An 8-bit message corresponds to the polynomial M(x) = 1 * x7 + 0 * x6 + 0 * x5 + 1 * x4 + 1 * x3 + 0 * x2 + 1 * x1 + 0 * x0 = x7 + x4 + x3 + x We can think of a sender and a receiver as exchanging polynomials with each other 3. Link CS470

25 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) 3. Link CS470

26 CRC Example D.2r R = remainder[ ] G Want: D.2r + R = nG equivalently:
if we divide D.2r by G, want remainder R R = remainder[ ] D.2r G 3. Link CS470

27 Exercise D=11100110, G=11001, r=4 R=? The transmitted bits=?
If no error occurs, how the receiver knows the received bits are correct? 3. Link CS470


Download ppt "CS4470 Computer Networking Protocols"

Similar presentations


Ads by Google