Protocol Layers: TCP/IP, the OSI Reference Model, and Encapsulation
Protocol Stacks
The Internet is complex, so its architecture is organized into layers. Consider a flight: purchase a ticket, check baggage, board, and take off; at the destination, land, leave the aircraft, and claim baggage. A complaint about the flight can return to the ticketing service.
Click any layer. Each layer has one job, done in mirror image at the two ends: going down layer by layer at departure, and back up at arrival.
Layering lets each layer concentrate on its own job. A layer need not know how lower layers implement their work; it needs to know how to use their services. This separation also allows implementation technologies to change while service behavior and interfaces remain compatible.
The protocols at all layers form a protocol stack. The five-layer teaching model used here separates application, transport, network, link, and physical layers.
The International Organization for Standardization (ISO) developed the seven-layer Open Systems Interconnection (OSI) reference model. TCP/IP became the deployed Internet protocol suite, while OSI remains useful as a reference for discussing responsibilities.
| Layer | Function |
|---|---|
| Application | Provides network services to applications |
| Presentation | Handles the representation of transmitted data |
| Session | Organizes communication sessions |
| Transport | Provides communication between processes on different hosts |
| Network | Addresses and forwards packets between networks |
| Data link | Frames and delivers data across a link |
| Physical | Transmits signals over a physical medium |
KNOWLEDGE QUIZ
Encapsulation
At the sending host, an application message enters the transport layer. A transport header is added to form a segment. The receiver's transport layer uses this information, including fields needed for application delivery and error detection.
The transport segment passes to the network layer, which adds a header containing information such as source and destination addresses. The result is a network-layer datagram.
The link layer then adds its header to form a link-layer frame.
Each layer packs the parcel it receives into a bigger box and sticks its own label (header) on it. The outermost box is the one the next device sees first.
Pack a parcel: build and repair an encapsulated frame
Treat application message M as the item to ship. Each layer puts the parcel it receives into a bigger box and sticks on its own shipping label (header) for its counterpart. Pack in any order and check the frame; take off the outermost box to fix a mistake.
Each layer packs the parcel it receives into a bigger box and sticks its own label (header) on it. The outermost box is the one the next device sees first.
Each new box goes around everything packed so far, so its label becomes the outermost one.
Follow a message through a switch and a router
Step through one message from sender to receiver. Watch which layers each device uses: the sender wraps the message layer by layer, the link-layer switch only goes up to layer 2, the router goes up to layer 3 and builds a new link header, and the receiver unwraps everything.
Step 1/18 · Sender, Application: The sender's application creates message M and passes it down.
KNOWLEDGE QUIZ
Count bytes through encapsulation
An application message is 100 bytes. This simplified model adds 20 transport-header bytes, 20 network-header bytes, and 18 link-overhead bytes. These are supplied model sizes, not universal protocol constants. Calculate the size at each stage, total overhead, and bytes delivered to the receiving application.