Card 02/ 11
DNS: Turning a Domain Name Into an Address
Before any request reaches you, a lookup decides where it goes, and the answer is cached.
DNS, the Domain Name System, turns a name such as shop.example.com into an IP address, the number that identifies a server on the internet. Every request to your site starts with that lookup, and its answer is cached along the way, which is why changing where a name points never takes effect everywhere at once.
An analogy, and where it breaks. DNS works like the contacts list on a phone: you choose a name, and the phone dials the number stored against it. The analogy breaks on one point. A contact stays until you change it, while a DNS answer carries a TTL, a time to live, after which every copy of it expires and must be looked up again.
How a lookup works. The browser asks a resolver, usually run by the internet provider or a service such as Cloudflare's 1.1.1.1. If the resolver has no fresh answer, it asks a root server, which points it to the servers for .com, which point it to the authoritative server for example.com, the one that holds the real record. The resolver caches the answer for its TTL, so the next reader who asks gets it at once.
What the TTL decides. A long TTL means fewer lookups and faster first requests, but a change to the record takes that long to reach everyone. A short one means changes spread quickly, at the price of more lookups. Cloudflare's default TTL, which it calls Auto, is 300 seconds. Before moving a site to a new address, teams lower the TTL a day ahead, so the old answer expires quickly once they switch.
What it is not. DNS does not carry your traffic or route requests between servers; it answers one question, where is this name, and steps aside. Products that play the part include Amazon Route 53 and Cloudflare DNS.
So treat every DNS change as one that arrives slowly: the TTL on the old answer decides how long readers keep going to the old address.
← → move through sections and cards