The Data Link Layer is the second layer of the OSI model. It is responsible for providing reliable communication between two directly connected nodes.
For example:
Computer A Computer B
│ │
│ Data Link Layer │
└──────────────→───────────────────┘
Direct Link
The Data Link Layer receives packets from the Network Layer and converts them into frames before sending them to the Physical Layer.
1. Main Functions / Design Issues
The major design issues of the Data Link Layer are:
- Services provided to the Network Layer
- Framing
- Error Control
- Flow Control
- Medium Access Control
- Physical Addressing
- Reliable Delivery
Let’s understand them one by one.
2. Services Provided to the Network Layer
The Data Link Layer provides services to the Network Layer.
The Network Layer does not need to know the detailed operation of the physical link.
The Data Link Layer hides these details and provides an appropriate service.
There are generally three types of services:
1. Unacknowledged Connectionless Service
No connection is established and no acknowledgement is required.
Sender ─────────→ Receiver
Frame
If the frame is lost, the Data Link Layer does not recover it.
Example: Some Ethernet communication.
2. Acknowledged Connectionless Service
There is no permanent connection, but the receiver sends an acknowledgement.
Sender ── Frame ──→ Receiver
Sender ←── ACK ──── Receiver
If the frame is lost, it can be retransmitted.
3. Acknowledged Connection-Oriented Service
A connection is established before data transfer.
Connection Establishment
↓
Data Transfer
↓
Connection Release
This provides more reliable communication.
3. Framing
The Physical Layer sends a continuous stream of bits.
The Data Link Layer needs to divide this stream into manageable units called frames.
Physical Layer:
101010101010101010101010101010
↓
Data Link Layer:
┌────────┐ ┌────────┐ ┌────────┐
│ Frame1 │ │ Frame2 │ │ Frame3 │
└────────┘ └────────┘ └────────┘
Frame
A frame generally contains:
┌────────┬─────────┬─────────┬──────┐
│ Header │ Data │ Trailer │ FCS │
└────────┴─────────┴─────────┴──────┘
The header and trailer contain control information.
Why framing is required?
- Identifies beginning and end of data
- Helps error detection
- Provides addressing/control information
- Makes data transmission manageable
4. Error Control
During transmission, frames may be:
- lost
- damaged
- duplicated
- received incorrectly
The Data Link Layer uses error control to detect and sometimes recover from these problems.
Example:
Sender Receiver
Frame 1 ─────────────────────→ ✓
Frame 2 ─────────X Lost
Frame 3 ─────────────────────→ ✓
The receiver may inform the sender:
ACK → Frame received correctly
NAK → Frame has an error
The sender can retransmit the damaged/lost frame.
Techniques
Common error-control techniques include:
- Parity
- Checksum
- CRC
- Acknowledgement
- Retransmission
- Sequence numbers
CRC (Cyclic Redundancy Check) is particularly important in Data Link Layer protocols.
5. Flow Control
Flow control prevents a fast sender from overwhelming a slow receiver.
Imagine:
Fast Computer
│
│ 1000 frames/sec
↓
Slow Computer
│
│ Can process only
│ 100 frames/sec
Without flow control:
Receiver Buffer
████████████████████
↓
Overflow ❌
Therefore, the Data Link Layer controls the rate at which frames are sent.
Common techniques
- Stop-and-Wait
- Sliding Window
6. Medium Access Control
When multiple devices share the same communication medium, they need rules for deciding who can transmit and when.
This is called Medium Access Control (MAC).
Example:
Computer A ─┐
Computer B ─┼──── Shared Medium
Computer C ─┘
If A, B and C transmit at exactly the same time:
A ──┐
B ──┼──→ COLLISION
C ──┘
Therefore, MAC protocols control access to the shared medium.
Examples:
- CSMA/CD
- CSMA/CA
- Token passing
- Polling
7. Physical Addressing
The Data Link Layer can use physical/MAC addresses to identify devices on a local network.
Example:
Computer A
MAC = AA:BB:CC:11:22:33
↓
Switch
↓
Computer B
MAC = AA:BB:CC:44:55:66
A MAC address is used for communication within the local network.
Important distinction
MAC address → Data Link Layer
IP address → Network Layer
8. Reliable Delivery
The Data Link Layer may provide reliable delivery over a link by using:
- acknowledgements
- sequence numbers
- error detection
- retransmission
Example:
Sender Receiver
Frame 1 ─────────────────→
←──────────────── ACK
Frame 2 ─────────────────→
←──────────────── ACK
If Frame 2 is lost:
Frame 2 ───────X
No ACK
↓
Retransmission
↓
Frame 2 ─────────────────→
9. Data Link Layer and Physical Layer
It is important to understand the difference.
Network Layer
↓
┌───────────────┐
│ Data Link │
│ Layer │
└───────────────┘
↓
┌───────────────┐
│ Physical │
│ Layer │
└───────────────┘
↓
Transmission
Data Link Layer
Concerned with:
- Frames
- MAC addresses
- Error detection
- Flow control
- Medium access
Physical Layer
Concerned with:
- Bits
- Electrical/optical/radio signals
- Cables
- Connectors
- Voltage
- Signal transmission
10. Important Design Challenges
When designing the Data Link Layer, designers must answer questions such as:
Question 1:
How should data be divided?
→ Framing
Question 2:
What if the frame is damaged?
→ Error control
Question 3:
What if the sender is faster than receiver?
→ Flow control
Question 4:
Who can use the shared channel?
→ MAC
Question 5:
How is a device identified on the local network?
→ MAC/physical addressing
Question 6:
How can reliable delivery be provided?
→ Acknowledgement + retransmission
11. Complete Data Link Layer Picture
Network Layer
│
Packets
↓
┌─────────────────────────┐
│ DATA LINK LAYER │
│ │
│ • Framing │
│ • Error Control │
│ • Flow Control │
│ • MAC │
│ • Physical Addressing │
│ • Reliable Delivery │
└─────────────────────────┘
│
Frames
↓
┌─────────────────────────┐
│ Physical Layer │
└─────────────────────────┘
│
Bits
⭐ Exam Summary
Definition
The Data Link Layer is the second layer of the OSI model that provides reliable and efficient communication between directly connected nodes by organizing data into frames and handling errors, flow and access to the transmission medium.
Major Design Issues
| Design Issue | Purpose |
|---|---|
| Framing | Divides bit stream into frames |
| Error Control | Detects/recover from transmission errors |
| Flow Control | Prevents receiver overload |
| MAC | Controls access to shared medium |
| Physical Addressing | Identifies devices using MAC addresses |
| Reliable Delivery | Ensures frames are delivered correctly when required |
| Services to Network Layer | Provides appropriate communication service |
⭐ Easy memory trick
Data Link Layer = F-E-F-M-A
- F → Framing
- E → Error Control
- F → Flow Control
- M → Medium Access Control
- A → Addressing
One-line memory:
“Data Link Layer takes packets, makes frames, controls errors and flow, and manages access to the link.”
