Introduction
The data link layer is Layer 2 of the OSI model. It sits directly above the physical layer and is responsible for taking the raw bit stream that Layer 1 transmits and organizing it into structured units called frames, so that two devices on the same physical network segment (e.g. the same Ethernet LAN or Wi-Fi network) can exchange data reliably.
Cricket analogy: Like a stump microphone feeding raw crowd noise that the broadcast truck must chop into discrete commentary segments, the data link layer takes Layer 1's raw bit stream and organizes it into frames so two devices on the same LAN, like two cameras on the same feed, can exchange data reliably.
Explanation
Framing is the core function of the data link layer: it marks the beginning and end of a chunk of data (a frame) within the continuous bit stream coming from the physical layer, so the receiver knows exactly where one unit of data starts and stops. A typical frame includes a header (with source and destination MAC addresses), a payload (the actual data), and a trailer (often containing an error-checking field such as a frame check sequence).
Cricket analogy: Just as an umpire signals the start of an over with a call and marks its end after six legal deliveries, framing marks where a frame begins and ends in the bit stream, with the header holding sender/receiver identity like team names and the trailer acting as the scorer's tally check.
The IEEE 802 standards split the data link layer into two sublayers. The Logical Link Control (LLC) sublayer, defined in IEEE 802.2, handles multiplexing protocols over the same link, flow control, and error notification to the network layer above — it is largely medium-independent. The Media Access Control (MAC) sublayer, defined separately per medium (e.g. IEEE 802.3 for Ethernet, 802.11 for Wi-Fi), handles addressing (MAC addresses) and controls how devices gain access to the shared physical medium, including collision handling on shared media.
Cricket analogy: The LLC sublayer is like the ICC's general playing conditions that apply across formats, while the MAC sublayer is like format-specific rules (T20 powerplays vs Test follow-on rules) governing how teams actually access their turn to bat on a shared pitch.
Crucially, the data link layer only provides node-to-node delivery across a single link or segment — it does not know how to get a frame across multiple networks. That is the network layer's job (Layer 3, using IP addresses and routing). A switch operates at the data link layer and forwards frames based on MAC addresses within one broadcast domain/segment; a router operates at the network layer and forwards packets between different networks.
Cricket analogy: A team's internal fielding captain can only direct players within the boundary rope of one ground, just as the data link layer only delivers frames within one segment; getting the team from one stadium's ground to another city's stadium (Layer 3 routing) is a different job entirely.
Example
# Simplified illustration of an Ethernet frame's structure
frame = {
"preamble": "used for clock sync, physical-layer artifact",
"dest_mac": "AA:BB:CC:11:22:33",
"src_mac": "AA:BB:CC:44:55:66",
"ethertype": "0x0800", # indicates the payload carries an IPv4 packet
"payload": b"<network-layer packet data>",
"frame_check_sequence": "CRC value computed over header+payload",
}
# The data link layer reads dest_mac to decide if this frame is addressed
# to this device (or a broadcast/multicast), and uses the frame check
# sequence to detect transmission errors before handing the payload up
# to the network layer.
print(frame["dest_mac"], frame["ethertype"])Analysis
The LLC/MAC split matters because it lets the same upper-layer logic (LLC) work across very different physical media (Ethernet, Wi-Fi, etc.), while each medium's MAC sublayer handles its own addressing and medium-access rules. On an exam, the key distinction to keep straight is: physical layer = bits and signals with no structure; data link layer = frames with addressing and error checking, valid only within one local segment; network layer = packets with IP addresses that can be routed across many segments.
Cricket analogy: Just as a coach applies the same batting philosophy (LLC) whether the team plays on a turf pitch or a matting pitch, each surface's specific ground rules (MAC) still govern how batsmen actually take strike, keeping strategy and surface rules cleanly separate for exam purposes.
Key Takeaways
- The data link layer organizes raw bits into frames — this is called framing.
- It is split into the LLC sublayer (flow control, multiplexing) and the MAC sublayer (addressing, medium access).
- It provides node-to-node delivery only within a single network segment, not across multiple networks.
- Switches operate at the data link layer using MAC addresses; routers operate at the network layer using IP addresses.
Practice what you learned
1. What is the primary function of the data link layer?
2. Which sublayer of the data link layer is responsible for MAC addressing and medium access control?
3. A device that forwards data based on MAC addresses within a single segment is operating at which layer?
4. What limitation does the data link layer have regarding delivery scope?
Was this page helpful?
You May Also Like
Physical Layer Basics
How raw bits travel as electrical, optical, or radio signals over cables and wireless media.
MAC Addressing and Switching
How 48-bit MAC addresses identify devices and how switches learn and use them to forward frames.
Ethernet Standards
Common Ethernet naming and speeds (10BASE-T to Gigabit and beyond) and why CSMA/CD is largely obsolete on modern switched networks.
Hubs, Switches, and Routers
Learn how hubs, switches, and routers operate at different OSI layers and how they shape collision and broadcast domains.