Data Link Layer

Ka Kavitha V Updated 08 Oct 2026
9 min read ·Lesson 20 of 45

Data Link Layer

Before data reaches its destination on a network, it passes through several layers of processing. The Data Link Layer is the layer responsible for moving data reliably between two devices that share the same physical link — for example, your laptop and the Wi-Fi router next to it, or two switches connected by a cable.

Whether you're browsing a website, sending an email, streaming a video, or printing a document over a shared network, the Data Link Layer is working in the background to make sure the bits sent by one device actually arrive at the next device correctly and in order.

The Data Link Layer is the second layer (Layer 2) of the OSI (Open Systems Interconnection) model. It sits between:

  • The Network Layer (Layer 3) above it, which is concerned with getting data from a source to a destination across multiple networks (routing).
  • The Physical Layer (Layer 1) below it, which is concerned with actually pushing raw bits onto a wire, fiber, or radio signal.

The Data Link Layer's job is narrower than the Network Layer's: it only handles the hop-by-hop transfer of data between two directly connected devices on the same physical link — not the entire end-to-end journey across the internet. A router forwarding a packet across five networks relies on five separate Data Link Layer "hops" to get it there, one link at a time.

Think of shipping a package with a courier service:

  • The Network Layer decides the overall route the package should take across cities.
  • The Physical Layer is the literal road the delivery truck drives on.
  • The Data Link Layer is the courier who properly packs the item, labels it, checks it isn't damaged, and hands it to the correct house on a specific street.

Without a Data Link Layer, several problems would occur on every network:

  • Data could arrive corrupted, with no way to detect it.
  • Frames could arrive out of order or get lost with no mechanism to notice.
  • Two devices could transmit onto a shared medium at the same time and collide.
  • A fast sender could overwhelm a slow receiver's buffer.

The Data Link Layer exists specifically to solve these local, link-level problems so that the layers above it can assume the link is reasonably trustworthy.

Frames: The Basic Unit of Layer 2

The Network Layer hands the Data Link Layer a packet. The Data Link Layer wraps that packet with additional control information to create a frame — the fundamental unit of data at Layer 2.

A typical frame has three parts:

PartContainsPurpose
HeaderSource MAC address, destination MAC address, control informationIdentifies who sent the frame and who it's for
PayloadThe actual packet from the Network LayerThe data being delivered
TrailerError-detection information (commonly a CRC value)Lets the receiver check whether the frame arrived intact

The process of wrapping a packet with a header and trailer to produce a frame is called framing, and it is the first of several services the Data Link Layer provides.

The IEEE splits the Data Link Layer into two sublayers, each with a distinct responsibility:

The LLC sublayer sits closer to the Network Layer and handles:

  • Error notification
  • Flow control
  • Acknowledgments
  • Link management

Because LLC is independent of the underlying hardware, it allows several different network-layer protocols to share the same physical medium without conflict.

2. Media Access Control (MAC)

The MAC sublayer sits closer to the Physical Layer and controls who gets to use the shared medium and when. Its responsibilities include:

  • Physical (MAC) addressing
  • Collision handling
  • Channel access control

For example, when several computers share the same Ethernet segment or Wi-Fi channel, it is the MAC sublayer's job to decide which device transmits first and to handle the situation if two devices transmit at once.

1. Framing

As described above, framing divides a stream of data into manageable units. Suppose an application needs to send a 10 MB file. Rather than pushing it onto the wire as one uninterrupted 10 MB block, the Data Link Layer breaks it into many smaller frames. This has three practical benefits:

  • Easier error detection — a corrupted frame only affects a small piece of data, not the whole transfer.
  • Better data management — the receiver can process and acknowledge frames individually.
  • Efficient transmission — the link can be shared more fairly among multiple senders.

2. Reliable Delivery

Some Data Link Layer protocols guarantee that a frame either arrives correctly or is retransmitted, using acknowledgments (ACKs) and retransmission logic. For example:

  1. The sender transmits a frame.
  2. The receiver does not send back an acknowledgment (perhaps the frame was lost).
  3. After a timeout, the sender retransmits the frame.

This basic ACK-and-retransmit pattern is the foundation of the Automatic Repeat reQuest (ARQ) techniques covered in more detail in the Data Link Control lesson.

3. Flow Control

If a fast sender transmits data faster than a slow receiver can process it, the receiver's buffer fills up and incoming frames start getting dropped. Flow control paces the sender so this doesn't happen — similar to pouring water into a bottle slowly enough that it doesn't overflow.

4. Error Detection

Physical media are never perfectly clean. Electrical noise, signal attenuation, and interference can all flip bits in transit. The Data Link Layer detects such changes using techniques including:

  • CRC (Cyclic Redundancy Check)
  • Parity checking
  • Checksums

For example, if the transmitted pattern 10110110 is received as 10100110, one bit has silently flipped. An error-detection code computed by the sender and re-checked by the receiver reveals that something changed, even though the receiver has no way of knowing what the original data was supposed to be from the corrupted bits alone.

5. Error Correction

