Lesson 21: The Concept of Encapsulation and Decapsulation
How does data move from your web browser down to the wire? Through a process called Encapsulation.
Encapsulation (The Sending Process)
Encapsulation is the process of adding protocol control information (headers and trailers) to data as it moves down the layers from Layer 7 to Layer 1. Each layer takes the data from the layer above it and wraps it in its own header, like placing a letter inside an envelope, and then putting that envelope inside a larger box.
| Layer | Action | Data Unit Result |
|---|---|---|
| L4 (Transport) | Adds TCP/UDP Header (Port Numbers). | Segment/Datagram |
| L3 (Network) | Adds IP Header (IP Addresses). | Packet |
| L2 (Data Link) | Adds MAC Header and Trailer (MAC Addresses, CRC). | Frame |
| L1 (Physical) | Converts the Frame into electrical signals. | Bits |
Decapsulation (The Receiving Process)
When the data arrives at the destination, Decapsulation occurs. The receiving device processes the data by removing the headers, layer by layer, as the data moves up the stack.
- The NIC (L2) removes the Frame header and trailer, checking for errors.
- The OS (L3) reads the IP address to confirm the packet is for this host.
- The OS (L4) reads the Port Number to determine which application receives the data.
- The application (L7) finally receives the original data.
Analogy: Encapsulation is like shipping a package: labeling it for transit, boxing it, wrapping it, and putting a delivery address on the outside.