Unit-5 Datalink Layer

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

Data Link Layer

• In the OSI model, the data link layer is a 4th layer from the top and 2nd layer from the
bottom.

• The communication channel that connects the adjacent nodes is known as links, and
in order to move the datagram from source to the destination, the datagram must be
moved across an individual link.

• The main responsibility of the Data Link Layer is to transfer the datagram across an
individual link.

• The Data link layer protocol defines the format of the packet exchanged across the
nodes as well as the actions such as Error detection, retransmission, flow control,
and random access.

• The Data Link Layer protocols are Ethernet, token ring, FDDI and PPP.

• An important characteristic of a Data Link Layer is that datagram can be handled by


different link layer protocols on different links in a path. For example, the datagram
is handled by Ethernet on the first link, PPP on the second link.

Following services are provided by the Data Link


Layer:

• Framing & Link access: Data Link Layer protocols encapsulate each network frame
within a Link layer frame before the transmission across the link. A frame consists of
a data field in which network layer datagram is inserted and a number of data fields.
It specifies the structure of the frame as well as a channel access protocol by which
frame is to be transmitted over the link.

• Reliable delivery: Data Link Layer provides a reliable delivery service, i.e.,


transmits the network layer datagram without any error. A reliable delivery service is
accomplished with transmissions and acknowledgements. A data link layer mainly
provides the reliable delivery service over the links as they have higher error rates
and they can be corrected locally, link at which an error occurs rather than forcing to
retransmit the data.

• Flow control: A receiving node can receive the frames at a faster rate than it can
process the frame. Without flow control, the receiver's buffer can overflow, and
frames can get lost. To overcome this problem, the data link layer uses the flow
control to prevent the sending node on one side of the link from overwhelming the
receiving node on another side of the link.

• Error detection: Errors can be introduced by signal attenuation and noise. Data


Link Layer protocol provides a mechanism to detect one or more errors. This is
achieved by adding error detection bits in the frame and then receiving node can
perform an error check.

• Error correction: Error correction is similar to the Error detection, except that


receiving node not only detect the errors but also determine where the errors have
occurred in the frame.

• Half-Duplex & Full-Duplex: In a Full-Duplex mode, both the nodes can transmit
the data at the same time. In a Half-Duplex mode, only one node can transmit the
data at the same time.
Issues of Data Link Layer:
The main functions and the design issues of this layer are

• Providing services to the network layer


• Framing
• Error Control
• Flow Control

Flow control in Data Link Layer


Flow control is a technique that allows two stations working at different speeds to
communicate with each other. It is a set of measures taken to regulate the amount of
data that a sender sends so that a fast sender does not overwhelm a slow receiver. In
data link layer, flow control restricts the number of frames the sender can send before it
waits for an acknowledgment from the receiver.
Approaches of Flow Control
Flow control can be broadly classified into two categories −

• Feedback based Flow Control - In these protocols, the sender sends frames after it has
received acknowledgments from the user. This is used in the data link layer.

• Rate based Flow Control - These protocols have built in mechanisms to restrict the rate of
transmission of data without requiring acknowledgment from the receiver. This is used in the
network layer and the transport layer.

Flow Control Techniques in Data Link Layer


Data link layer uses feedback based flow control mechanisms. There are two main
techniques −
Stop and Wait
This protocol involves the following transitions −

• The sender sends a frame and waits for acknowledgment.

• Once the receiver receives the frame, it sends an acknowledgment frame back to the sender.

• On receiving the acknowledgment frame, the sender understands that the receiver is ready
to accept the next frame. So it sender the next frame in queue.

Sliding Window
This protocol improves the efficiency of stop and wait protocol by allowing multiple
frames to be transmitted before receiving an acknowledgment.

The working principle of this protocol can be described as follows −

• Both the sender and the receiver has finite sized buffers called windows. The sender and the
receiver agrees upon the number of frames to be sent based upon the buffer size.

• The sender sends multiple frames in a sequence, without waiting for acknowledgment. When
its sending window is filled, it waits for acknowledgment. On receiving acknowledgment, it
advances the window and transmits the next frames, according to the number of
acknowledgments received.

Error control in Data Link Layer


Error control in data link layer is the process of detecting and correcting data frames
that have been corrupted or lost during transmission.

In case of lost or corrupted frames, the receiver does not receive the correct data-frame
and sender is ignorant about the loss. Data link layer follows a technique to detect
transit errors and take necessary actions, which is retransmission of frames whenever
error is detected or frame is lost. The process is called Automatic Repeat Request
(ARQ).
Phases in Error Control
The error control mechanism in data link layer involves the following phases:

• Detection of Error − Transmission error, if any, is detected by either the sender or the
receiver.

• Acknowledgment − acknowledgment may be positive or negative.

• Positive ACK − On receiving a correct frame, the receiver sends a positive


acknowledge.

• Negative ACK − On receiving a damaged frame or a duplicate frame, the receiver


sends a negative acknowledgment back to the sender.

• Retransmission − The sender maintains a clock and sets a timeout period. If an


acknowledgment of a data-frame previously transmitted does not arrive before the timeout,
or a negative acknowledgment is received, the sender retransmits the frame.

Error Control Techniques


There are three main techniques for error control:

• Stop and Wait ARQ

This protocol involves the following transitions:

• A timeout counter is maintained by the sender, which is started when a frame is sent.

• If the sender receives acknowledgment of the sent frame within time, the sender is
confirmed about successful delivery of the frame. It then transmits the next frame in
queue.

• If the sender does not receive the acknowledgment within time, the sender assumes
that either the frame or its acknowledgment is lost in transit. It then retransmits the
frame.

• If the sender receives a negative acknowledgment, the sender retransmits the frame.

• Go-Back-N ARQ

The working principle of this protocol is:

• The sender has buffers called sending window.

• The sender sends multiple frames based upon the sending-window size, without
receiving the acknowledgment of the previous ones.

• The receiver receives frames one by one. It keeps track of incoming frame’s
sequence number and sends the corresponding acknowledgment frames.

• After the sender has sent all the frames in window, it checks up to what sequence
number it has received positive acknowledgment.

• If the sender has received positive acknowledgment for all the frames, it sends next
set of frames.

• If sender receives NACK or has not receive any ACK for a particular frame, it
retransmits all the frames after which it does not receive any positive ACK.

• Selective Repeat ARQ

• Both the sender and the receiver have buffers called sending window and receiving
window respectively.
• The sender sends multiple frames based upon the sending-window size, without
receiving the acknowledgment of the previous ones.

• The receiver also receives multiple frames within the receiving window size.

• The receiver keeps track of incoming frame’s sequence numbers, buffers the frames
in memory.

• It sends ACK for all successfully received frames and sends NACK for only frames
which are missing or damaged.

• The sender in this case, sends only packet for which NACK is received.

DataLink Layer Protocols:


HDLC:
High-level Data Link Control (HDLC)
High-level Data Link Control (HDLC) is a group of communication protocols of the data
link layer for transmitting data between network points or nodes. Since it is a data link
protocol, data is organized into frames. A frame is transmitted via the network to the
destination that verifies its successful arrival. It is a bit - oriented protocol that is
applicable for both point - to - point and multipoint communications.
Transfer Modes
HDLC supports two types of transfer modes, normal response mode and asynchronous
balanced mode.

• Normal Response Mode (NRM) − Here, two types of stations are there, a primary station
that send commands and secondary station that can respond to received commands. It is
used for both point - to - point and multipoint communications.

• Asynchronous Balanced Mode (ABM) − Here, the configuration is balanced, i.e. each
station can both send commands and respond to commands. It is used for only point - to -
point communications.

HDLC Frame
HDLC is a bit - oriented protocol where each frame contains up to six fields. The
structure varies according to the type of frame. The fields of a HDLC frame are −

• Flag − It is an 8-bit sequence that marks the beginning and the end of the frame. The bit
pattern of the flag is 01111110.

• Address − It contains the address of the receiver. If the frame is sent by the primary station,
it contains the address(es) of the secondary station(s). If it is sent by the secondary station, it
contains the address of the primary station. The address field may be from 1 byte to several
bytes.

• Control − It is 1 or 2 bytes containing flow and error control information.

• Payload − This carries the data from the network layer. Its length may vary from one
network to another.

• FCS − It is a 2 byte or 4 bytes frame check sequence for error detection. The standard code
used is CRC (cyclic redundancy code)

