By Stanislav Taran

OSI: Data Link Layer - Layer 2 (Part 7)


Definition

The Data Link layer provides the mechanism by which data is transferred from node to node in across a network.

The term “Data Link Layer” in the OSI model refers to its role in establishing a direct link for data transfer between network devices on the same network segment.

The Data Link layer is divided into two sublayers:

  1. Logical Link Control (LLC): responsible for error checking and flow control. This sublayer acts as an intermediary between the Network Layer and the Media Access Control (MAC) sublayer within the Data Link Layer of the OSI model. Here are its key functions:

    • Multiplexing: LLC enables multiple network protocols (like IP, IPX) to coexist on a single network connection. It essentially takes data from various protocols and packages it efficiently for transmission over the MAC layer.

      In your home network, multiplexing also happens to share your internet connection with all your devices. Here’s how it works: you likely have a single internet connection coming into your house, maybe through a cable or phone line. This is like a single highway. You might have a computer for work video calls, a phone for browsing social media, and a gaming console for online games. These are like different types of cars with different needs (high bandwidth for video calls, moderate for browsing, and bursty for gaming). The router in your network acts like the multiplexing device (LLC). It receives data packets from all your devices. Each packet has a destination address specifying which device it’s intended for. The router uses the destination address (often part of the MAC address) to figure out which “lane” the data belongs to (based on the protocol used, like IP for internet traffic). It’s like assigning each car type (work, social media, gaming) to a designated lane on the highway.

    So, multiplexing allows all your devices to share the same internet connection efficiently without interfering with each other. There are different types of multiplexing techniques, like time-division multiplexing (TDM) and frequency-division multiplexing (FDM) and even more. It’s quite complex topic, you can dive deeper into it if you’re interested.

    • Adding Protocol Information: LLC encapsulates the data from the network layer by adding a header containing information about the specific network protocol being used. This helps the receiving device interpret the data correctly.
    • Error Checking (Optional): While not always implemented, LLC can perform basic error checking on the data using techniques like CRC (Cyclic Redundancy Check) before passing it down to the MAC sublayer. This helps ensure data integrity.
  2. Media Access Control (MAC): responsible for controlling how devices on the network access the network media.

Here is a brief overview of where LLC and MAC sublayers fit in the OSI model:

  1. Data Originates: Data is created by an application on one of your devices (computer, phone, console).
  2. Higher-Level Protocol Packaging: The application data is wrapped in a protocol header specific to the higher-level protocol it uses (e.g., TCP for reliable data transfer).
  3. LLC Takes Over: The data reaches the Logical Link Control (LLC) sublayer within the data link layer of the device’s network interface card (NIC).
  4. Multiplexing and Encapsulation: LLC performs multiplexing by examining the higher-level protocol information and assigning the data to a specific “lane” based on the protocol used. It then adds a header containing information about the chosen protocol to the data packet.
  5. Passing to MAC: Once LLC has finished its work, it hands the encapsulated data packet to the Media Access Control (MAC) sublayer.
  6. MAC Adds Hardware Address: The MAC sublayer adds the device’s unique MAC address as the source address to the data packet. This identifies the device that originated the data on the local network segment.
  7. Preparing for Transmission: The MAC sublayer might also add error checking information and format the data packet for the specific physical medium it will travel on (Ethernet cable or Wi-Fi signal).
  8. Onto the Physical Medium: Finally, the MAC sublayer transmits the data packet onto the physical network connection using the appropriate protocol for that medium.

The data link layer, with its LLC and MAC sublayers, bridges the gap between network protocols and the physical network media. It ensures reliable and controlled data exchange between devices on the same network segment.

Responsibilities

