A Guide to the Data Link Layer | OSI Model Layer 2

One of the most important layers in the Open Systems Interconnect (OSI) model is layer 2 - the data link layer. The data link layer ensures correct data transfer across a system, using various protocols and functions to achieve a successful end result. In this article, learn what the data link layer is, its several key functions, and how layer 2 of the OSI model contributes to the model as a whole.

The data link layer is the second layer in the OSI model. Arguably the most complex layer in the OSI model, the data link layer, or OSI model layer 2, handles many of the functions necessary for computer networking.

The layer’s main goal is to transmit data between adjacent nodes or hosts that are directly linked. It’s also concerned with error detection. It corrects the errors, aiming to deliver the right message or packets of information to the correct destination.

With the data link layer, upper layers in the OSI model can access the media using techniques such as framing. The layer uses Media Access Control (MAC) to control how data is placed and received from the media.

Therefore, layer 2 essentially serves as the communication medium for the upper layers. Two sublayers make up this layer: the Logical Link Control (LLC) sublayer and the Media Access Control (MAC) sublayer.

As established by the Institute of Electrical and Electronics Engineers IEEE 802, the role of logical link control is to provide logic for the data link. It’s therefore accountable for frame synchronization, flow control, and error control in a network.

The LLC sublayer handles both connection-oriented and connectionless transmissions, unlike the MAC sublayer below it. Link addressing and sequencing also occur at the LLC sublayer.

A visual breakdown of the location of the data link layer in the OSI model

Media Access Control sublayer

The second sublayer, Media Access Control, deals with the physical addressing of frames. It encapsulates frames to prepare them for transmission, resolves situations that require more than one data frame transmission, and fixes collisions if they should occur.  Two good examples of the MAC layer include 802.11 wireless specifications and Ethernet.

The data link layer confirms that the data bits received and the data bits being transmitted are similar. When this layer receives bits from the physical layer, it checks for transmission errors and ensures the bits are error-free. Then, it organizes them into data frames.

From there, layer 2 ensures that these frames transmit to the correct destination device. The data bits are also encoded and decoded before they are then transported as frames between network nodes in the same LAN (local area network) or WAN (wide area network).

Data frames are supposed to be transmitted at the same time. However, nodes can attempt to send frames at varying speeds. If this happens, the layer specifies how the devices recover from such incidents by providing prevention mechanisms.

This layer only performs error detection, not error correction. Checksum, Cyclic Redundancy Check (CRC), and Parity Check are the most efficient methods of error checking in layer 2. Once these methods detect errors, the transport layer – layer 4 – must then take on the responsibility of error correction in most cases.

The data link layer focuses on and deals with data frames, and its biggest responsibility is to move data frames from one node to the other. However, there are several functions of this responsibility that the data link layer must also perform.


The layer takes data packets from the network layer – layer 3 – and converts them into frames, which is the term for streams of data bits. In order for each data unit to be distinguishable from each other, the packets must be converted. The data link layer specifies the frame’s structure and the channel access protocol by which frames transmit over the link. Then, it then helps move those frames to their final destination.

Reliable delivery

The OSI model layer 2 ensures reliable delivery over links by transmitting datagrams or frames without errors. If there are transmission errors, layer 2 identifies them and acts accordingly.

Physical addressing

Another well-known function of the data link layer is physical addressing. The layer adds a header to each frame that identifies the MAC addresses of the sender and receiver. This helps keep track of frames distributed to different systems on the network.

Flow control

Data frames go from one device to another over a transmission media at this layer. Sometimes, the receiving device may receive frames more quickly than it can process them, resulting in frame loss.

When devices attempt to use a medium simultaneously, frame collisions occur. Initially, the devices are supposed to transmit on the shared media at the same pace. Any collisions with each other’s transmission renders both useless.

Consider an example with two devices: Device A and Device B. Device A sends packets quickly, but Device B is a slow receiver. If A sends 50 packets at a time but B can only accept 20 at once, the sending device would overwhelm the receiving machine. It results only in lost packets and congestion issues.

Using flow control, the two machines will transmit data sequentially and their transmission will remain uncorrupted. The process coordinates the amount of data sent, as well as the method of sending, over the Internet.

Error control

Data bits can get damaged or corrupted when traveling over a computer network due to difficulties such as network problems and network interferences. Layer 2 recognizes - and sometimes corrects - errors, including single bit errors and multiple-bit errors. Additionally, the data link layer determines where faults in the physical layer may occur.

Multi-access and access control

The data link layer addresses issues of data frame collision, as mentioned above. Therefore, one of its functions determines which devices have control when two or more devices share the same link.

Like all layers in the OSI model, there are several protocols that operate at the data link layer. They help ensure that bits depart and arrive correctly across networks. The most common protocols include:

  • Synchronous Data Link Control (SDLC), which deals with error correction, error recovery, and multipoint link support
  • High-Level Data Link Control (HDLC), which supports point-to-point communication
  • Serial Line Interface Protocol (SLIP), which handles the transfer of IP packets
  • Point-to-Point Protocol (PPP), which transports IP packets
  • Link Control Protocol (LCP), which establishes, configures, tests, maintains, and terminates links when transmitting data frames
  • Link Access Procedure (LAP), which frames and transfers data across links

Frequently asked questions

What are frames?

Frames are streams of data bits. The data link layer splits these frames into manageable data units.

There are two data link layer sublayers: Media Access Control (MAC) and Logical Link Control (LLC).

The purpose of the data link layer is to transfer data between network systems, detecting errors that might have occurred in the physical layer during transmission.

What are the other layers of the OSI model?

There are seven total layers in the OSI model. Besides the data link layer, which is the second layer, the layers are as follows: the physical layer, the network layer, the transport layer, the session layer, the presentation layer, and the application layer.