Types of HDLC Frames


There are three types of HDLC frames. The type of frame is determined by the control
field of the frame −

• I-frame − I-frames or Information frames carry user data from the network layer. They also
include flow and error control information that is piggybacked on user data. The first bit of
control field of I-frame is 0.

• S-frame − S-frames or Supervisory frames do not contain information field. They are used
for flow and error control when piggybacking is not required. The first two bits of control field
of S-frame is 10.

• U-frame − U-frames or Un-numbered frames are used for myriad miscellaneous functions,
like link management. It may contain an information field, if required. The first two bits of
control field of U-frame is 11.

Point-to-Point Protocol (PPP)


Point - to - Point Protocol (PPP) is a communication protocol of the data link layer that is
used to transmit multiprotocol data between two directly connected (point-to-point)
computers. It is a byte - oriented protocol that is widely used in broadband
communications having heavy loads and high speeds. Since it is a data link layer
protocol, data is transmitted in frames. It is also known as RFC 1661.
Services Provided by PPP
The main services provided by Point - to - Point Protocol are −

• Defining the frame format of the data to be transmitted.

• Defining the procedure of establishing link between two points and exchange of data.

• Stating the method of encapsulation of network layer data in the frame.

• Stating authentication rules of the communicating devices.


• Providing address for network communication.

• Providing connections over multiple links.

• Supporting a variety of network layer protocols by providing a range os services.

Components of PPP
Point - to - Point Protocol is a layered protocol having three components −

• Encapsulation Component − It encapsulates the datagram so that it can be transmitted


over the specified physical layer.

• Link Control Protocol (LCP) − It is responsible for establishing, configuring, testing,


maintaining and terminating links for transmission. It also imparts negotiation for set up of
options and use of features by the two endpoints of the links.

• Authentication Protocols (AP) − These protocols authenticate endpoints for use of


services. The two authentication protocols of PPP are:

• Password Authentication Protocol (PAP)

• Challenge Handshake Authentication Protocol (CHAP)

• Network Control Protocols (NCPs) − These protocols are used for negotiating the
parameters and facilities for the network layer. For every higher-layer protocol supported by
PPP, one NCP is there. Some of the NCPs of PPP are:

• Internet Protocol Control Protocol (IPCP)

• OSI Network Layer Control Protocol (OSINLCP)

• Internetwork Packet Exchange Control Protocol (IPXCP)

• DECnet Phase IV Control Protocol (DNCP)

• NetBIOS Frames Control Protocol (NBFCP)

• IPv6 Control Protocol (IPV6CP)

PPP Frame
PPP is a byte - oriented protocol where each field of the frame is composed of one or
more bytes. The fields of a PPP frame are −

• Flag − 1 byte that marks the beginning and the end of the frame. The bit pattern of the flag
is 01111110.

• Address − 1 byte which is set to 11111111 in case of broadcast.


• Control − 1 byte set to a constant value of 11000000.

• Protocol − 1 or 2 bytes that define the type of data contained in the payload field.

• Payload − This carries the data from the network layer. The maximum length of the payload
field is 1500 bytes. However, this may be negotiated between the endpoints of
communication.

• FCS − It is a 2 byte or 4 bytes frame check sequence for error detection. The standard code
used is CRC (cyclic redundancy code)

Byte Stuffing in PPP Frame − Byte stuffing is used is PPP payload field whenever the
flag sequence appears in the message, so that the receiver does not consider it as the
end of the frame. The escape byte, 01111101, is stuffed before every byte that contains
the same byte as the flag byte or the escape byte. The receiver on receiving the
message removes the escape byte before passing it onto the network layer.

The SLIP Protocol


SLIP means Serial Line Internet Protocol. SLIP is the result of the integration of modem
protocols prior to the suite of TCP/IP protocols. It is a simple Internet link protocol conducting
neither address nor error control, which is the reason that it is quickly becoming obsolete in
comparison to PPP.

Data transmission with SLIP is very simple: this protocol sends a frame composed only of data
to be sent followed by an end of transmission character (i.e. the END character, the ASCII
code 192). A SLIP frame looks like this:

Data to be transmitted END

Details of PPP and Slip in Following Links:


slip-and-ppp.pdf

You might also like