Detecting an error is not the same as fixing it. Some protocols go a step further and use redundant bits that let the receiver work out exactly which bit(s) were flipped and repair them without asking for a retransmission — for instance, using Forward Error Correction (FEC). This trade-off between simple detection and full correction is explored in depth in the Error Correction lesson.

6. Access (Medium) Control

On a shared medium — such as a wireless channel or a legacy shared Ethernet segment — multiple devices may want to transmit at the same time. The MAC sublayer decides:

  • Which device is allowed to send
  • When it is allowed to send
  • How collisions are avoided or resolved

Wi-Fi devices, for example, follow a specific set of rules (listening before transmitting, waiting random backoff periods) before they put a frame on the air.

7. Duplex Modes

The Data Link Layer also governs whether two connected devices can talk in one direction at a time or both directions simultaneously.

ModeDescriptionExample
Half-DuplexBoth directions are possible, but only one device transmits at a timeWalkie-talkies: A → B or B → A, never both at once
Full-DuplexBoth devices can transmit and receive at the same timeTelephone calls: A ⇄ B simultaneously

Putting the services above together, the Data Link Layer's core functions are:

  • Framing — packaging Network Layer packets into frames.
  • Physical addressing — every device on a local network has a unique MAC address (for example, 00:1A:2B:3C:4D:5E), and the Data Link Layer uses these addresses to deliver a frame to the correct device on the link.
  • Error detection and recovery — detecting corrupted frames and triggering retransmission when needed.
  • Flow control — keeping sender and receiver speeds compatible.
  • Medium access control — preventing or resolving collisions on shared channels.

Several common networking devices work primarily at Layer 2:

DeviceWhat It Does
SwitchLearns MAC addresses, forwards frames only to the port where the destination device lives, reduces collisions, and improves overall network performance. Commonly connects computers, printers, and servers in an office.
BridgeConnects multiple LAN segments, filters traffic between them, reduces congestion, and improves efficiency — for example, separating a heavy-traffic area of a network from a quieter one.
Network Interface Card (NIC)Gives a device its MAC address and physically sends and receives frames, connecting the device to the network.
Wireless Access Point (WAP)Connects wireless devices to a wired network, manages wireless communication, and supports Wi-Fi standards.
Layer 2 SwitchA specialized switch that performs only Data Link Layer operations: maintaining MAC address tables, forwarding frames efficiently, and supporting VLANs.
ProtocolDescriptionTypical Use
Ethernet (IEEE 802.3)The most widely used LAN protocol; uses MAC addressing and supports high-speed communicationOffice and home wired networks
Token RingA special "token" circulates among devices; only the device holding the token may transmitReduces collisions in older LAN designs
FDDI (Fiber Distributed Data Interface)Uses fiber-optic cabling for high-speed, long-distance, fault-tolerant communicationCampus and backbone networks
PPP (Point-to-Point Protocol)Provides direct communication between two devicesBroadband connections, dial-up internet, WAN links
HDLC (High-Level Data Link Control)A bit-oriented protocol offering error control, synchronization, and efficient framingPoint-to-point and multipoint WAN links
SDLC (Synchronous Data Link Control)Developed by IBM as part of its network architecture; provides reliable, structured communicationIBM mainframe networking
SLIP (Serial Line Internet Protocol)One of the earliest protocols for sending IP packets over serial linksLargely obsolete; lacked robust error handling and authentication
LCP (Link Control Protocol)A component of PPP used to establish, configure, maintain, and terminate linksPart of the PPP connection lifecycle
LAP (Link Access Procedure)A family of protocols derived from HDLCTelecommunication networks
NCP (Network Control Protocol)An early protocol used before TCP/IP became the standardHistorical — used in ARPANET
  • Local Area Networks (LANs): Ethernet relies on the Data Link Layer for reliable communication between connected computers.
  • Wi-Fi Networks: The Data Link Layer manages wireless communication and collision avoidance over the air.
  • Network Switching: Switches use MAC addresses to forward frames to the correct port.
  • Point-to-Point Connections: PPP enables direct communication between two devices, such as a router and an ISP.
  • Data Centers: High-speed switches depend heavily on Data Link Layer mechanisms to move enormous volumes of frames with minimal delay.

Advantages and Limitations

AdvantagesLimitations
Provides reliable link-level communicationWorks only between directly connected devices
Detects (and sometimes corrects) transmission errorsCannot determine end-to-end routing across networks
Controls data flow between sender and receiverLimited to local network communication
Reduces collisions on shared mediaPerformance depends heavily on the underlying hardware
Uses MAC addressing for accurate local delivery
Supports efficient frame transmission

The Data Link Layer's services are implemented by more specific mechanisms covered elsewhere in this series:

  • Data Link Control — a closer look at line discipline, flow control, and error control techniques such as ARQ.
  • Error Detection — how techniques like parity, checksums, and CRC actually work.
  • Error Correction — how techniques like Hamming Code and Forward Error Correction let a receiver fix errors without retransmission.
  • Network Addressing — how the Network Layer above builds on Layer 2 addressing to route data across entire networks.

0 Comments

Reviewed before they appear

No comments yet.

Computer-Network
Ask about this post
AI Ask about this post

Ask questions about Data Link Layer and get answers drawn from it.

Signed-in readers only.