UNIT-II The Data Link Layer.

Slides:



Advertisements
Similar presentations
Local Area Networks by R.S. Chang, Dept. CSIE, NDHU 1 Chapter 3 The Data Link Layer user A user B reliable transmission over unreliable physical link.
Advertisements

5-1 Data Link Layer l Objective: to achieve reliable and efficient communication between 2 adjacent machines l Data link layer design issues n services.
The Data Link Layer Chapter 3. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.
1 Lecture #12: Data Link Layer. Error Control. C o n t e n t s l Services Provided by DLL l DLL data structures l Error Control Mechanisms –Error correcting.
EEC-484/584 Computer Networks Lecture 6 Wenbing Zhao
CSCI 4550/8556 Computer Networks Comer, Chapter 7: Packets, Frames, And Error Detection.
EEC-484/584 Computer Networks Lecture 12 Wenbing Zhao Cleveland State University
The Data Link Layer Chapter 3. Position of the data-link layer.
The OSI Reference Model
EEC-484/584 Computer Networks Lecture 7 Wenbing Zhao (Part of the slides are based on materials supplied by Dr. Louise Moser at UCSB and.
20101 The Data Link Layer Chapter Design Issues Controls communication between 2 machines directly connected by “wire”-like link Services Provided.
Adapted from Tanenbaum's Slides for Computer Networking, 4e The Data Link Layer Chapter 3.
EEC-484/584 Computer Networks Lecture 7 Wenbing Zhao (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.
Error Detection and Reliable Transmission EECS 122: Lecture 24 Department of Electrical Engineering and Computer Sciences University of California Berkeley.
EEC-484/584 Computer Networks Lecture 7 Wenbing Zhao
Data Link Layer - 1 Dr. Sanjay P. Ahuja, Ph.D. Fidelity National Financial Distinguished Professor of CIS School of Computing, UNF.
TOBB ETÜ ELE46/ELE563 Communications Networks Lecture 01 May 6, 2014 Fall 2011 Tuesday 10:30 – 12:20 (310) Thursday 15:30 – 17:20 (372) İsrafil Bahçeci.
1 Data Link Layer Lecture 20 Imran Ahmed University of Management & Technology.
Chi-Cheng Lin, Winona State University CS 313 Introduction to Computer Networking & Telecommunication Data Link Layer Part I – Designing Issues and Elementary.
ICOM 6115©Manuel Rodriguez-Martinez ICOM 6115 – Computer Networks and the WWW Manuel Rodriguez-Martinez, Ph.D. Lecture 14.
جلسه هشتم شبکه های کامپیوتری به نــــــــــــام خدا.
Chapt 3 Data Link Layer1 Data Link Layer Functions –Provides services to network layer Well-defined interface –Framing –Flow control – between adjacent.
Review:. Chapter 3: The Data Link Layer –achieve reliable, efficient communication between two physically connected machines. –Example problems to be.
Data Link Layer. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.
Data Link Layer : Services, Framing, Error Detection and Correction2.
The Data Link Layer Goal –As reliable as possible, efficient communication Point-to-Point –single connection –bits arrive in order sent Not necessarily.
Chapter 3 The Data Link Layer (60 % practical part)
ECE453 – Introduction to Computer Networks Lecture 4 – Data Link Layer (I)
Layer Two Data Link Layer Collects bits from layer 1 and organizes into frames Passes bits that make up frames to layer 1 for transmission Concerned with.
McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Data Link Layer PART III.
Computer Networks Lecture 2: Data Link Based on slides from D. Choffnes Northeastern U. and P. Gill from StonyBrook University Revised Autumn 2015 by S.
CHAPTER 3: DATA LINK CONTROL Flow control, Error detection – two dimensional parity checks, Internet checksum, CRC, Error control, Transmission efficiency.
Wireless and Mobile Networks (ELEC6219) Session 3: Theories of Data Communications. Data Link Layer. Adriana Wilde and Jeff Reeve 22 January 2015.
COMPUTER NETWORKS. Unit -2 Continue... Physical Layer Connection –Oriented Networks : X.25 Relay Frames Types of cables Co-axial Fiber optics Twisted.
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.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011 The Data Link Layer Chapter 3.
The Data Link Layer Chapter 3. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.
Network Models. 2.1 what is the Protocol? A protocol defines the rules that both the sender and receiver and all intermediate devices need to follow,
Data Link Control. The two main functions of the data link layer are data link control and media access control. The first, data link control, deals with.
The Data Link Layer RIS 251 Dr. ir. S.S. Msanjila.
CS4470 Computer Networking Protocols
Error Detection and Correction
The Data Link Layer.
Data Link Layer Flow Control.
Net 221D : Computer Networks Fundamentals
Data Link Layer Objective: to achieve reliable and efficient communication between 2 adjacent machines Data link layer design issues services provided.
Data Link Layer.
Data link layer (LLC).
CIS 321 Data Communications & Networking
Chapter 3 The Data Link Layer
Data Link Layer What does it do?
Part III Datalink Layer 10.
UNIT 3. The Data Link Layer
Packetizing Error Detection
Net 221D : Computer Networks Fundamentals
Packetizing Error Detection
CS412 Introduction to Computer Networking & Telecommunication
Basic concepts Networks must be able to transfer data from one device to another with complete accuracy. Data can be corrupted during transmission. For.
Chapter 7 Error Detection and Correction
EEC-484/584 Computer Networks
Data Link Layer Objective: to achieve reliable and efficient communication between 2 adjacent machines Data link layer design issues services provided.
Packetizing Error Detection
Data Link Layer Objective: to achieve reliable and efficient communication between 2 adjacent machines Data link layer design issues services provided.
EEC-484/584 Computer Networks
Error Detection and Correction
Error detection: Outline
EECS 122: EE122: Error Detection and Reliable Transmission
Data Link Layer. Position of the data-link layer.
data link Control layer (DLC) – ARQ protocols
Presentation transcript:

UNIT-II The Data Link Layer

The Data Link Layer Data-Link Layer has responsibility of transferring frames from one node to adjacent node over a link The data link layer takes the packets it gets from the network layer and encapsulates them into frames for transmission . Each frame contains frame header ,a payload field for holding the packet ,and a frame trailer 5/21/2019 Sam_CN_UNIT-II

3.1 Data Link Layer design issues Services Provided to the Network Layer Framing Error Control Flow Control 5/21/2019 Sam_CN_UNIT-II

3.1 Data Link Layer Design Issues Functions of Data Link Layer Providing a well-defined service interface to the network layer Determining how the bits of the physical layer are grouped into frames Dealing with transmission errors Regulating the flow of frames so that slow receivers are not swamped by fast senders 5/21/2019 Sam_CN_UNIT-II

3.1 Data Link Layer Design Issues Relationship between packets and frames 5/21/2019 Sam_CN_UNIT-II

3.1 Data Link Layer Design Issues 3.1.1 Services Provided to the Network layer Model used 5/21/2019 Sam_CN_UNIT-II

3.1 Data Link Layer Design Issues 3.1.1 Services Provided to the Network layer Three reasonable possibilities for data link services: 1. Unacknowledged connectionless service 2. Acknowledged connectionless service 3. Acknowledged connection-oriented service 5/21/2019 Sam_CN_UNIT-II

3.1 Data Link Layer Design Issues 3.1.1 Services Provided to the Network layer Unacknowledged connectionless service 1. The source sends independent frames to the destination without the destination acknowledging them. 2. No connection is established beforehand or released afterward 3. If a frame is lost due to noise on the line, no attempt is made to recover it in the data link layer 4. Appropriate when the error rate is very low 5. Appropriate for real-time traffic, such as speech, in which late data are worse than bad data 6. Most LANs use unacknowledged connectionless service 5/21/2019 Sam_CN_UNIT-II

3.1 Data Link Layer Design Issues 3.1.1 Services Provided to the Network layer Acknowledged connectionless service Each frame sent is individually acknowledged. In this way, the sender knows whether or not a frame has arrived safely. If it has not arrived within a specified time interval, it can be sent again It is perhaps worth emphasizing that providing acknowledgements in the data link layer is just an optimization, never a requirement. The transport layer can always send a message and wait for it to be acknowledged 5/21/2019 Sam_CN_UNIT-II

3.1 Data Link Layer Design Issues 3.1.1 Services Provided to the Network layer Acknowledged connectionless service The trouble with this strategy is that if the average message is broken up into, say, 10 frames, and 20 percent of all frames are lost, it may take a very long time for the message to get through. If individual frames are acknowledged and retransmitted, entire messages get through much faster On reliable channels, such as fiber, the overhead of a heavyweight data link protocol may be unnecessary, but on wireless channels it is well worth the cost due to their inherent unreliability 5/21/2019 Sam_CN_UNIT-II

3.1 Data Link Layer Design Issues 3.1.1 Services Provided to the Network layer Acknowledged connection-oriented service 1. The source and the destination establish a connection before and data are transferred 2. Each frame sent over the connection is numbered 3. The data link layer guarantees that each frame sent is indeed received 4. Furthermore, it guarantees that each frame is received exactly once and that all frames are received in the right order 5. Connection-oriented service provides the network layer with the equivalent of a reliable bit stream 5/21/2019 Sam_CN_UNIT-II

3.1 Data Link Layer Design Issues 3.1.2 Framing The data link uses the services provided by the physical layer. The physical layer will not be perfect. It is up to the data link layer to detect, and if necessary, correct errors The usual approach is for the data link layer to break the bit stream up into discrete frames and compute the checksum for each frame. When a frame arrives at the destination, the checksum is recomputed. If the newly computed checksum is different from the one contained in the frame, the data link layer knows that an error has occurred and takes steps to deal with it 5/21/2019 Sam_CN_UNIT-II

3.1 Data Link Layer Design Issues 3.1.2 Framing: The usual approach is for the data link layer to break the bit stream up into discrete frames and compute the checksum for each frame Breaking the bit stream up into frames is more difficult than it at first appears, One way to achieve this framing is to insert time gaps between frames, much like the spaces between words in ordinary text Four framing methods are used : 1. Character count 2. Starting and ending characters, with character stuffing 3. Starting and ending flags, with bit stuffing 4. Physical layer coding violations 5/21/2019 Sam_CN_UNIT-II

3.1 Data Link Layer Design Issues 3.1.2 Framing: Character count Without error Without error Without error With one error With one error 5/21/2019 Sam_CN_UNIT-II

3.1 Data Link Layer Design Issues 3.1.2 Framing: Character count The first framing method uses a field in the header to specify the number of characters in the frame When the data link layer in the destination sees the character count ,it knows how many characters follow and hence where the end of the frame is Even if the checksum is incorrect so the destination knows that the frame is bad, it still has no way of telling where the next frame starts The trouble with this algorithm is that the count can be garbled by a transmission error 5/21/2019 Sam_CN_UNIT-II

3.1 Data Link Layer Design Issues 3.1.2 Framing: Starting and ending characters, with Character stuffing a) A frame delimited by flag bytes b) Four examples of byte sequences before and after byte stuffing 5/21/2019 Sam_CN_UNIT-II

