Data Link Layer (in depth)
The Data Link layer is the layer that actually puts bits onto a shared piece of wire — and then has to solve every problem that creates: how do frames start and stop, who is allowed to transmit at any instant, and how do we know the bits arrived intact? This lesson is the detailed tour of those services and the access methods that implement them.
The services of the Data Link layer
The Data Link layer (OSI Layer 2) sits between the Physical layer below it and the Network layer above. The Physical layer moves raw signals; the Network layer cares about routing between networks. Layer 2 is the layer that governs one hop at a time — a single piece of medium between two devices. To do that it provides four classic services.
Frame synchronisation
A receiver on a wire sees an unbroken stream of bits. It cannot know “here a new frame starts” unless the sender marks it. Frame synchronisation is the mechanism that draws those boundaries: a repeating bit pattern (a start delimiter) is sent immediately before each frame so the receiver can lock on and know exactly where the frame begins.
- Ethernet uses a preamble (7 bytes) plus a Start Frame Delimiter (1 byte) to wake up and synchronise the receiver before the frame proper. Lesson 08 gives the exact bytes.
- Point-to-point protocols such as PPP and HDLC use a flag byte (for PPP, 0x7E) at the start and end of every frame. If that value occurs inside the data, the protocol escapes it (byte or bit stuffing) so it cannot be mistaken for the delimiter.
Without a reliable delimiter, the receiver would lose “bit alignment”: every field after the mistake would be interpreted at the wrong offset, and the frame would be unreadable.
Media access control
If several stations share one medium, only one may transmit at a time or their signals will overlap and corrupt each other. Media access control is the set of rules that decides who speaks when. There are two broad families.
The access method differs sharply between Ethernet (wired) and Wi-Fi (wireless), and it is a favourite exam comparison.
Flow control and error control
A sender that transmits faster than the receiver can process will overflow the receiver’s buffers. Flow control is the mechanism that throttles the sender. Two broad approaches exist.
| Approach | How it works | Examples |
|---|---|---|
| Feedback-based | The receiver sends control messages back (ACKs, window updates, “stop/wait” signals) to tell the sender to slow down or continue. | TCP sliding window; classic L2 stop-and-wait |
| Rate-based | No feedback: the sender is simply limited to an agreed rate, or the receiver advertises a receive rate. | Some modern links; traffic shaping above L2 |
On an Ethernet LAN specifically there is no Layer 2 flow-control loop in normal operation; end hosts rely on the transport layer (TCP). Ethernet defines optional PAUSE frames, but they are rarely used. The key idea: Layer 2 flow control, where present, is per-link.
Error control. Signals get corrupted: electrical noise, attenuation, interference. Layer 2 addresses this with error detection. The sender computes a mathematical value over the frame contents and puts it in the Frame Check Sequence (FCS) trailer. The receiver recomputes the same value; if the two differ, the frame was damaged.
- The FCS is most often a CRC (Cyclic Redundancy Check) — a strong polynomial remainder that catches almost all burst errors.
- In Ethernet, a frame with a bad FCS is silently discarded. Ethernet does not ask for a retransmission at Layer 2. Recovery is left to the layers above — if the payload was a TCP segment, TCP notices the missing data and retransmits.
Some Layer 2 technologies do retransmit — for example, 802.11 (Wi-Fi) sends an ACK per unicast frame, and PPP can run a reliable mode. That is a property of the specific protocol, not a universal Layer 2 rule.
Media access methods in detail
The two contention-based methods you must know are CSMA/CD and CSMA/CA. Both begin with the same idea — carrier sense: listen before talking. They differ in what happens next.
CSMA/CD (Ethernet)
Carrier Sense Multiple Access with Collision Detection is the classic shared Ethernet access method. It runs on a half-duplex shared segment (historically a hub or a coax bus), where two stations can transmit at once.
- Carrier sense — a station that wants to send listens first. If the medium is busy, it waits.
- Multiple access — when the medium looks idle, it transmits. But two stations may see “idle” at the same instant and both transmit.
- Collision detection — the station keeps listening while it sends. If it hears a signal other than its own, a collision has occurred.
- Jam signal — the station sends a short jam pattern so every station on the segment notices the collision and discards the damaged frames.
- Binary exponential backoff — each station waits a random time before retrying. After the n-th collision the wait is chosen from 0 to 2n−1 slot times (capped), so repeated collisions spread the retries out and the chance of a second clash falls.
For collision detection to work, a station must still be transmitting when a collision returns — which is exactly why Ethernet has a minimum frame size of 64 bytes (lesson 08).
CSMA/CA (Wi-Fi)
Carrier Sense Multiple Access with Collision Avoidance is the access method for IEEE 802.11 wireless LANs. Radio cannot reliably detect collisions the way a wire can (a station cannot hear a remote collision while it is transmitting), so Wi-Fi avoids collisions instead of detecting them.
- Listen before talk — a station senses the channel; if busy it waits.
- Random backoff — even when the channel looks idle, a station waits a random slot time before transmitting, so stations do not all fire together.
- Acknowledgement — the receiver sends an ACK for every correctly received unicast frame. No ACK means the sender assumes a collision and retransmits after another backoff. (This is a rare case of a Layer 2 retransmission.)
- Optional RTS/CTS — for large frames, a station may send a Request To Send; the access point replies with Clear To Send, reserving the medium and easing the “hidden node” problem where two stations cannot hear each other.
Token-based access
Controlled methods avoid contention entirely. In token passing (used by legacy IBM Token Ring and FDDI), a small special frame called the token circulates around a logical ring. A station may transmit only while it holds the token, and it passes the token on when done. There are never collisions because only one station can hold the token at a time. Token Ring and FDDI are obsolete in modern LANs — switched full-duplex Ethernet won on cost and simplicity — but they remain the classic exam alternative to contention.
Why modern switched Ethernet has no collisions
On a modern LAN, each device has a dedicated cable to a switch port, and every link runs full-duplex: transmit and receive use separate wire pairs simultaneously. Each link is its own collision domain containing only the switch port and the attached device. Because there can be no second station transmitting on that link, collisions can never occur, and CSMA/CD is effectively turned off (or never triggered).
This is often called microsegmentation — the switch divides what used to be one shared collision domain into many single-device domains. CSMA/CD survives in the standard only for backward compatibility and rare half-duplex links. The exam point is simple: full-duplex switched links do not have collisions, so CSMA/CD does not run on them.
| Shared hub | Switched, full duplex |
|---|---|
| One shared medium for every port | A dedicated link per port |
| Two senders can collide; CSMA/CD must resolve it | No shared medium, so no collisions |
| One shared collision domain | One collision domain per port (microsegmentation) |
Per-link, not end-to-end
One of the most important conceptual points about the Data Link layer: its error detection is per-link, not end-to-end. Each frame is checked on each individual hop — PC to switch, switch to switch, switch to router — and each hop validates and drops only its own damaged frames. A frame that passes one link is re-created fresh for the next link, so an error caught on link one never propagates, and an error introduced on link two is caught there.
End-to-end reliability (guaranteeing the whole message arrives correctly across many networks) belongs to the transport layer, mainly TCP. This is why the two layers coexist: Layer 2 cleans up each link cheaply, and TCP provides the end-to-end guarantee where an application needs it.
Review
Check what you have learned with these review questions.
Sources & references
- IEEE. IEEE 802.3 (Ethernet, including CSMA/CD and full-duplex operation). standards.ieee.org/ieee/802.3.
- IEEE. IEEE 802.2 (Logical Link Control). standards.ieee.org/ieee/802.2.
- IEEE. IEEE 802.11 (Wireless LAN MAC; CSMA/CA and RTS/CTS). standards.ieee.org/ieee/802.11.
- Cisco. CCNA (200-301) Exam Topics, Network Fundamentals. cisco.com.
Target exams: CCNA 200-301 v1.1 · CyberOps Associate 200-201. Last content verification: 2026-10-11.