This layer handles the delivery of messages between nodes on the same network. It moves data into and out of a physical link in a network.
In this layer the packets from the network layer are divided into smaller pieces, frames.
The data link layer receives packets from the network layer. Data packets contain IP addresses of the sender and receiver. There are two kinds of addressing:
- Logical Addressing - Network Layer
- Physical Addressing - Data Link Layer -
Physical addressing is done at the data link layer where the MAC addresses of the sender and receiver are assigned to each data packet which are used to form a frame. A MAC address is a 12 digit alphanumeric number that is embedded into the network interface card of your computer by the manufacturer. A data unit in the data link layer is called a frame.
The data link layer allows upper layers of the OSI model to access media by using Framing. It controls how data is placed and received from the media using techniques such as Media Access Control and Error Control. Practical example:
Suppose there are two Networks, A and B. Both, have one host connected. If the host from network A wants to connect to network B it first sends a frame to its own router. The frame is formed by adding some data to the head and tail of an IP packet. This is forwarded to the router, which decapsulates it to an IP packet. This is sent to the router of network B. This router will encapsulate it to a data frame which is then sent to the host of network B.
The data link layer also controls how data is placed and received from the media. It does this with media access control and error detection. If there are two or more devices that send data at the same time then there is a possibility of collision between the two messages. To avoid this, the data link layer performs CSMA (Carrier Sense Multiple Access). This is a media access control (MAC) protocol where a node verifies the absence of other traffic before transmitting the data.
What are the two layers of the Data Link Layer and why is it divided into two sublayers?
The two layers are LLC Layer (Logical Link Control) and MAC Layer (Media Access Control). The LLC is the upper sublayer of the data link layer and acts as an interface between the MAC sublayer and network layer. It is mainly responsible for Multiplexing, this means packets are broken into chunks. This is important to because if the packets weren’t transmitted chunk by chunk but rather into larger sizes then if the packet gets lost these will have to be send again. This is a problem because larger packets requires a larger bandwidth. The MAC layer implements the CSMA to regulate the transmission of frames.
To better understand the material it may be helpful to study exam questions. Here are some helpful resources: