← All lessons
DNS, HTTP and other protocols · Lesson 1 of 7

DNS lookups

Computers connect with IP addresses, but people remember names. DNS (the Domain Name System) turns one into the other. It's a huge, shared directory, split up so that no one computer has to hold all of it.

Names are read right to left. In www.quackgames.net, the top-level domain (TLD) is net, quackgames is the domain registered under it, and www is a name inside that domain. At the very top, above every TLD, is the root.

When you visit a site, your computer asks a recursive resolver (often run by your internet provider, or a public one like 1.1.1.1). If the resolver doesn't already know, it does the legwork: it asks a root server, which says who handles .net; it asks a .net server, which says who handles quackgames.net; and it asks that domain's authoritative server, which gives the actual address. The resolver passes the answer back to you.

Doing that for every page would be slow, so answers are cached: by the resolver, by your operating system and by your browser. Every answer comes with a TTL in seconds saying how long it may be kept. That's why a changed DNS record can take a while to reach everyone.

DNS mostly uses UDP on port 53: a small question and a small answer, no connection needed. Many browsers can now also send DNS over HTTPS, so others on the network can't read or change the lookups.

Practice

Your resolver doesn't know quackgames.net yet. Order who it asks.

  1. Tap the items below in order.
More info

Quick reference

DNSNames → IP addresses.
TLDThe last label: .com, .net, .uk.
Recursive resolverDoes the lookup for you and caches it.
Root → TLD → authoritativeThe chain a resolver follows.
TTLSeconds an answer may be cached.
Port 53DNS, mostly over UDP.

The other networking courses