Image from Pixabay
The data link layer, also known as layer 2, is the second layer within the Open System Interconnection (OSI) seven-layer reference model. In that way, it is a key part of many modern computing systems.
The layer, at its base, helps the transfer of data through units known as bits and packets. However, its uses are wider and much more complex than what they first seem on the surface.
The following sections will explore that by taking an in-depth look at layer 2 to paint a picture of how it works and what it is commonly used for.
Understanding The Open Systems Interconnection Model
The data link layer does not exist on its own. Rather, as mentioned, it is part of a much larger system. As a result, in order to fully understand how it operates, we must first take a look at the OSI model as a whole.
The Open Systems Interconnection Model is a model made up seven distinct layers that ensure every system inside it is open for communication with other systems.
Those layers are important because they visualize what’s going on in any networking system, which then helps both managers and programmers more easily find problems.
The numbers of the model typically work from top to bottom, with the functions starting at Layer 7 and going down to Layer 1.
Though all of the layers, ranging from the top application layer all the way down to the physical layer, are important, data link layer fits into the system as layer 2.
This model needs all of its pieces to work, which means the data link layer is needed to keep everything running smoothly.
Layer 2’S Basic Functionalities
The data link layer has many basic functionalities, all of which are important to a larger system.
The first is encoding and decoding electrical signals into bits. This is something we will cover a bit more in detail later on, but it is one of the main functions, which makes it worth mentioning
Beyond that, layer 2 also manages data errors from the physical layer, converts electrical signals into frames, controls how a computer gains access to data and controls both flow control and error checking. It is responsible for addressing and data framing as well.
All of those functionalities are key with both the OSI model and a larger system.
The Two Parts Of The Data Link Layer
Before we continue our discussion of what layer 2 does, it is important to note that it is split up into two different sub-layers: the Media Access Control (MAC) layer and the Logical Link Control (LLC) layer.
First, the MAC sublayer controls the way a computer on any given network can both access and gain permission to transmit data. That is important because it helps set up rules for shared mediums (such as a single network cable) to avoid any conflicts that may occur.
That works by allowing multiple devices on the same physical link to uniquely identify one another at the data link layer through the MAC addresses commonly assigned to the ports on a device.
Such sublayers are typically manually configured on ports within a network.
The Second Sublayer (LLC)
The other sublayer, LLC, complements MAC by managing flow control, frame synchronization, and error checking.
This layer refers to the functions required for the establishment and control of logical links between local devices on a network.
In that way, it enables the network layer above layer 2 to gain services, all while hiding the details of the data link layer in a way that allows different technologies to work with higher layers.
A Mess Of Bits And Packets
Every part of a computer system works with its own units, and the two that the data link layer is concerned with are bits and packets.
Bits serve as the most basic unit of information in both computing and communications, while packets are a key unit of information transport utilized by all modern computer and communication networks.
The data link layer encodes bits into packets right before the transmission process and then decodes the packets back into bits once they reach their destination.
It then provides reliable data transfer by transmitting packets with the necessary synchronization, error control, and flow control.
Here, data bits are first encoded, decoded and organized within the layer before being moved between the two adjacent points (also known as nodes) on the same WAN or LAN.
This shows why the data link layer is so important.
Though the layer has many different responsibilities, its most basic function is to transfer data between adjacent network points in a Wide Area Network or to move data between such points on the same Local Area Network (LAN) segment.
Layer 1, Layer 3, And Data Transfer
The main goal of the layer is to facilitate the local delivery of frames between nodes on the same level of the network while also enabling data-link protocols to focus on addressing, delivery, and media arbitration.
However, it does not work alone. All of the layers within OSI feed off of each other, and the data link is no exception.
The layer is directly linked to layer 1, also known as the physical layer, as well as layer 3, called the network layer.
While it works with both of the surrounding layers through service requests, it does so in different ways. It issues service requests to the layer below it and responds to service requests from the one above it.
In addition, it also helps detect and correct errors on the physical layer, while also defining that layer’s standards.
Link Layer Specifications And Protocol Characteristics
To dive even further into how the data link layer transmits data across a physical network link, we will next analyze the link-layer specifications for network and link-layer protocol characteristics that come with each physical medium.
First, there is physical addressing. This is starkly different from network addressing because, where network addresses differ between points or devices in a network, physical addressing identifies devices at the link-layer level as a way to differentiate between individual devices that exist on the same physical medium.
Beyond that, there is both network topology and frame sequencing.
Network topology specifications are important because they identify how devices are linked within a larger network. Some media connect devices with a bus topology, while others use ring topology.
Frame sequencing within the data link layer enables frames that get transmitted out of sequence to be reordered on the transmission’s receiving end. This is extremely important because it means the packet can be verified through the bits in the layer 2 header (which gets sent along with the data).
Finally, the data link layer allows for flow control. In this, it enables any receiving devices on a link to notify the upstream or downstream neighbors if any congestion is detected.
That then makes it so the system can send that information to higher layer protocols and reroute the flow of traffic to prevent any backups or slowdowns.
Data Link Error Detection
As we’ve touched on above, the data link layer also has the ability to detect and potentially recover from different transmission errors that may occur in a system.
The layer has a lot to handle. Not only does it make sure that an initial connection has been set up, but it also divides output data into frames, handles receiver acknowledgments that the data arrived as planned, and analyze bit patterns at special places within frames to sure there are no problems.
While that process is supposed to be smooth, there are several things that can go wrong at all the different points.
Should an error occur within the physical link, which includes events like loss of a clocking signal across serial connections, general signal loss, or loss of the remote endpoint on a T1 or T3 link, the layer immediately sends it up the chain to higher level protocols to make them aware something went wrong with layer 1.
Once the data link layer detects an error and sends it up the chain, frame sequencing capabilities within the layer allow the device to reorder any frames that may have been transmitted in the wrong order.
The Layer For Data Transfer
The data link layer is an integral part of the Open Systems Interconnection Model, which then makes it a key part of modern computing systems. There are many technologies, including Ethernet, that take full advantage of it. In fact, some systems fully function through layer 2.
While the layer does not operate on its own, it has many responsibilities and functions that are vital to any network. Transferring data through bits and packets is key, but that just touches on the numerous functions and responsibilities covered above.
Every single layer within the OSI model is important, but few of them have the range of responsibilities as layer 2.