PDU encapsulation is the process of wrapping one protocol data unit inside another, adding a new layer of header information as data moves down the network stack
When your computer sends data across a network, that data doesn't travel as a single blob. Instead, it gets packaged at each layer of the network model — application, transport, internet, and link layers — with each layer adding its own wrapper of control information. This wrapping process is called encapsulation, and it's how networks actually work.
Think of it like sending a letter. Your message (the original data) goes into an envelope (transport layer adds a header). That envelope goes into a shipping box (internet layer adds a header). The box gets a label with routing information (link layer adds a header). Each wrapper tells the next layer what to do with what's inside, and each layer only cares about its own wrapper — it doesn't need to understand the layers beneath it.
Key Takeaways
- Encapsulation adds a header at each network layer, turning the previous layer's complete message (header plus data) into the new layer's payload.
- The data unit at each layer has a different name: segment at transport, packet at internet, frame at link, and the original message at application.
- Each layer's header contains control information specific to that layer — port numbers at transport, IP addresses at internet, MAC addresses at link.
- Decapsulation reverses the process: each receiving layer strips off its header and passes the remaining data up to the next layer.
How encapsulation works at each network layer
The process starts at the top. When you send an email or load a web page, the application layer (layer 7) creates the message — the actual content you want to send. This message becomes the payload for the next layer down.
The transport layer (layer 4) takes that message and wraps it in a header containing source and destination port numbers, sequence numbers, and checksums. This wrapped unit is called a segment (if using TCP) or a datagram (if using UDP). The segment is now the payload for the internet layer.
The internet layer (layer 3) takes the entire segment and wraps it in its own header with source and destination IP addresses, protocol type, and time-to-live information. This wrapped unit is called a packet. The packet becomes the payload for the link layer.
The link layer (layer 2) takes the entire packet and wraps it in a frame header containing source and destination MAC addresses, plus a trailer with error-checking information. This wrapped unit is called a frame. The frame is what actually travels across the physical network medium — copper wire, fiber, or radio waves.
Why each layer adds its own header
Each layer solves a different problem, and each needs different information to solve it. The transport layer doesn't care about IP addresses — that's the internet layer's job. The internet layer doesn't care about MAC addresses — that's the link layer's job. By keeping headers separate, each layer can focus on what it does and ignore everything else.
This separation also means you can swap out layers without breaking the others. You can send the same email over WiFi one day and Ethernet the next. The transport and internet layers don't change — only the link layer does. The email application doesn't even know which physical medium is being used.
Headers also carry control information that the receiving layer needs to process the data correctly. A TCP header includes sequence numbers so the receiving computer can reassemble segments that arrive out of order. An IP header includes a time-to-live counter that prevents packets from bouncing around the internet forever. A frame header includes a checksum so the receiving computer can detect corruption from electrical noise.
What happens during decapsulation on the receiving end
When data arrives at the destination, the process reverses. The receiving computer's link layer reads the frame header, checks the checksum, and strips off the frame wrapper. It passes the remaining packet up to the internet layer.
The internet layer reads the packet header, checks that the destination IP address matches the computer's own address, and strips off the IP header. It passes the remaining segment up to the transport layer.
The transport layer reads the segment header, checks the port number to see which application should receive this data, and strips off the transport header. It passes the remaining message up to the application layer.
The application layer receives the original message exactly as it was sent, without any of the headers that were needed to get it across the network. The application doesn't need to know anything about IP addresses, MAC addresses, or port numbers — the lower layers handled all of that.
Real-world example: sending a web page request
When you type a URL into your browser, here's what encapsulation looks like in practice. Your browser creates an HTTP request message asking for the web page. This message is the application layer PDU.
TCP (the transport layer) wraps this message in a segment header that says "this came from port 54321 on my computer and is going to port 80 on the web server." The web server uses port 80 to know that this is an HTTP request, not something else.
The internet layer wraps the segment in a packet header that says "this came from IP address 192.168.1.100 and is going to IP address 93.184.216.34." Routers along the path read this header to decide where to send the packet next.
The link layer wraps the packet in a frame header that says "this came from MAC address aa:bb:cc:dd:ee:ff and is going to MAC address 11:22:33:44:55:66." This header only matters for the next physical hop — when the packet reaches a router, the router strips off this frame and creates a new one for the next hop.
The web server receives the frame, strips headers at each layer, and reads your HTTP request. It sends back the web page using the same encapsulation process in reverse.
Common confusion: PDU names at different layers
The term "PDU" (protocol data unit) is generic — it means "a chunk of data at this layer." But each layer calls its PDU by a different name, which confuses people learning networking.
At the application layer, it's a message. At the transport layer, it's a segment (TCP) or datagram (UDP). At the internet layer, it's a packet. At the link layer, it's a frame. At the physical layer, it's a bit or signal. These names exist because each layer has different concerns and different ways of thinking about data.
When someone says "a packet contains a segment," they mean the internet layer PDU contains the transport layer PDU. When they say "a frame contains a packet," they mean the link layer PDU contains the internet layer PDU. The word "contains" is just another way of saying "encapsulates."
Why encapsulation matters for troubleshooting
Understanding encapsulation helps you understand where network problems actually occur. If you can't reach a website, the problem could be at any layer. Your browser might be sending the wrong port number (transport layer). Your computer might have the wrong IP address (internet layer). Your network card might have a bad MAC address (link layer). Or the physical cable might be unplugged (physical layer).
Network troubleshooting tools like traceroute and packet sniffers work by reading the headers at different layers. Traceroute reads IP headers to show you which routers your data passes through. A packet sniffer like Wireshark reads all the headers to show you exactly what's being sent and received. These tools only work because encapsulation puts all the information you need into the headers.
Frequently Asked Questions
Does the receiving computer have to strip headers in the same order they were added?
Yes. Headers are stripped from the outside in, in reverse order. The link layer strips the frame header first, then the internet layer strips the packet header, then the transport layer strips the segment header. This is called decapsulation, and it's the mirror image of encapsulation.
What happens if a header gets corrupted during transmission?
Each layer checks its own header for corruption using checksums or cyclic redundancy checks. If corruption is detected, that layer usually discards the data. TCP will ask the sender to retransmit. UDP will just drop it. The link layer checks for corruption most aggressively because physical transmission is the noisiest part of the journey.
Can one PDU be split across multiple PDUs at the next layer down?
Yes. If a segment is too large to fit in a single packet, the internet layer can split it into multiple packets. The receiving internet layer reassembles them before passing them up to the transport layer. TCP handles this transparently — the application layer never sees it happen.
Why do we need both IP addresses and MAC addresses?
IP addresses route data across the entire internet to the right network. MAC addresses route data within a single local network to the right physical device. When you send data to someone across the world, the IP address gets it to their network, and then their local network uses MAC addresses to get it to their specific computer.
Is encapsulation the same thing as encryption?
No. Encapsulation is adding headers for routing and control. Encryption is scrambling data so only the intended recipient can read it. You can have encapsulation without encryption (most web traffic used to work this way), or encryption without encapsulation (though that's rare in practice). HTTPS uses both — it encrypts the message, then encapsulates it normally.