What does the OSI data link layer do?
The data link layer (Data Link Layer) ensures reliable transmission of frames between devices within one local network (LAN) and controls access to the physical medium.
Short formulation for an interview:
The data link layer is responsible for forming Ethernet frames, working with MAC addresses, error control, and transmitting data between two devices in the same network segment.
Main functions of the data link layer (L2)
1. Forming frames
The data link layer defines the frame structure:
- source MAC address
- destination MAC address
- EtherType/Length
- Payload (L3 data)
- FCS (frame check sequence)
2. MAC addressing
MAC addresses operate at layer 2, and they:
- uniquely identify a network interface
- are used to deliver frames
- define the format: unicast, multicast, broadcast
3. Delivering data within a single segment
The Data Link Layer guarantees that a frame gets from device A to device B within one LAN.
Routers are not involved here, they operate at layer 3.
4. Controlling access to the transmission medium
Access methods:
- CSMA/CD (Ethernet, when hubs were used)
- CSMA/CA (Wi-Fi, collision avoidance)
- Token Ring (historically)
5. Error detection
An FCS (CRC) sits at the end of the frame. If the CRC does not match, the frame is dropped.
Important: the data link layer does not correct, it only detects.
6. Flow control and synchronization
Some L2 protocols manage data flow (for example, PPP, HDLC).
7. VLAN support
VLAN (802.1Q) is an L2 technology that adds a 4-byte tag to an Ethernet frame.
Two sublayers of the data link layer
The Data Link Layer consists of two parts:
1. LLC (Logical Link Control)
- connection management
- interaction with layer 3
- protocol multiplexing
2. MAC (Media Access Control)
- MAC addresses
- sending/receiving frames
- access to the transmission medium
- collision detection
Data link layer protocols
- Ethernet (802.3)
- Wi-Fi (802.11)
- PPP, HDLC
- Frame Relay (historically)
- VLAN 802.1Q
- STP/RSTP/MSTP (802.1D/S): loop prevention
What L2 does NOT do
To avoid confusion:
The data link layer does not do:
- IP routing
- working with IP addresses
- splitting into packets
- inter-network delivery ("to another subnet")
That is the job of layer 3 (network).
Short Answer
Interview readyA concise answer to help you respond confidently on this topic during an interview.