Data Link Layer
Data Link Layer
Data Link Layer
• The data link layer or layer 2 is the second layer of the seven-layer OSI
model of computer networking.
• This layer is the protocol layer that transfers data between adjacent
network nodes in a wide area network (WAN) or between nodes on
the same local area network (LAN) segment.[1]
• The data link layer provides the functional and procedural means to
transfer data between network entities and might provide the means
to detect and possibly correct errors that may occur in the physical
layer.
Concerned
• The data link layer is concerned with local delivery of frames between devices on
the same LAN.
• Data-link frames, as these protocol data units are called, do not cross the
boundaries of a local network.
• Inter-network routing and global addressing are higher-layer functions, allowing
data-link protocols to focus on local delivery, addressing, and media arbitration.
• This way, the data link layer is analogous to a neighborhood traffic cop; it
endeavors to arbitrate between parties contending for access to a medium,
without concern for their ultimate destination.
• When devices attempt to use a medium simultaneously, frame collisions occur.
• Data-link protocols specify how devices detect and recover from such collisions,
and may provide mechanisms to reduce or prevent them.
Functions of the Data-link Layer
The data link layer receives the information in the form of packets from the Network layer, it divides packets into frames
and sends those frames bit-by-bit to the underlying physical layer.
Sub-layers of the Data Link Layer
• The data link layer is further divided into two sub-layers, which are as
follows:
• Logical Link Control (LLC)
• This sublayer of the data link layer deals with multiplexing, the flow of data
among applications and other services, and LLC is responsible for providing
error messages and acknowledgments as well.
• Media Access Control (MAC)
• MAC sublayer manages the device’s interaction, responsible for addressing
frames, and also controls physical media access.
•
DLL
• DLL is also responsible for encoding, decode and organizing the outgoing
and incoming data.
• This is considered the most complex layer of the OSI model as it hides all
the underlying complexities of the hardware from the other above layers.
Services
• Encapsulation
• Frame
synchronization
• Logical link control
(Error & Flow
control)
• Media access
control (MAC, LAN
switching, Physical
addressing, QaS,
VLAN, ...)
Detail
• 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
Addressing
• The data link layer encapsulates the source and destination’s MAC
address/ physical address in the header of each frame to ensure
node-to-node delivery.
• MAC address is the unique hardware address that is assigned to the
device while manufacturing.
Framing
• The packet received from the Network layer is known as a frame in the Data link layer.
• At the sender’s side, DLL receives packets from the Network layer and divides them into small
frames, then, sends each frame bit-by-bit to the physical layer.
• It also attaches some special bits (for error control and addressing) at the header and end of the
frame.
• At the receiver’s end, DLL takes bits from the Physical layer organizes them into the frame, and
sends them to the Network layer.
• Framing is an important aspect of data link layer protocol design because it allows the transmission
of data to be organized and controlled, ensuring that the data is delivered accurately and
efficiently.
Frames
• Frames are the units of digital transmission, particularly in computer networks
and telecommunications. Frames are comparable to the packets of energy called
photons in the case of light energy. Frame is continuously used in Time Division
Multiplexing process.
• Framing is a point-to-point connection between two computers or devices
consisting of a wire in which data is transmitted as a stream of bits.
• However, these bits must be framed into discernible blocks of information.
• Framing is a function of the data link layer.
• It provides a way for a sender to transmit a set of bits that are meaningful to the
receiver.
• Ethernet, token ring, frame relay, and other data link layer technologies have their
own frame structures.
• Frames have headers that contain information such as error-checking codes.
The advantage of using frames is that data is broken up into recoverable chunks that can easily be checked for corrupt
The process of dividing the data into frames and reassembling it is transparent to the user and is handled by the data link layer.
Problems in Framing
• Detecting start of the frame: When a frame is transmitted, every station must be able to
detect it. Station detects frames by looking out for a special sequence of bits that marks
the beginning of the frame i.e. SFD (Starting Frame Delimiter).
• How does the station detect a frame: Every station listens to link for SFD pattern through
a sequential circuit. If SFD is detected, sequential circuit alerts station. Station checks
destination address to accept or reject frame.
• Detecting end of frame: When to stop reading the frame.
• Handling errors: Framing errors may occur due to noise or other transmission errors,
which can cause a station to misinterpret the frame. Therefore, error detection and
correction mechanisms, such as cyclic redundancy check (CRC), are used to ensure the
integrity of the frame.
• Framing overhead: Every frame has a header and a trailer that contains control
information such as source and destination address, error detection code, and other
protocol-related information. This overhead reduces the available bandwidth for data
transmission, especially for small-sized frames.
Problems in Framing
• Framing incompatibility: Different networking devices and protocols may
use different framing methods, which can lead to framing incompatibility
issues. For example, if a device using one framing method sends data to a
device using a different framing method, the receiving device may not be
able to correctly interpret the frame.
• Framing synchronization: Stations must be synchronized with each other
to avoid collisions and ensure reliable communication. Synchronization
requires that all stations agree on the frame boundaries and timing, which
can be challenging in complex networks with many devices and varying
traffic loads.
• Framing efficiency: Framing should be designed to minimize the amount of
data overhead while maximizing the available bandwidth for data
transmission. Inefficient framing methods can lead to lower network
performance and higher latency.
Types of framing
• Data can get corrupted due to various reasons like noise, attenuation,
etc. So, it is the responsibility of the data link layer, to detect the
error in the transmitted data and correct it using error
detection and correction techniques respectively. DLL adds error
detection bits into the frame’s header, so that receiver can check
received data is correct or not. It adds reliability to phyiscal layer by
adding mechansims to detect and retransmit damaged or lost frames.
ARP Address Resolution Protocol
ARCnet
ATM
CDP Cisco Discovery Protocol
CAN Controller Area Network
Econet
Ethernet
EAPS Ethernet Automatic Protection Switching
FDDI Fiber Distributed Data Interface
Frame Relay
HDLC High-Level Data Link Control
IEEE 802.2 provides LLC functions to IEEE 802 MAC layers
IEEE 802.11 wireless LAN
I²C
LattisNet
LAPD Link Access Procedures, D channel
LLDP Link Layer Discovery Protocol
LocalTalk
MIL-STD-1553
MPLS Multiprotocol Label Switching
NDP Nortel Discovery Protocol
SDN OpenFlow
PPP Point-to-Point Protocol
Profibus
SpaceWire
SLIP Serial Line Internet Protocol (obsolete)
SMLT Split multi-link trunking
IEEE 802.1aq Shortest Path Bridging
Spanning Tree Protocol
StarLan
Token ring
UDLD Unidirectional Link Detection
UNI/O