The data link layer(Layer 2) of the OSI model is the protocol layer that handles the moving of data in and out across a physical link in a network. This layer is responsible for the following:-
The data link layer is responsible for encoding bits into packets prior to transmission and then decoding the packets back into bits at the destination.
Allowing the upper layers to access the media
Responsible for logical link control, media access control, hardware addressing,
Handling and defining physical layer standards.
Preparing network data for the physical network
Controlling how data is placed and received on the media
Exchanging frames between nodes over a physical network media, such as UTP or fiber-optic
Receiving and directing packets to an upper layer protocol
Performing error detection
The Layer 2 notation for network devices connected to a common media is called a node. Nodes build and forward frames. The OSI data link layer is responsible for the exchange of Ethernet frames between source and destination nodes over a physical network media.
The data link layer effectively separates the media transitions that occur as the packet is forwarded from the communication processes of the higher layers. The data link layer receives packets from and directs packets to an upper layer protocol, in this case, IPv4 or IPv6. This upper layer protocol does not need to be aware of which media the communication will use.
Data Link Sub-Layers
As we know that data link layer(Layer 2) of the OSI model is the protocol layer as well as handles moving data in and out across a physical link in a network.The data link layer is theoretically divided into two sublayers. which is logical link control (LLC) and media access control (MAC) layers. This division is based on the architecture used in the IEEE 802 Project; which is the IEEE working group responsible for creating the values that describe many networking technologies.
- Logical Link Control (LLC)
- Media Access Control (MAC)
Logical Link Control (LLC)
This upper sublayer is called Logical Link Control(LLC) which is communicates with the network layer. It places information in the frame that identifies which network layer protocol is being used for the frame. This information allows multiple Layer 3 protocols; such as IPv4 and IPv6, to utilize the same network interface and media. it provides services to the network layer above it and hides the rest of the details of the data link layer to allow different technologies to work seamlessly with the higher layers. Most local area networking technologies use the IEEE 802.2 LLC protocol.
Media Access Control (MAC)
This lower sublayer defines the media access processes performed by the hardware. It also provides data link layer addressing and access to various network technologies.
The figure 3.17 illustrates how the data link layer is divided into the LLC and MAC sublayers. The LLC communicates with the network layer while the MAC sublayer allows various network access technologies. For instance, the MAC sublayer communicates with Ethernet LAN technology to send and receive frames over copper or fiber-optic cable. The MAC sublayer also communicates with wireless technologies such as Wi-Fi and Bluetooth to send and receive frames wirelessly.