The Data Link layer has several key responsibilities:

  • Frame Creation and Encapsulation: The Data Link layer encapsulates data from the Network layer into frames for transmission across the network.

    Let’s take a look again at schema of what packet headers are being added at each layer:

    Packet headers

    Frame is a unit of data that is transmitted between devices on a network. It contains the following components:

    • Header: Contains control information, including source and destination MAC addresses.
    • Data: The actual payload or data being transmitted.
    • Trailer: Contains error detection information, such as a checksum, to ensure data integrity.

    Different data link layer protocols have their own specific frame formats, defining the structure of headers, trailers, and the types of information they contain. We will explore some of these protocols in the next section.

  • Media Access Control (MAC): The Data Link layer is responsible for controlling how devices on the network access the network media. It uses the MAC sublayer to manage access to the physical network media, such as Ethernet cables or wireless signals. The MAC sublayer assigns unique MAC addresses to devices on the network, allowing them to communicate with each other.

    MAC addresses are hardware addresses that are assigned to network interface cards (NICs) and are used to identify devices on the network. They are typically represented as a series of hexadecimal digits, such as 00:1A:2B:3C:4D:5E.

    In most cases, the MAC address is burnt into the device’s hardware, like the Network Interface Card (NIC) for wired connections or the Wi-Fi module for wireless connections. This permanent MAC address is assigned during manufacturing and serves as a unique identifier for the device throughout its lifetime.

    MAC address consists of two parts:

    • Organizationally Unique Identifier (OUI): The first 24 bits of the MAC address, which identify the manufacturer or vendor of the device. Some well-known OUIs are assigned by the IEEE to specific manufacturers, while others are assigned by the manufacturer itself. The OUIs for some well-known manufacturers are:

      • Dell: 00-14-22

      • Nortel: 00-04-DC

      • Cisco: 00-40-96

      It’s common for the larger manufacturers of networking equipment to have more than one set of OUIs.

    • Device Identifier: The remaining 24 bits of the MAC address, which uniquely identify the device within the manufacturer’s range. This part of the MAC address is assigned by the manufacturer and is unique to each device.

      MAC address

    When a device wants to send data to another device on the network, it uses the destination MAC address to address the frame and send it to the correct device.

    Keep in mind that MAC addresses are used for communication within the same network segment. For communication between different network segments, IP addresses are used.

  • Error Detection and Correction: The Data Link layer is responsible for detecting and correcting errors that may occur during data transmission. It uses error detection techniques, such as checksums or cyclic redundancy checks (CRC), to verify the integrity of data as it is transmitted across the network. If an error is detected, the Data Link layer can request retransmission of the data to ensure its accuracy.

    Error detection and correction mechanisms are essential for ensuring data integrity and reliability in network communication.

  • Flow Control: The Data Link layer manages the flow of data between devices on the network to prevent congestion and ensure efficient data transmission. It uses flow control mechanisms to regulate the rate at which data is transmitted and received, preventing data loss or buffer overflow. Flow control helps devices on the network communicate effectively and avoid data loss due to network congestion.

  • Addressing and Identification: The Data Link layer uses unique MAC addresses to devices on the network to identify them and facilitate communication. MAC addresses are used to address frames and ensure that data is delivered to the correct device.

Protocols

The Data Link layer is associated with several protocols that define how data is transmitted across the network. Two of the most common protocols at the Data Link layer are:

  • Ethernet (IEEE 802.3): Ethernet is a widely used LAN technology that operates at the Data Link layer. It defines the frame format, addressing, and media access control methods for devices on the network. Ethernet frames typically contain source and destination MAC addresses, a type field, and a data payload.

    Ethernet is the most common LAN technology used today, providing a cost-effective and efficient way to connect devices within a local network.

    Ethernet frames structure:

    Ethernet frame
  • Wi-Fi (IEEE 802.11): Wi-Fi is a wireless LAN technology that operates at the Data Link layer. It defines how devices communicate over wireless networks, including frame formats, addressing, and media access control methods. Wi-Fi frames are similar to Ethernet frames but include additional information for wireless communication, such as signal strength and channel information.

    Wi-Fi is widely used for wireless networking in homes, businesses, and public spaces, providing convenient and flexible connectivity for devices.

    Although there are similarities, the addressing used by 802.11 MAC frames is much more complex than Ethernet frames. 802.3 frames have only a source address (SA) and destination address (DA) in the layer 2 header.

    Ethernet addresses

    The four MAC addresses used by an 802.11 frame can be used as five different types of addresses:

    • receiver address (RA)
    • transmitter address (TA)
    • basic service set identifier (BSSID)
    • destination address (DA)
    • and source address (SA)
    Wi-Fi addresses

    There are many variants how these addresses can be used in different frame types. But we will not dive deep into this in this post.

