Article
Layers of protocols
Sending a parcel involves many people. You pack it. The post office labels it. A truck carries it. A plane takes it across the sea. The packer does not drive the truck, and the pilot does not wrap the box. Each person does one job and trusts the others to do theirs. The Internet works in the same way, with layers of protocols.
A suite of protocols
You already know several protocols: IP, TCP, UDP, DNS and HTTP. They do not work alone. A protocol suite is a group of protocols designed to work together, where each one handles one part of the job. The Internet uses the TCP/IP suite. It is usually described as four layers:
| Layer | Its job | Examples |
|---|---|---|
| Application | What programs say to each other | HTTP, DNS, email |
| Transport | Splitting data into pieces; reliable (TCP) or fast (UDP) delivery | TCP, UDP |
| Internet | Addressing, and routing packets between networks | IP |
| Link | Moving bits over one connection | Wi-Fi, Ethernet cable |
Some books draw five or seven layers. The idea is the same: each layer has its own job.
Check your understanding
IP puts addresses on packets and helps them to find their way between networks. Which layer of the TCP/IP suite does IP belong to?
Wrapping and unwrapping
When you send a web request, the data goes down through the layers on your computer. Each layer adds its own information to the front of the data, like putting the box into a bigger box with a label:
Sending a web request
Application
the HTTP requestTransport
TCP infothe HTTP requestInternet
IP infoTCP infothe HTTP requestLink
Wi-Fi infoIP infoTCP infothe HTTP request
Across the network, routers pass the packet along. At the far end, the data goes up through the layers of the server. Each layer removes the label that its matching layer added, and passes the rest upward. Finally, the web server reads the HTTP request.
A layer only talks to the layers directly above and below it, and to the same layer on the other computer. The Link layer does not understand HTTP. HTTP does not know whether the bits travelled by cable or by Wi-Fi.
Why use layers?
Because each layer does a single job, layers can be changed without changing the others. Engineers can invent a faster kind of Wi-Fi, and every website still works, because HTTP, TCP and IP do not care about the link. Different teams and companies can also build different layers, as long as each follows the protocol.
Check your understanding
What is the main benefit of using layers of protocols?
Worked example
Dev opens a page on his phone using home Wi-Fi. Follow one request:
| Where | Layer at work | What happens |
|---|---|---|
| Dev's phone | Application | The browser writes an HTTP request, after DNS gave the IP address |
| Dev's phone | Transport | TCP splits it into pieces and numbers them |
| Dev's phone | Internet | IP puts the server's address on each packet |
| Dev's phone | Link | Wi-Fi sends the bits to the home router |
| Routers | Internet and Link | Each reads the IP address and sends the packet on over its next link |
| Server | Link, Internet, Transport, Application | The layers unwrap the packet, TCP puts the pieces in order, and the web server reads the request |
Later, the home router changes to a cable connection. Nothing above the Link layer needs to change.
Common mistakes
- "TCP/IP is one protocol." It is a suite. TCP and IP are two separate protocols with different jobs.
- "A router reads the HTTP request." A router mainly needs the Internet layer information to forward a packet.
- "Wi-Fi is part of the Internet layer." Wi-Fi belongs to the Link layer. IP belongs to the Internet layer.
- "Layers repeat the same work." Each layer has a different job.
On the exam
The exam asks less about layer names than about what each protocol does. Know the jobs: IP addresses and routes packets, TCP gives reliable delivery, UDP gives fast delivery, DNS finds addresses and HTTP asks for pages. The layer idea explains why they fit together.
Key words
Protocol suite: a group of protocols that work together, each with its own job.
TCP/IP: the protocol suite used by the Internet.
Layer: one level of a protocol suite, with one job.
Application layer: the layer with protocols for what programs say, such as HTTP and DNS.
Transport layer: the layer for delivery between computers, such as TCP and UDP.
Internet layer: the layer for addressing and routing, which uses IP.
Link layer: the layer for sending bits over one connection, such as Wi-Fi.