Unit content
Packets and protocol layers
Network communication is easier to design when different responsibilities are separated into layers. Each layer provides a service to the layer above and uses a service from the layer below.
Encapsulation
Suppose an application creates some data. A transport protocol adds information needed for communication between applications. A network protocol adds information needed to reach the destination host, and a link protocol adds information for the next local transmission.
Conceptually:
link header | network header | transport header | application data
Each layer treats the higher-layer message as its payload.
Why layers help
A web application can use the same HTTP semantics over different physical networks because the lower layers hide many transmission details.
Likewise, a router can forward network packets without understanding the application data inside them.
Headers and payloads
A header contains control information interpreted by a protocol layer. The payload is the data that layer carries for the next higher layer.
At the receiver, layers interpret and remove their corresponding headers before passing the payload upward.
Models are abstractions
Real protocol stacks do not always fit a perfect textbook hierarchy, but layering remains a powerful way to reason about responsibilities, interfaces and where a communication problem occurs.