Encapsulation and Decapsulation in Networking

What Encapsulation Means

As data travels down through the layers on the sending side, each layer wraps the data it receives from above inside its own header (and sometimes a trailer) before passing it further down. This wrapping process is called encapsulation - each layer adds its own piece of information without needing to understand what's already inside.

Watching Data Get Wrapped, Layer by Layer

Application data:            [ DATA ]

Transport layer adds header:  [ TCP Header | DATA ]                 -> called a Segment

Network layer adds header:    [ IP Header | TCP Header | DATA ]     -> called a Packet

Data Link adds header+trailer:[ Frame Hdr | IP Hdr | TCP Hdr | DATA | Frame Trailer ] -> called a Frame

Physical layer:                101010011101...  (raw bits on the wire)

Why the Name Changes at Each Layer

LayerName for the wrapped data
TransportSegment (TCP) or Datagram (UDP)
NetworkPacket
Data LinkFrame
PhysicalBits

These terms aren't interchangeable by accident - a network engineer saying "the packet was dropped" is specifically pointing at the Network layer, not the physical cable.

Decapsulation: Unwrapping on the Receiving End

The receiving device performs the exact reverse process: each layer strips off its own header, reads what it needs, and passes the remaining data up to the layer above. By the time the data reaches the Application layer, every header added on the way down has been removed, leaving just the original data.

Why Encapsulation Matters

Each layer only ever needs to understand its own header - the Data Link layer never has to parse HTTP, and the Application layer never has to understand MAC addresses. This is what actually makes the layered design (covered in the previous note) practical: encapsulation is the mechanism that keeps each layer's concerns separate in real, transmitted data.

Written by Lorens Mishra

Software Engineer Notes Management System Administrator

Discussion

0 comments
Sign in to join the discussion.

No comments yet. Be the first to say something.