3.1 Data Link Layer Design Issues 3.1.2 Framing: Starting and ending characters, with Character stuffing Most protocols used the same byte ,called flag byte, as both the starting and ending delimiter as FLAG. Two consecutive flag bytes indicate the end of one frame and start of the next one A major disadvantage of using this framing method is that it is closely tied to 8-bit characters in general and the ASCII character code in particular We need a technique to allow arbitrary sized characters 5/21/2019 Sam_CN_UNIT-II

3.1 Data Link Layer Design Issues 3.1.2 Framing: Starting and ending flags, with Bit Stuffing This new technique allows data frames to contain an arbitrary number of bits and allow character codes with an arbitrary number of bits per character Each frame begins and ends with a special bit pattern,01111110 called a flag byte. whenever the senders data link layer encounters five consecutive ones in the data , it automatically stuffs a 0 bit into the outgoing bit stream. whenever the receiver sees five consecutive incoming 1 bits, followed by a 0 bit ,it automatically destuffs (i.e deletes) the 0 bit. 5/21/2019 Sam_CN_UNIT-II

3.1 Data Link Layer Design Issues 3.1.2 Framing: Starting and ending flags, with Bit Stuffing Flags (01111110) at the beginning and end Bit-oriented framing with bit stuffing 5/21/2019 Sam_CN_UNIT-II

3.1 Data Link Layer Design Issues 3.1.2 Framing: Physical layer coding violations This method of framing is only applicable to networks in which the encoding on the physical medium contains some redundancy For example, some LANs encode 1 bit of data by using 2 physical bits. Normally, a 1 bit is a high-low pair and a 0 bit is a low-high pair. The combinations high-high and low-low are not used for data and they can be used as frame boundaries 5/21/2019 Sam_CN_UNIT-II

3.1 Data Link Layer Design Issues 3.1.3 Error Control The usual way to ensure reliable delivery is to provide the sender with some feedback about what is happening at the other end of the line Data Frame Sender Receiver Acknowledgement (ACK) Or negative Acknowledgement (NAK) 5/21/2019 Sam_CN_UNIT-II

3.1 Data Link Layer Design Issues 3.1.3 Error Control An additional complication comes from the possibility that hardware troubles may cause a frame to vanish completely. In this case, the receiver will not react at all This possibility is dealt with by introducing timers into the data link layer When a sender transmits a frame, it generally also starts a timer The timer is set to expire after an interval long enough for the frame to reach the destination, be processed there ,and have the acknowledgement to propagate back to the sender 5/21/2019 Sam_CN_UNIT-II

3.1 Data Link Layer Design Issues 3.1.3 Error Control However, when frames may be transmitted multiple times there is a danger that the receiver will accept the same frame two or more times, and pass it to the network layer more than once To prevent this from happening, it is generally necessary to assign sequence numbers to outgoing frames, so that the receiver can distinguish retransmissions from originals 5/21/2019 Sam_CN_UNIT-II

