Back to Knowledge Base
networkingNODE: #layer-2-data-link

OSI Layer 2: Data Link Layer

The OSI layer responsible for node-to-node framing, physical MAC addressing, media access control, and hop-by-hop error detection.

AKA:Layer 2, L2, Data Link Layer
#networking#osi-layers#ethernet#mac#switches#frames

OSI Layer 2: Data Link Layer

Definition

The Data Link Layer provides direct, reliable point-to-point and point-to-multipoint data transfer between two adjacent nodes connected over the same physical network segment (LAN). It packages Layer 3 packets into Frames.

Sub-layers

The IEEE 802 standard divides Layer 2 into two sub-layers:

  1. Logical Link Control (LLC) (IEEE 802.2): Handles flow control, multiplexing multiple network layer protocols over the same physical link, and frame synchronization.
  2. Media Access Control (MAC): Handles hardware addressing (48-bit MAC addresses) and arbitrates access to the physical transmission medium (CSMA/CD in legacy Ethernet, CSMA/CA in Wi-Fi).

Key Functions

  1. Framing: Adds headers (source & destination MAC addresses, EtherType) and trailers (FCS / CRC checksums) to network packets.
  2. Physical (MAC) Addressing: Unique Burned-In Address (BIA) for local device identification.
  3. Error Detection: Frame Check Sequence (FCS) using Cyclic Redundancy Check (CRC-32) to discard corrupted frames.
  4. Flow & Congestion Control on Local Link: E.g. Ethernet pause frames (802.3x).

Common Protocols & Devices

  • Ethernet (IEEE 802.3)
  • Wi-Fi (IEEE 802.11)
  • ARP (Address Resolution Protocol): Maps IP to MAC addresses.
  • VLANs (IEEE 802.1Q)
  • PPP / HDLC
  • Hardware: Network Switches, Network Interface Cards (NICs), Bridges.

Protocol Data Unit (PDU)

  • Frame

Adjacent Layers