What tasks does the data link layer solve?
The data link layer (L2) solves tasks related to reliable data transfer between neighboring devices on the same network. It sits between the physical and network layers and "puts the bit stream in order."
Simply put: the data link layer is responsible for making sure data inside the local network arrives correctly and at the right address.
Main tasks of the data link layer
1. Framing
- accepts the bit stream from the physical layer
- packages the data into frames
- adds service information (header and trailer)
A frame is the basic unit of transmission at L2.
2. MAC addressing
- uses the MAC addresses of the source and destination
- determines exactly which device in the local network the data is meant for
IP addresses are not used here, that is a layer above.
3. Error control
- adds a checksum (FCS)
- on receipt, checks:
- whether the frame is damaged
The data link layer detects errors, but usually does not correct them.
4. Media access control
Answers the question:
who can transmit data, and when
Especially important:
- in wireless networks (Wi-Fi)
- in shared transmission media
5. Splitting the data stream
- determines the start and end of a frame
- keeps frames from "sticking together"
This is needed so the receiver understands:
where one frame ended and the next one began
6. Interaction with the physical and network layers
- receives bits from the physical layer
- passes data (frames) to the network layer
- and vice versa
Where the data link layer operates
- within a single local area network (LAN)
- between directly connected devices
- up to the first router
Short answer for an interview
The data link layer handles framing, MAC addressing, error control, and media access control, delivering data between devices on the same network.
Short Answer
Interview readyA concise answer to help you respond confidently on this topic during an interview.