Definition

data link layer

What is the data link layer?

The data link layer is the protocol layer in a program that handles how data moves in and out of a physical link in a network. The data link layer is Layer 2 in the Open Systems Interconnection (OSI) architecture model for a set of telecommunication protocols.

The data link layer encodes, decodes and organizes data bits in the data link layer before it transports the data bits as frames between two adjacent nodes on the same local area network (LAN) or wide area network. The data link layer also determines how devices recover from collisions that might occur when nodes attempt to send frames at the same time.

The data link layer has two sublayers: the logical link control (LLC) sublayer and the media access control (MAC) sublayer.

The IEEE 802 LAN specification dictates the LLC sublayer controls data flow among various applications and services, as well as provides acknowledgement and error notification mechanisms. The LLC sublayer can then talk to a number of IEEE 802 MAC sublayers, which control access to the physical media for transport. It is also responsible for the physical addressing of frames.

Two common MAC layer types are Ethernet and 802.11 wireless specifications.

Diagram that shows the location of the data link layer in the OSI model
The data link layer in the OSI model

Functions of the data link layer

The data link layer has three main functions:

  1. It handles problems that occur as a result of bit transmission errors.
  2. It ensures data flows at a pace that doesn't overwhelm devices that send and receive data.
  3. It permits the transmission of data to Layer 3, the network layer, where it is addressed and routed.

Data link layer and error detection

The data link layer ensures an initial connection has been set up, divides output data into data frames and handles the acknowledgements from a receiver that confirms if data has successfully arrived. It also analyzes bit patterns at special places in the frames, which ensures incoming data has been successfully received.

Diagram that shows how the data link layer detects single-bit errors
How the data link layer detects a single-bit error

If an error occurs, the data link layer notifies higher-level protocols that something has happened to the physical link. Frame sequencing capabilities within the data link layer permit the receiving device to reorder frames that might have been transmitted out of sequence. The data link layer verifies the packet isn't impaired.

The data link layer also manages flows because it can enable devices on a link to detect congestion. Nearby devices then transmit congestion information, so traffic can accordingly reroute on the network.

Editor's note: This article was reformatted to improve the reader experience.

This was last updated in November 2023

Continue Reading About data link layer

Dig Deeper on Network infrastructure