Unit 2: The Internet · The Internet protocol suite

Article

Layers of protocols

6 min read

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:

LayerIts jobExamples
ApplicationWhat programs say to each otherHTTP, DNS, email
TransportSplitting data into pieces; reliable (TCP) or fast (UDP) deliveryTCP, UDP
InternetAddressing, and routing packets between networksIP
LinkMoving bits over one connectionWi-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

  1. Application

    the HTTP request
  2. Transport

    TCP infothe HTTP request
  3. Internet

    IP infoTCP infothe HTTP request
  4. Link

    Wi-Fi infoIP infoTCP infothe HTTP request
The request itself never changes. Each layer only adds its own label in front. The server removes them again in the opposite order.

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:

WhereLayer at workWhat happens
Dev's phoneApplicationThe browser writes an HTTP request, after DNS gave the IP address
Dev's phoneTransportTCP splits it into pieces and numbers them
Dev's phoneInternetIP puts the server's address on each packet
Dev's phoneLinkWi-Fi sends the bits to the home router
RoutersInternet and LinkEach reads the IP address and sends the packet on over its next link
ServerLink, Internet, Transport, ApplicationThe 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.

AP® is a trademark registered by the College Board, which is not affiliated with, and does not endorse, this site. All lessons and questions here are written by JrCodex.