Data Encapsulation
Encapsulation is the mechanism that turns an application’s message into something a network can carry — and back again. This is the deep version: a real web request, header by header, hop by hop, including the ARP step that most explanations skip.
Recap: two directions
Encapsulation adds control information — a header, and at Layer 2 a trailer — as data moves down the stack on the sending host. De-encapsulation removes that control information as data moves up the stack on the receiving host. Week 1, Lesson 18 introduced the idea; here we make it concrete.
Encapsulation: each layer wraps the PDU handed down from above DATA [ application data ] SEGMENT [ TCP header ][ application data ] + ports PACKET [ IP header ][ TCP header ][ application data ] + IP addresses FRAME [ Ethernet header ][ IP header ][ TCP header ][ application data ][ FCS] BITS . . . 1 0 1 1 0 1 0 0 1 1 0 1 0 1 1 0 1 0 . . . (signals on the wire)
Read the diagram from top to bottom: nothing is ever discarded, everything is nested. The application data is still in there at the bottom — it is simply surrounded by more and more control information.
TCP/IP encapsulation in a web request
You open a browser and type https://example.com. Here is the full trip down the stack on your PC before a single bit leaves the network card.
- Application layer. The browser builds an HTTP request (“GET / HTTP/1.1…”). This is the data. The browser must also learn the server’s IP address (via DNS), but that lookup is a separate conversation.
- Transport layer (TCP). TCP adds a header containing a source port (a random high number chosen by the browser) and a destination port
443for HTTPS. The data plus this header is now a segment. - Network / Internet layer (IP). IP adds a header containing the source IP (your PC) and destination IP (the server). The segment plus this header is now a packet.
- Data Link layer (Ethernet). Ethernet adds a header with a source MAC and a destination MAC, plus an FCS trailer. The packet plus these is now a frame.
- Physical layer. The frame is encoded as electrical, optical, or radio signals and transmitted — the bits.
A web request inside an Ethernet frame (fields shown as roles, not sizes)
+------------------+-------------+---------------+---------------+-----+
| Ethernet header | IP header | TCP header | Application | FCS |
| src MAC, dst MAC | src IP, | src port, | data | |
| | dst IP | dst port (443)| (HTTP request)| |
+------------------+-------------+---------------+---------------+-----+
|<----------- Frame (Data Link PDU) --------------------------------->|
|<--------- Packet (Network PDU) ------------->|
| |<---- Segment (Transport PDU) -->|
| | |<-- DATA -->|
Header families and PDUs
You do not need field sizes to reason about a network; you need to know what each family of fields achieves. Every layer also has a name for the thing it carries, and getting those names right is the single most examined detail in this topic.
| Header | Field family | Role |
|---|---|---|
| Transport (TCP / UDP) | Port numbers | Identify the sending and receiving application, so the right program gets the data (HTTP = 80, HTTPS = 443, DNS = 53…). |
| Network (IPv4 / IPv6) | Source and destination IP addresses | Identify the hosts and let routers choose a path across networks, end to end. |
| Data Link (Ethernet) | Source and destination MAC addresses | Identify the network interfaces on the local link, so the frame reaches the next device on this hop only. |
| Data Link trailer | Frame Check Sequence (FCS) | A checksum the receiver recomputes to detect a corrupted frame; if it fails, the frame is dropped. |
PDUs revisited
| Layer | PDU | Header (and trailer) added |
|---|---|---|
| Application | Data | None at this layer (application protocol’s own data) |
| Transport | Segment (TCP) / Datagram (UDP) | TCP or UDP header (ports) |
| Network / Internet | Packet | IP header (IP addresses) |
| Data Link | Frame | Ethernet header (MAC) + FCS trailer |
| Physical | Bits | None (encoded as signals) |
The ARP step: resolving the next-hop MAC
There is a gap in the story above. To build the Ethernet frame, the PC needs the destination MAC address — but it only knows the destination IP. On an Ethernet link, ARP (Address Resolution Protocol) closes that gap by mapping an IP address to a MAC address on the local link.
The PC first decides who the next hop is:
- If the destination IP is on the same subnet (same network as the PC), the next hop is the destination host itself.
- If the destination IP is on a different subnet, the next hop is the default gateway (the router). The PC needs the gateway’s MAC, not the far server’s.
ARP on the local link (accurate, simplified)
PC-A wants to send to 192.168.10.20, which is on the SAME subnet:
1. Compare to my subnet mask -> same subnet, so the next hop is 192.168.10.20
2. Check my ARP cache -> not there
3. Broadcast request -> "Who has 192.168.10.20? Tell 192.168.10.10"
(dst MAC = FF:FF:FF:FF:FF:FF, a broadcast)
4. Unicast reply -> "192.168.10.20 is at aa:bb:cc:00:11:22"
5. Build the frame -> dst MAC = aa:bb:cc:00:11:22
If the destination were on a DIFFERENT subnet, step 4 would return the
ROUTER's MAC, and the frame would be sent to the router, not the far host.
De-encapsulation at the destination
At the far end, the receiving host runs the same stack in reverse. Each layer peels off its own header and passes the rest upward.
De-encapsulation at the server, top to bottom of the trip BITS NIC receives the signals and reassembles the frame | FRAME NIC checks the FCS, then strips the Ethernet header (dst MAC was mine) | PACKET IP checks the destination IP (it is mine) then strips the IP header | SEGMENT TCP checks the destination port (443) then strips the TCP header | DATA The web-server application receives the HTTP request
If the FCS check fails, the frame is silently dropped — error detection, not correction. If IP finds the destination address is not its own, it would forward the packet instead of delivering it upward (that is the router’s job). If TCP finds the port is not open, it answers with a reset or an ICMP error.
The full journey, down and up
Now follow the whole path: PC → switch → router → server. The switch stays at Layer 2 and reads only the Ethernet header. The router goes up to Layer 3, reads the IP header, and then builds a brand-new Ethernet frame for the next hop.
Common pitfalls
- Using “packet” for everything. Name the PDU precisely: segment/datagram, packet, frame.
- Thinking headers overwrite data. They are added; the payload survives untouched.
- Assuming MAC addresses travel end to end. They are local to each link and change at every router.
- Forgetting the FCS. Data Link adds a header and a trailer.
- Skipping ARP. A frame cannot be built until the next-hop MAC is known.
- ARP-resolving a remote host. ARP only works on the local link; for remote hosts you resolve the gateway.
Key terms
| Term | Meaning |
|---|---|
| Encapsulation | Wrapping a layer’s payload with that layer’s header (and, at Layer 2, a trailer) on the way down the stack. |
| De-encapsulation | Removing each layer’s header (and trailer) on the way up the stack at the receiver. |
| PDU | Protocol Data Unit; the data unit’s name at a given layer (data, segment/datagram, packet, frame, bits). |
| FCS | Frame Check Sequence; the Layer 2 trailer checksum used to detect corruption. |
| ARP | Address Resolution Protocol; maps an IPv4 address to a MAC address on the local link. |
| Default gateway | The router a host sends off-subnet traffic to when the destination is not on its own network. |
Review
Check what you have learned with these review questions.
Sources & references
- Postel, J. RFC 791: Internet Protocol (1981) — the IP header and its fields. rfc-editor.org/rfc/rfc791.
- Braden, R. RFC 1122: Requirements for Internet Hosts — Communication Layers, Section 1.3.3 (PDU terminology). rfc-editor.org/rfc/rfc1122.
- Socolofsky, T. & Kale, C. RFC 1180: A TCP/IP Tutorial, Sections 2.2–4 (encapsulation and ARP). rfc-editor.org/rfc/rfc1180.
- Plummer, D. RFC 826: An Ethernet Address Resolution Protocol (1982). rfc-editor.org/rfc/rfc826.
- IEEE. IEEE 802.3 (Ethernet frame format, including the FCS). standards.ieee.org.
- Cisco. CCNA (200-301) Exam Topics, Network Fundamentals. cisco.com.
Target exams: CCNA 200-301 v1.1 · CyberOps Associate 200-201. Last content verification: 2026-10-11.