3.1 Data Link Layer Design Issues 3.1.4 Flow Control When the sender is running on a fast (or lightly loaded) computer and the receiver is running on a slow (or heavily loaded machine) and what to do with a sender that systematically wants to transmit frames faster than the receiver can accept them? Even if the transmission is error free ,at a certain point the receiver will simply be unable to handle the frames as they arrive and will start to loose someone To prevent this situation, Feedback- based flow control mechanism is used 5/21/2019 Sam_CN_UNIT-II

3.1 Data Link Layer Design Issues 3.1.4 Flow Control Feedback- based flow control ,the receiver sends back information to the sender giving it permission to send more data Various flow control schemes are known, but most of them use the same basic principle. The protocol contains well-defined rules about when a sender may transmit the next frame These rules often prohibit frames from being sent until the receiver has granted permission, either implicitly or explicitly 5/21/2019 Sam_CN_UNIT-II

3.2 Error Detection and Correction In some cases it is sufficient to detect an error and in some, it requires the errors to be corrected also For e.g. On a reliable medium : Error Detection is sufficient where the error rate is low and asking for retransmission after Error Detection would work efficiently In contrast, on an unreliable medium : Retransmission after Error Detection may result in another error and still another and so on. Hence Error Correction is desirable 5/21/2019 Sam_CN_UNIT-II

3.2.1 Error Correcting codes A frame consists of m data (i.e., message ) bits and r redundant, or check bits Let the total length be n (i.e., n=m+r). an n-bit unit containing data and check bits is often referred to as an n-bit codeword Given any two code words ,say,10001001 and 10110001,it is possible to define how many bits differ .In this case 3 bits differ. To determine how many bits differ ,just EXCLUSIVE OR the two code words ,and count the number of 1 bits in the result. The number of bit positions in which two code words differ is called the Hamming distance Its significance is that if two code words are a hamming distance d apart, it will require d single-bit errors to convert one into another 5/21/2019 Sam_CN_UNIT-II

3.2.1 Error Correcting codes To detect d errors, you need a distance d+1 code To correct d errors, you need a distance 2d+1 code Consider a code with only 4 valid codewords: 0000000000, 0000011111, 1111100000, 1111111111 This code has a distance of 5, which means that it can detect double errors 5/21/2019 Sam_CN_UNIT-II

3.2.1 Error Correcting codes A simple example an error-detecting code, consider a code in which a single parity bit is appended to the data The parity bit is chosen so that the number of 1 bits in the codeword is even (or odd) For example, when 10110101 is sent in even parity by adding a bit at the end ,it becomes 101101011,where as 10110001 becomes 101100010 with even parity A code word with a single parity bit has a distance 2,since any single bit error produces a codeword with the wrong parity 5/21/2019 Sam_CN_UNIT-II

3.2.2 Error-detecting Codes: CRC (Cyclic Redundancy Code) When the polynomial code method is employed ,the sender and receiver must agree upon a generator polynomial G(x) . In advance both higher and lower order bits of generator must be 1. To compute the check sum for some frame with m bits ,corresponding to the polynomial M(x), the frame must be longer than the generator polynomial. The idea is to append a checksum to the end of the frame in such a way that the polynomial represented by the check summed frame is divisible by G(x). When the receiver gets the check summed frame, it tries dividing it by G(x). If there is a remainder ,there has been a transmission error 5/21/2019 Sam_CN_UNIT-II

3.2.2 CRC : Algorithm for computing checksum 1. Let r be the degree of G(x). Append r zero bits to the low-order end of the frame ,so it now contains m+r bits and corresponds to the polynomial xrM(x) 2. Divide the bit string corresponding to G(x) in to the bit string corresponding to XrM(x) using modulo 2 division 3. subtract the remainder (which is always r or fewer bits ) from the bit string correspond to XrM(x) using modulo 2 subtraction. The result is the check summed frame to be transmitted .call its polynomial T(x) 5/21/2019 Sam_CN_UNIT-II

Calculation of the polynomial code checksum Frame: 1001 Generator : 1011 5/21/2019 Sam_CN_UNIT-II

Division in the CRC decoder for two cases 5/21/2019 Sam_CN_UNIT-II

5/21/2019 Sam_CN_UNIT-II