NETW-2Lesson 2 of 311 min

Layers that wrap each other

Network software is split into layers. Each layer does one job and wraps the data from the layer above with its own information. Knowing the layers tells you what an eavesdropper can see, and what each defence protects.

Four layers

  • Application: what the program wants to say, such as a web request (HTTP) or an email.
  • Transport: gets data to the right program, using ports. TCP checks that every piece arrives, in order; UDP is quicker and does not check, which suits video calls.
  • Internet: gets the packet to the right device anywhere in the world, using IP addresses.
  • Link: gets the packet across one hop, such as Wi-Fi from your laptop to the router.
Figure NETW-2.1Building a packet from the inside out

1. application: what the program wants to say

HTTP: the web request itself

Request
POST /login
Site
results.college.example
Form data
user=priya.s & password=​Lotus⁠-⁠river⁠-⁠42
1/5

Networking is split into layers. Each layer does one job and relies on the layer below. Start with the innermost: the web request itself, from the application layer.

Step 1 of 5

Each layer wraps the one above

Encryption fits into this picture too. TLS sits just above transport: it encrypts the application data, so devices along the way can read the addresses and ports they need for delivery, but not the contents.

The seven-layer model

Books and exams often use the OSI model, which splits the same work into seven layers: physical, data link, network, transport, session, presentation and application. The four-layer model above groups them more simply. The ideas are the same.

Lab: the packet viewer

Lab NETW-L1Open a packet, layer by layer

Priya signs in to her college portal over café Wi-Fi. Open her packet one layer at a time, first over http and then over https, and see what someone on the same Wi-Fi could read.

one packet on café Wi-Fi · http

Wi-Fi frame: from your laptop to the router

From device
laptop's network card
To device
café router

IP packet: across the internetCLOSED

Layer 1 of 4 is open. Each layer wraps the one inside it.

NETW-2 counts as completed once you step through the figure to its last step.