Data Link Layer
Data link layer is the layer No 6 from sender and layer No 2 of receiving side in the OSI model. This layer is little bit complex and complicated as compare to other layers. It provides host to host delivery.
At Sender Side, Data link layer receives packets/datagram from network layer and convert these packets/datagrams to frames and transmit these frames to physical layer.
At Receiver Side, Data link layer receives bits from physical layer and convert these bits to frames and transmit these frames to network layer.
Functionality of Data-link Layer
1. Framing of Data
Data link layer received data from network layer in the form of Packets/datagram and converts it into Frames by adding Header and Trailer it and send it towards Physical layer.
2. Node to Node Connection
To reach the data at destination it first pass through different intermediate nodes (i.e. Routers) which is done through data link layer. The following figure shows the detail,
Note: Node is also known as hop.
3. Flow Control
Sometimes one node has higher speed and capacity then other nodes. Then sending speed may be higher than receiver node. So, flow control comes into picture.
Thus, data link layer control the flow of data node to node. But Transport layer deals with source to destination flow control.
It uses the Stop and wait and Sliding window protocols to control the flow of data.
4. Error Control
Sometimes error may occur when we send the data Due to following reasons
- Software failure (due to bugs in the code)
- Background radiation,
- Head crashes
Then data-link layer control these errors at each node.
Ways of Doing Error Control
There are basically two ways of doing Error control as given below:
I. Error Detection
Error detection means identification of errors. There are different ways to identify the errors at each node in data link layer listed under,
II. Error Correction:
Error correction means fixing the errors. Our basic need is data should be error free. Error correction method is very costly and hard as well.
Best error correction techniques at each node of data link layer is Hamming Code
Note: Transport layer also control the error but deals with only two ends host and destination.
5. Medium / Multiple Access Control (MAC)
When a node on the shared link tries to transfer the data, it has a probability of collision.
For example when multiple nodes in Bus topology try to send data at a time then collision may happen.
So, Data-link layer use the following protocols to eliminate collision.
5. Physical Address
It provides the MAC address to each node so that it can communicate with in the same network. If we want to communicate with other network then we have to use IP address.
By using only data link layer communication can be done easily without using of network layer.
Sub Layers of Data Link Layer
Data link layer holds two sub-layers
1. Logical link control (LLC)
Logical Link Control deals with flow control from host to host.
2. Medium Access Control (MAC)
Medium Access Control deals with the following tasks
- Physical Addressing
- Error Control
- Access Control