21 Jan 2013
1/21/2013 by Dan Popescu
In this post I will describe the role and functionality of the Data Link layer of the OSI model:
When a packet is sent from the Network layer for further processing, it first arrives at the Data Link layer then it is sent to the Physical Layer. This layer is responsible for managing transmission of packets and access to the physical media (optical fiber, cooper wires, microwaves etc.) When talking about Data Link layer, you'll have to get familiar with some terms:
The Data Link layer PDU is called a frame
The medium is represented by the physical environment in which a packet is transmitted
A Node is a device connected to a network. It can be either a router,a switch,a host, etc.
Data link layer is responsible for frame delivery on network segment. A network segment is represented by a physical connection between two devices. A frame can travel through different physical media from source to destination, it can go through a wireless connection on one network segment or trough a optical fiber channel on another segment. On every hop, a network device such as a router accepts a frame, decapsulates the packet, reads the information and than sends the packet encapsulated in a different frame for a different network segment. Data Link layer protocols describe how access to the medium can be made (encapsulation into a frame) and how a packet can be transmitted.
A frame consists of three parts:
header - the first part of the frame, it contains information such as the Frame Start indicator, Addressing, Type and Control information.
data - this is the actual packet sent by the Network Layer
trailer - the end of a frame, contains the Error Detection and Frame Stop indicator
The Data Link layer is the demarcation point between the hardware and software components, is the place where data implemented in software is interpreted by the hardware devices and sent onto the medium. On a computer, the functionality of the data link layer is implemented into the Network Interface Card (NIC).
As written on Wikipedia (http://en.wikipedia.org/wiki/Data_link_layer), the Data Link layer has two subdivisions: the LLC (Logical Link Control) and the MAC (Media Access Control).
The protocols at the Layer2 of the OSI model, specify how can the medium be accessed. Imagine what would happen if there were no rules and every device could sent frames onto the medium at any moment. Collisions can occur when multiple devices transmit at the same time, that's why some media access methods were invented:
Controlled access - when using this method, each device takes turn in using the medium. When one device transmits data, no other node can transmit in the same time. Devices must wait for their turn in order to transmit information, so no collisions can occur. An example of controlled access (also called deterministic) is token ring. This method adds overhead because each node can transmit one after the other.
Contention-based - nodes can try to send information at any time. Before a node wants to transmit data, it has to detect if the medium is carrying data or not. To do this it uses the CSMA (Carrier Sense Multiple Access) method. When using this method, a node first listens to detect a carrier signal. If a signal is detected then it means that another node is already transmitting, if the signal is not detected than the node can send data. This method eliminates the overhead excess but collisions can occur. Collisions occur when multiple nodes try to transmit at the same time. There are two types of CSMA:
CSMA/CD or Collision Detection and CSMA/CA or Collision Avoidance.
I've told you earlier that Data Link layer is responsible for end-to-end delivery between a source and a destination. In this context we have to talk about two things, the logical topology and the physical topology. A logical topology is a virtual circuit between source and destination, it does not consider devices between this two points. The physical topology is made from the actual connections and devices trough which information is sent from source to destination. Usually, those two are not the same. Read more about physical and logical topology on Wikipedia: http://en.wikipedia.org/wiki/Logical_topology , http://en.wikipedia.org/wiki/Network_topology:
A well known topology is the point-to-point topology, it can be either physical point-to-point or logical point-to-point topology. In this kind of network, data is transmitted between two devices. The connection can be either full duplex or half duplex. In a full duplex connection both devices can send and receive data at the same time. In a half duplex connection devices can either send or receive data.
Data Link layer is also responsible for error detection. This is made by using a FCS or Frame Check Sequence field. The source calculates a Cyclic Redundancy Check (CRC http://en.wikipedia.org/wiki/Cyclic_redundancy_check) and then it sends the frame onto the medium. When the frame arrives at destination, another CRC is made by the receiving host. It then compares these two hashes and if they are the same than it means that the whole frame has been transmitted.
There are many Data Link Layer Protocols but among the well known are:
Point-to-Point protocol (PPP)
OK, folks that's it for this post. I hope you will enjoy it, have a nice day.