Networks, layers and packets

Unit 4 of 5 in How computers and the internet work.

You will be able to name the four layers of the internet protocol suite and say what each does.

Lesson

Layers: each one has one job

Networks work because the job is split into layers, and a host (any computer on the network) implements at least one protocol from each. RFC 1122 lists four. The link layer talks on the directly connected network. The internet layer moves data from a source host to a destination host. The transport layer provides end-to-end communication for applications. The application layer is the top, where the protocols users care about live.

A useful habit: when something on a network fails, ask which layer it failed at. That one question narrows most problems.

The internet layer: IP moves datagrams

The Internet Protocol transmits blocks of data called datagrams from sources to destinations, where each side is a host identified by a fixed-length address. It also fragments and reassembles long datagrams when a network can only carry small ones. Choosing the path is called routing.

IP makes no promise of delivery. RFC 1122 says datagrams may arrive damaged, duplicated, out of order or not at all, and that the layers above IP are responsible for reliability.

The transport layer: TCP and UDP

There are two main transport protocols. TCP is connection-oriented and gives applications a reliable, in-order stream of bytes. It does that by detecting losses with sequence numbers, detecting errors with checksums, and fixing problems by retransmitting. UDP is connectionless: it sends individual datagrams with no such guarantees.

So IP is the postal system that may lose a letter, and TCP is the agreement on top that numbers the pages and asks for a resend of any that go missing.

Packets inside packets

TCP delivers its data in segments, and each segment is sent as an IP datagram, so a TCP segment travels inside an IP datagram. A packet capture, like the one in this unit's lab, lets you see those layers one inside the other.

Key points

Sources

Practice in the labs

Look at your own network, then watch a connection being set up packet by packet.

Knowledge check

  1. Which layer is responsible for moving data from a source host to a destination host across networks? Answer: Internet layer. RFC 1122 says all Internet transport protocols use IP, at the internet layer, to carry data from source host to destination host.
  2. IP datagrams may arrive damaged, duplicated, out of order or not at all. Who makes delivery reliable? Answer: The layers above IP, such as TCP. RFC 1122 states IP gives no end-to-end guarantee and the layers above are responsible. TCP adds reliability using sequence numbers, checksums and retransmission.
  3. What is the main difference between TCP and UDP? Answer: TCP is reliable and ordered; UDP sends independent datagrams with no such promise. TCP provides a reliable, in-order byte stream; UDP is a connectionless datagram service (RFC 9293, RFC 1122).

Back to the syllabus or see all classes.

Related