Each layer in the OSI or TCP/IP model has its own role in the creation and encapsulation of a data stream.
As data travels through the layers, each layer adds its own header (and sometimes trailer) that contains control information required for the next step in transmission.
A PDU (Protocol Data Unit) acts like an elevator, carrying the data up and down through the layers:
- From top to bottom in the sender
- From bottom to top in the receiver
Each layer uses a different term for its PDU:
| Layer | PDU Name |
|---|---|
| Application | Data |
| Transport | Segment (TCP) / Datagram (UDP) |
| Internet | Packet |
| Data Link | Frame |
| Physical | Bits |
At the beginning, we only know the domain name β not its IP address. We need to contact a DNS server to resolve it.
βDo you know the IP address for google.com?β
π‘ Technical Note: Even DNS queries are encapsulated through the Transport Layer (typically using UDP, port 53).
Three-way handshake ensures the receiver is ready. Data is divided into segments.
- Sequence number (ensures proper reassembly)
- Acknowledgment number
- Window size
- Error control and buffering
π‘ UDP skips the handshake and simply sends datagrams.
Adds source & destination IP addresses. MAC addresses are only used for local delivery.
Frames are created, MAC addresses added, data converted to bits, transmitted through cable, light, or radio.
Data encapsulation ensures each layer adds necessary information for proper delivery, while PDUs carry the data between layers. Logical addressing, segmenting, and local delivery mechanisms work together to move data reliably from sender to receiver.