There are many other protocols and technologies associated with the Data Link layer, each with its own specific functions and applications. Let’s just mention some of them:

  • Point-to-Point Protocol (PPP): used for establishing a direct connection between two devices over a serial link.
  • High-Level Data Link Control (HDLC): a synchronous data link layer protocol used for communication between devices.
  • Address Resolution Protocol (ARP): used to map IP addresses to MAC addresses on a local network.

IEEE stands for Institute of Electrical and Electronics Engineers. The main AIM of IEEE is to foster technological innovation and excellence for the benefit of humanity. The IEEE standards in computer networks ensure communication between various devices; it also helps to make sure that the network service, i.e., the Internet and its related technologies, must follow a set of guidelines and practices so that all the networking devices can communicate and work smoothly. Since there are various types of computer system manufacturers, the IEEE’s Computer Society started a project in 1985 called project 802 to enable standard communication between various devices.

Devices

The Data Link layer is implemented in various network devices that operate at this layer.

  • Bridges (Less Common Now): Bridges are devices that connect two or more network segments and forward data between them. They operate at the Data Link layer and use MAC addresses to filter and forward frames between different network segments. Bridges help to reduce network congestion and improve performance by segmenting the network into smaller collision domains.

    Network bridge
  • Switches: Switches are devices that connect multiple devices on a network and forward data between them. They operate at the Data Link layer and use MAC addresses to forward frames to the correct destination device. Switches are more advanced than bridges and offer higher performance and more features, such as VLAN support and port mirroring.

    Network switch
  • Network Interface Cards (NICs): Network Interface Cards are hardware devices that connect computers and other devices to a network. They operate at the Data Link layer and use MAC addresses to communicate with other devices on the network. NICs are installed in computers, servers, and other network devices to enable network connectivity.

    Network Interface Card (NIC)
  • Ethernet Hubs: Ethernet hubs are devices that connect multiple devices on a network and forward data between them. They operate at the Data Link layer and use MAC addresses to forward frames to all devices on the network. Hubs are simple devices that broadcast data to all connected devices, which can lead to network congestion and reduced performance.

    Similar to bridges, Ethernet hubs are considered outdated technology. They simply broadcast all data frames to all connected devices, leading to inefficient network operation. Switches are the preferred choice for modern networks due to their ability to learn MAC addresses and forward frames only to the intended recipient.

    Ethernet hub
  • Wireless Access Points (WAPs): Wireless Access Points are devices that connect wireless devices to a wired network. They operate at the Data Link layer and use Wi-Fi technology to provide wireless connectivity to devices. WAPs use MAC addresses to communicate with wireless devices and forward data between them and the wired network.

    Usually WAPs are integrated with switches or routers to provide wireless connectivity to devices on the network.

    Wireless Access Point (WAP)

Conclusion

The Data Link layer of the OSI model plays a crucial role in organizing data for transmission across the network.

By encapsulating data into frames, managing media access, and controlling data flow, the Data Link layer ensures reliable and efficient communication between devices on the same network segment.

MAC addresses are used to identify devices within a local network. They are assigned to network interface cards (NICs) and are used to address frames and facilitate communication between devices.

This layer is home to protocols like Ethernet and Wi-Fi, which define how data is transmitted over wired and wireless networks.

Devices like bridges, switches, NICs, and hubs operate at the Data Link layer to facilitate communication between devices on the network.

That’s it for the Data Link layer! In the next post, we’ll explore the Physical layer of the OSI model.