Data Link Layer

The data link layer is the 4th layer from the top and the 2nd layer from the bottom in the OSI model. The communication channel that connects the nearby nodes is known as links, and each datagram needs to be transported via an individual link to get from source to destination.

The Data Link Layer’s primary responsibility is to transport datagrams across an individual link. The Data Link Layer protocol specifies the packet format and operations like error detection, retransmission, flow control, and random access for packets sent between nodes. Ethernet, token ring, FDDI, and PPP are Data Link Layer protocols.

Datagrams can be handled by different link layer protocols on separate connections in a path, which is an important feature of a Data Link Layer. On the first link, for example, the datagram is handled by Ethernet, whereas on the second link, PPP is used.

Functions provided by the Data Link Layer:

Framing & Link access:

Before transmission across the link, Data Link Layer protocols encapsulate each network frame in a Link layer frame. A frame is made up of a data field and a number of data fields in which a network layer datagram is put. It defines the frame’s structure as well as the channel access protocol that will be used to send the frame over the link. Layer-2 hardware addressing is provided by the data-link layer.

On the connection, the hardware address is presumed to be unique. At the moment of manufacture, it is programmed into hardware.

Reliable delivery:

The Data Link Layer provides a dependable delivery service, i.e., it reliably transmits network layer datagrams. Transmissions and acknowledgments are used to provide a reliable delivery service. A data connection layer primarily provides a dependable delivery service via links since they have greater error rates and can be repaired locally, rather than forcing the data to be retransmitted when an error occurs.

Flow control:

A receiving node is capable of receiving frames at a quicker rate than it is capable of processing them. The receiver’s buffer can overflow without flow control, causing frames to be lost. To deal with this issue, the data connection layer employs flow control to keep the sending node on one side of the link from overwhelming the receiving node on the other. The speed and capacity of stations on the same link may vary. The data-link layer provides flow control, allowing both machines to communicate data at the same time.

Error detection:

Signal loss and noise can both cause errors. One or more mistakes can be detected using the Data Link Layer protocol. This is accomplished by including error detection bits in the frame, which are subsequently checked by the receiving node.

Error correction:

Error correction is identical to error detection, with the exception that the receiving node not only detects but also determines where the faults occurred in the frame.

Half-Duplex & Full-Duplex:

Both nodes can broadcast data at the same time in Full-Duplex mode.
Only one node can send data at the same time in Half-Duplex mode.

Multi-Access

When a host on a shared link tries to send data, there’s a good chance they’ll collide. The data-link layer provides mechanisms such as CSMA/CD that enable many systems to access shared media.