100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
Python

Data Link Layer Basics

How raw bits are organized into frames for reliable node-to-node delivery on the same network segment.

Physical & Data Link LayerBeginner10 min readJul 8, 2026
Analogies

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

python
# 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

Was this page helpful?

Topics covered

#Python#ComputerNetworksStudyNotes#ComputerNetworks#DataLinkLayerBasics#Data#Link#Layer#Explanation#StudyNotes#SkillVeris