OSI Layer 2: Data Link Layer, A Comprehensive Guide

Layer 2 of OSI model is called Data link layer. It performs a set of actions to exchange information from one computer to other. The data link layer works on the local network. Internetwork services are provided by higher layers like IP on layer3. The main functions of data link layer are as follows:

  • Acts as a connection between layer1 and higher layers
  • Group the stream of bits and bytes received from physical layer and encapsulates it in a ‘frame’ and vice versa
  • Determination of physical topology.
  • Determination of data link layer address
  • Link detection and collision avoidance mechanism like CSMA/CD
  • Error detection and error correction

A frame is an envelope carrying bits and bytes received from Physical layer. It is layer 2 datagram unit.

Data link layer acts as an interface between physical layer and upper layers. When a network entity is receiving a packet, data link layer receives information from physical layer packages it into a frame and delivers it to upper layers like IP. On the other hand if Network Entity is transmitting the packet, it will open the frame and will turn frame information into bits and bytes and will provide it to Physical layer to transmit.

It determines the local physical topology, it is responsible for transferring the data to adjacent network node(WAN or LAN). It is responsible for deriving the data link layer address ( not only the mac address ) from higher layer information like IP. IP is responsible to deliver a packet up to one network but in that network data has to transferred using local data link layer address.

Data link layer is also responsible for link detection for its idleness and providing a mechanism to avoid collision like CSMA/CD.

I know most of you wont agree with the point that error correction happens on data link layer. Usually it doesn’t happen at data link layer and transport layer takes care of it. But in some cases Data link layer also does error correction like in case of SNA (System Network Architecture). SNA provides a mechanism for data correction at data link layer.

Most of the people has an assumption that data link layer is always divided into 2 sublayer. But its not true. Data link layer function as one. But different data link layer protocols has different explanation of its working like Ethernet explains it deeply into 2 sublayer: LLC(Logical  Link Control) and MAC(Media Access Control). ATM divides it into 2 different sublayer ATM adaption Layer and ATM layer. In the ITU-T G.hn standard, which provides a way to create a high-speed (up to 1 Gigabit/s) Local area network using existing home wiring (power lines, phone lines and coaxial cables), the Data Link Layer is divided into three sub-layers (Application Protocol Convergence, Logical Link Control and Medium Access Control).