Menu

Protocols & Layers

TCP/IP Stack

TCP/IP is the protocol suite used for communication on the internet. It is a suite rather than a single protocol, organised into layers so each part of a transmission has a clear job.

TCP breaks a message into packets before it is sent. At the destination it puts the packets back into order, detects errors and resends any that are lost. IP routes each packet from the source IP address to the destination IP address.

The TCP/IP stack has four layers, ordered from application at the top to link at the bottom. It is modular: each layer handles a small part of the communication.

The four layers

LayerRole
ApplicationApplications create the data to send. Application protocols operate here: HTTP, HTTPS, FTP, SMTP, POP3 and IMAP. The application in use determines which protocol is chosen. On receipt, the correct protocol presents the data to you.
TransportCreates a connection between hosts. TCP numbers packets, reassembles them at the recipient, detects errors and resends lost packets.
InternetAdds source and destination IP addresses. IP routes packets, and routers operate at this layer.
LinkHandles physical transmission through hardware and cables. It uses MAC addresses and includes Ethernet and Wi-Fi. It converts data into a signal suitable for the transmission medium.

For example, when you load a web page, the web browser creates the request using HTTP at the application layer. TCP splits it into numbered packets at the transport layer, IP adds source and destination addresses and routes it at the internet layer, and the link layer converts it into signals for Ethernet or Wi-Fi. On arrival the layers work in reverse: the link layer removes the MAC address, the internet layer removes the IP addresses, the transport layer reassembles the packets, and the application layer presents the page.

The four TCP/IP layers stacked from application at the top to transport, internet and link at the bottom, each with its protocols and job. Sending a web page request goes down the stack (HTTP request, TCP numbered packets, IP addresses, signals for Ethernet or Wi-Fi) and on arrival it goes back up in reverse until the page is presented.

Why layering helps

Each layer is self-contained, so its function can be changed without affecting the others. Different hardware and software can operate at a particular layer, which provides interoperability: equipment and software from different providers can work together. A sender and receiver using different hardware and software can still communicate because they use the same protocols at each layer.

Practise this