Skip to main content
networking

Encapsulation

Encapsulation is the process of wrapping data with protocol headers as it moves down the network stack. Application data becomes a TCP segment, which becomes an IP packet, which becomes an Ethernet frame. Each layer adds its own header without understanding the layers above or below.

Definition

Encapsulation is the layered wrapping of data as it passes through the network stack. An HTTP response body is wrapped in an HTTP header, then in a TCP segment header (adding ports and sequence numbers), then in an IP packet header (adding addresses and TTL), then in an Ethernet frame header (adding MAC addresses) and trailer (FCS). Each layer treats everything above it as opaque payload. This layering enables protocol independence – TCP works the same whether it carries HTTP, SSH, or SMTP. De-encapsulation happens at the receiver as each layer strips its header and passes the payload upward. VPN tunneling adds an extra encapsulation layer – an IP packet inside another IP packet – which reduces the effective MTU by the size of the tunnel headers.

Examples

  • HTTP data (varies) + TCP header (20B) + IP header (20B) + Ethernet header (14B) + FCS (4B)
  • GRE tunnel adds 24 bytes of encapsulation overhead
  • VXLAN encapsulates L2 frames inside UDP packets for overlay networking

Related Protocols

Related Terms