Data Link Layer Services
Data Link Layer is the second layer of seven-layer Open System Interconnection (OSI) reference model of computer networking and lies just above Physical Layer. It is responsible for receiving and getting data bits usually from Physical Layer and then converting these bits into groups, known as data link frames so that it can be transmitted further. It is also responsible to handle errors that might arise due to transmission of bits.
Services Offered by Data Link Layer
The data link layer provides various services as given below :
1. Framing
The data link layer organizes raw bits from the physical layer into structured data units called frames. It ensures proper synchronization between sender and receiver by adding headers and trailers to the data. Framing helps in identifying the beginning and end of a data packet and hence, preventing data loss or corruption.
There are two types of framing:
- Fixed size
- Variable size

Read more about Framing in Data Link Layer.
2.Error Detection
To detect errors, some common methods include:
2.1 Simple Parity Check :
- It involves adding an extra bit (called the parity bit) to a string of data bits.
- This bit is set to make the total number of 1's either even (even parity) or odd (odd parity).
- When the data is received or read, the parity bit is checked to see if it matches the expected value (even or odd).
- If it doesn't, it indicates that an error may have occurred in the data transmission.

Read about LRC(2-D Parity Check).
2.2 Checksum:
- The sum of data bits is calculated and a small value (the checksum) is appended to the data.
- The receiver performs the same calculation and compares the result to the transmitted checksum.
- If they match, the data is considered valid and if not, an error is detected.

Read in detail about Checksum.
2.3 CRC (Cyclic Redundancy Check):
- It treats data as a large polynomial and divides it by a predefined polynomial divisor.
- The remainder of this division is appended to the data.
- The receiver performs the same division and checks if the remainder matches the transmitted CRC.
- If there's a mismatch, an error is detected.
If the dataword of length n and divisor of length k is given then,
Length of CRC bits=k-1 bits
Length of Code word = n+k-1 bits
Example: Let’s dataword be 1010000 and divisor in the form of polynomial is x3+1. CRC method discussed below.

Read more about CRC and it's Implementation.
3.Error Correction
Error correction involves techniques to correct errors that may occur during data transmission between two nodes in a network. Common error-correction methods include:
- Automatic Repeat Request (ARQ): This technique uses a feedback mechanism to ensure data is received correctly. If an error is detected, the receiver sends a request for the sender to retransmit the data. Common ARQ types include:
- In Stop-and-Wait ARQ, the sender waits for an acknowledgment (ACK) before sending the next frame.
- In Go-Back-N ARQ, the sender can send multiple frames, but if one is lost or has error, all subsequent frames must be retransmitted.
- In Selective Repeat ARQ, only the frames with errors or lost frames are retransmitted, improving efficiency.
- Forward Error Correction (FEC): It involves adding redundant data (error-correcting codes) to the transmission so that the receiver can detect and correct certain types of errors without needing retransmission. Examples include:
- Hamming Code: It corrects single-bit errors and detects two-bit errors.
- Reed-Solomon Code: A more advanced error-correcting code that can correct multiple errors in the data.
4.Flow Control
It is a method to manage the rate of data transmission between sender and receiver in order to prevent buffer overflow or congestion. Flow control methods include:
- In Stop-and-Wait, the sender transmits one frame at a time and waits for an acknowledgment (ACK) from the receiver before sending the next frame.
- In Sliding Window, this method allows the sender to transmit multiple frames before waiting for ACKs. The sender can transmit a set number of frames (determined by the window size) while the receiver sends back ACKs for successfully received frames. This provides better efficiency compared to Stop-and-Wait.
5.Addressing
Addressing at the Data Link Layer is used for identifying devices within a local network or link. It uses physical or MAC (Media Access Control) addresses to ensure that data is delivered to the correct device.
- MAC Address is a hardware address associated to network interface card (NIC) or network device. The MAC address is used to route frames between devices within the same local network or between connected networks in a point-to-point link.
- Logical addressing can also be used with MAC addressing to provide higher-level services such as multiplexing or identifying different protocols (Ethernet, Wi-Fi, etc.).
Limitations of Data Link Layer
- It lacks encryption and authentication mechanism hence, it is vulnerable to attacks such as MAC address spoofing and eavesdropping.
- It operates within a local network (LAN) or a direct point-to-point connection. It cannot handle routing across multiple networks like the Network Layer (Layer 3).
- It ensures reliable communication only between directly connected devices but does not provide end-to-end delivery across an entire network.
- Protocols like Ethernet may struggle with congestion and performance issues in large networks because of excessive broadcast messages and data collisions.
Which is the main device used in the data link layer?
A switch is a main device used in the Data Link Layer to direct data packets between devices on a network based on their MAC addresses.
What are common protocols used in Data Link Layer?
Common protocols in Data Link Layer include:
- Ethernet (IEEE 802.3)
- Wi-Fi (IEEE 802.11)
- PPP (Point-to-Point Protocol)
- HDLC (High-Level Data Link Control)
What is the difference between Logical Link Control (LLC) and Media Access Control (MAC)?
LLC manages error control and flow control, while MAC determines how devices access the network and handles physical addressing (MAC addresses)