The Data Link Layer is the second layer of the TCP/IP protocol. It resides above the Physical Layer and below the Network Layer. It forms an interface between the physical network medium and the higher-level protocols in the TCP/IP stack. The primary objective of the Data Link Layer is to ensure reliable and error-free communication between devices connected by a physical network link.
What is the Data Unit in the Data Link Layer called?
The data unit in the data link layer is called an Ethernet Frame.
The ‘Hop to Hop” Delivery Principle of Data Link Layer
It is important to note that the data link layer provides “Hop to Hop” Delivery of data and not “source to destination”. Before we look into the responsibilities and the sub-layers of the Data Link Layer of the TCP/IP Protocol, we should understand this “Hop to Hop” Principle:
The hop-to-hop principle emphasizes the communication between adjacent network devices rather than end-to-end communication between source and destination devices.
To understand this better, let’s take an example.
Imagine you want to send a message to your friend who is sitting rather far in a classroom. You pass it to the person sitting next to you, who then passes it to the next person, and so on. This keeps happening until the message reaches your friend.
Each person in the chain is a hop, helping to pass the message along until it reaches the intended recipient.
In computer networks, the “hop to hop” principle is similar. When you send data over a network, it travels through multiple devices like routers or switches, which act as hops. Each hop receives the data and passes it along to the next hop until it reaches its final destination.
The data link layer works at each of these “hops”. So the the responsibilities of the data link layer such as error detection and correction occur at each of these hops. This is very beneficial.
Imagine the message reaches your friend but it is full of errors. It now has to be sent back to you using the same network of friends. Wouldn’t it have been beneficial if the message was checked for errors on the way?
The hop-to-hop principle provides exactly this. It is thus, essential in ensuring efficient and reliable data transmission across a network. Each hop represents an opportunity for network devices to examine or manipulate the frame if needed. By focusing on the communication between adjacent devices, the Data Link Layer enables the effective forwarding and routing of frames from one hop to the next. This leads to successful delivery of data to the intended destination.
Sublayers of the Data Link Layer
Although TCP/IP does not strictly adhere to the traditional seven-layer OSI model, the Data Link Layer can be roughly divided into two sublayers:
Logical Link Control (LLC):
The Logical Link Control sublayer is responsible for managing communication between devices on the same network. It provides services such as error detection and flow control.
Media Access Control (MAC):
The Media Access Control sublayer is responsible for controlling access to the physical network medium. It frames the data received and ensures that these frames are delivered to the correct destination device.
Let’s take a look at some of the responsibilities of the data link layer:
1) Framing
The Data Link Layer’s primary responsibility is framing. The Data Link Layer divides the data received from the upper layer (the Network Layer) into manageable units called ethernet frames.
Framing is essential because adds essential control information in the form of frame headers and trailers.
The frame header includes information such as MAC addresses, sequence numbers, frame type, and other control bits.
The frame trailer typically contains a checksum or cyclic redundancy check (CRC) value, which helps the receiving device detect errors during transmission.
Addressing: Identifying Devices on the Local Network
Addressing plays a crucial role in the Data Link Layer as it enables devices to be uniquely identified on a local network. Media Access Control (MAC) addresses are used for this purpose. Each network interface connected to the Data Link Layer has a unique MAC address assigned by the manufacturer. MAC addresses are globally unique and consist of six bytes, providing a wide range of addressable devices.
When a frame is transmitted over a local network, the source and destination MAC addresses are included in the frame header. This allows the Data Link Layer to ensure that the frame reaches the intended recipient by matching the destination MAC address with the MAC address of the receiving device.
Access Control: Managing Communication on Shared Networks
In situations where multiple devices are connected to the same network segment, data collisions may occus. Efficient access control mechanisms are thus required to prevent data collisions.
One widely used access control mechanism is Carrier Sense Multiple Access/Collision Detection (CSMA/CD). CSMA/CD is used in Ethernet networks. In wireless networks, Carrier Sense Multiple Access/Collision Avoidance (CSMA/CA) techniques are used.
Error Detection and Correction: Ensuring Data Integrity
To ensure the integrity of transmitted data, the Data Link Layer employs error detection and correction mechanisms. Error detection techniques include checksums and cyclic redundancy checks (CRC).
Flow Control: Regulating Data Transmission
Flow control is a mechanism used in computer networks to manage the rate at which data is transmitted between devices. It ensures that the sender doesn’t overwhelm the receiver with data, preventing information from being lost or causing network congestion.
Imagine you’re pouring water from a jug into a cup. If you pour too much water too quickly, the cup might overflow, and you’ll end up wasting water. Flow control works similarly. It regulates the flow of data between devices so that the receiving device can handle it comfortably.
The Data Link Layer of the TCP/IP protocol plays a vital role in ensuring reliable and efficient communication over physical networks. It forms a critical link between the Network Layer and the physical network infrastructure. Through framing, addressing, access control, error detection and correction, flow control, and media control, the Data Link Layer facilitates the seamless transfer of data between devices.