Data Encapsulation

Process of adding protocol-specific headers as data travels down OSI model layers

Data Encapsulation

Data encapsulation is the process of adding protocol-specific headers (and sometimes trailers) to data as it travels down the OSI model layers. Think of it as wrapping a package - each layer adds its own “shipping label” with information needed for delivery.

The Encapsulation Process

  • Application Layer (Layer 7): User data starts here (email, web page, file transfer)
  • Transport Layer (Layer 4): Adds TCP/UDP header → creates segments (TCP) or datagrams (UDP)
  • Network Layer (Layer 3): Adds IP header → creates packets
  • Data Link Layer (Layer 2): Adds frame header/trailer → creates frames
  • Physical Layer (Layer 1): Converts to electrical signals → bits

Protocol Data Units (PDUs)

Layer PDU Name What Gets Added Example Protocols
Application Data User information HTTP, SMTP, FTP
Transport Segment/Datagram Port numbers, sequence numbers TCP, UDP
Network Packet Source/destination IP addresses IPv4, IPv6
Data Link Frame MAC addresses, error detection Ethernet, Wi-Fi
Physical Bits Electrical/optical signals Copper, fiber

Key Header Information by Layer

Transport Layer Headers:

  • Source and destination port numbers (identifies applications)
  • Sequence numbers (TCP only - for reliable delivery)
  • Window size (flow control)
  • Flags (SYN, ACK, FIN, RST for TCP connection management)

Network Layer Headers:

  • Source and destination IP addresses (logical addressing)
  • Time-to-Live (TTL) or Hop Limit (prevents routing loops)
  • Protocol field (identifies next layer protocol - TCP=6, UDP=17)
  • Fragmentation information (for packets larger than MTU)

Data Link Layer Headers:

  • Source and destination MAC addresses (physical addressing)
  • EtherType field (identifies network layer protocol - IPv4=0x0800, IPv6=0x86DD)
  • Frame Check Sequence (FCS) trailer for error detection

Decapsulation Process

When data arrives at destination, the process reverses:

  • Physical layer converts bits back to frames
  • Data link layer strips frame header/trailer, checks FCS
  • Network layer strips IP header, checks destination IP
  • Transport layer strips TCP/UDP header, delivers to correct port
  • Application receives original data

Real-World Example: Web Browsing

  1. Application: User requests www.cisco.com (HTTP GET request)
  2. Transport: TCP adds header with destination port 80 (HTTP)
  3. Network: IP header added with Cisco’s web server IP address
  4. Data Link: Ethernet header with next-hop router’s MAC address
  5. Physical: Converted to electrical signals on network cable

Note: At each router hop, Layer 2 headers are stripped and re-added with new MAC addresses, but Layer 3 headers remain intact


Vocabulary

  • MTU (Maximum Transmission Unit): Largest frame size allowed on network segment (Ethernet standard = 1500 bytes)
  • MSS (Maximum Segment Size): Largest amount of data TCP can send in single segment (typically MTU - 40 bytes for IP/TCP headers)
  • Fragmentation: Breaking large packets into smaller pieces when they exceed link MTU
  • EtherType: 2-byte field identifying the network layer protocol in Ethernet frames

Notes

  • Remember the acronym: “All People Seem To Need Data Processing” (Application, Presentation, Session, Transport, Network, Data Link, Physical)
  • Each layer only cares about its own header - layered independence allows protocols to change without affecting other layers
  • Routers operate at Layer 3 (strip/add Layer 2 headers but preserve Layer 3)
  • Switches operate at Layer 2 (forward based on MAC addresses)
  • When troubleshooting, work from Physical layer up - no point checking IP routing if cables are unplugged
  • Critical for subnetting: Remember that broadcast domains are defined at Layer 2, while routing occurs at Layer 3
  • On CCNA exam, expect questions about which PDU name corresponds to which layer