Encapsulation

Encapsulation is the process where each protocol layer “wraps” the data it receives with its own header (and sometimes a trailer) before handing it to the layer below. This modular approach lets each layer focus solely on its responsibility—port addressing, routing, framing, error checks, etc. without worrying about the rest of the stack.


Protocol Data Units (PDUs)

Layer PDU Name What’s Added
Application Data Application‑specific formatting (e.g., HTTP headers)
Transport Segment (TCP)Datagram (UDP) Source/destination ports,sequence numbers, flags
Network Packet Source/destination IP addresses,TTL, protocol field
Data Link Frame Source/destination MACs,frame check sequence (FCS) trailer

Step‑by‑Step Encapsulation

image.png

  1. Application Layer
  2. Transport Layer
  3. Network Layer
  4. Data Link Layer
  5. Physical Layer

Note: Frames often include both a header (addresses, type) and a trailer (error‑check sequence).


Decapsulation

image.png

On the receiving side, each layer strips off its header/trailer and passes the remaining PDU up to the layer above: