← Back to the map

Unit 1 · Lesson 1

Network layers and IP addresses

When you load a web page, your request is chopped into packets that might each take a different path across the planet. They still arrive and get put back together. Who's in charge of that?

By the end you can

Watch

Prefer reading? The same lesson is written out below.

Networking is built in layers. Each layer does one job and trusts the layer below it to do its job. You'll hear about the 7-layer OSI model, but in practice four layers matter:

LayerJobExamples
ApplicationWhat the programs are sayingHTTP, DNS, SMTP
TransportGetting data between two programs, reliably or quicklyTCP, UDP
NetworkGetting packets between two machines across many networksIP
LinkGetting bits across one physical hopWi-Fi, Ethernet

When you send a request, each layer wraps the data from the layer above in its own envelope, like putting a letter in an envelope, then in a box, then on a truck. The other side unwraps them in reverse. You'll often hear "layer 4" (transport) and "layer 7" (application), for example for load balancers. Those numbers come from the 7-layer OSI model, where transport is layer 4 and application is layer 7.

IP addresses

Every machine on a network has an IP address, like 198.51.100.14 (IPv4) or 2001:db8::1 (IPv6). IPv4 has only about 4.3 billion addresses, which ran out years ago; IPv6 has more than we'll ever need.

Wi-FiLaptopHome routerISP routersBackboneServer
A laptop on home Wi-Fi sends packets to its home router, which forwards them through several internet routers to a server. Each packet carries the source and destination IP address.

A packet carries a source and a destination address. Routers pass it along, one hop at a time. No router knows the whole path; each one only knows which neighbour is closer to the destination. Packets from the same request can take different routes, and the receiving side puts them back in order (that's the transport layer's job).

Private addresses and NAT

Your laptop probably has an address like 192.168.1.20. That's a private address: it only means something inside your home network, and millions of homes use the same ones. Your home router has one public address and uses NAT (network address translation) to swap the private address for its public one on the way out, and back on the way in.

So the server sees your router's public address, not your laptop's. The same idea is used inside data centres: servers talk over private addresses, and only a few machines (like load balancers) face the internet.

Key idea: application, transport, network and link layers each do one job. IP addresses identify machines; routers move packets hop by hop. Private addresses stay inside a network, and NAT maps them to a public one.

Check yourself

Order the layers from the top (closest to your app) to the bottom (closest to the wire).

  1. 1Link (Wi-Fi, Ethernet)
  2. 2Transport (TCP/UDP)
  3. 3Network (IP)
  4. 4Application (HTTP)

Your new flashcards

Practice them now. With a free account they come back in your daily review.

Card 1 of 3