Computers find each other by numbers. People prefer names. DNS, the Domain Name System, translates between the two, millions of times a second, without anyone noticing.
It works like the contacts app on a phone. You tap "Anna", and the phone looks up her number. You type a domain, and DNS looks up the server's address. The difference: no single computer holds the whole internet's list. It is spread over many servers, each responsible for its own part.
What a domain name is made of
Read a name from right to left. In www.northwind.example:
exampleis the top-level domain (TLD), like.com,.deor.uk. (.exampleis reserved for teaching, so it never belongs to a real company.)northwindis the name an organisation registers under that TLD.wwwis a subdomain the organisation sets up itself. It could just as well beshopormail.
One lookup, step by step
One lookup, step by step
- 1Those servers answer with the address
- 2The browser connects to that address
- 3The resolver passes the address back and remembers it for a while
- 4It asks its resolver, usually run by your internet provider or your network
- 5The resolver asks a root server who handles .com
- 6The .com servers name the servers responsible for example.com
- 7The computer checks its own memory and finds no saved answer
- 8You type example.com and press Enter
The parts in this chain have names:
The resolver does the asking on your behalf. Your home router, school network or internet provider tells your device which resolver to use. Some people choose a public resolver instead.
The root servers are the top of the system. They do not know any addresses of websites, only who runs each top-level domain. There are 13 named root server identities, each copied to many places around the world.
The TLD servers know who is responsible for each domain under their ending.
The authoritative name servers hold the domain's actual records. They are the ones listed in the domain's NS records.
Most lookups never go all the way up. Your computer, your router and the resolver all remember recent answers, so the second visit to a site is answered from memory in a fraction of a second.
The records worth knowing
Record | What it holds | Example value |
|---|---|---|
A | An IPv4 address | 203.0.113.10 |
AAAA | An IPv6 address | 2001:db8::10 |
CNAME | Another name this one is an alias for | shop.example.net |
MX | The servers that receive email | 10 mail.example.com |
TXT | Text, such as SPF rules or ownership proofs | v=spf1 include:... ~all |
NS | The servers responsible for the domain | ns1.example.com |
The example addresses come from ranges reserved for documentation, so they never point at a real server.
A and AAAA are the most common records. IPv4 addresses like 203.0.113.10 have run short, so newer IPv6 addresses (AAAA, "quad A") are much longer. Many domains have both.
CNAME says "this name is another name". If
www.northwind.exampleis a CNAME fornorthwind.example, the resolver looks up the second name and uses its address. A name with a CNAME cannot have any other records, which is why the bare domain itself usually cannot be a CNAME.MX records come with a number, the priority. Lower numbers are tried first: a server with priority 10 is preferred over one with 20, which acts as a backup. An MX record must name a server, not an IP address.
TXT records hold text for other systems to read. Email security records live here (see the guide to SPF, DKIM and DMARC), and many online services ask you to add a TXT value to prove that you own a domain.
NS records name the authoritative servers. Changing them moves the whole domain to another DNS provider.
Good to know as well: PTR records work the other way round and turn an IP address back into a name (mail servers check them), and CAA records say which certificate authorities may issue HTTPS certificates for the domain.
Why changes take time: the TTL
Every record has a TTL (time to live), in seconds. It tells resolvers how long they may keep the answer before asking again.
Worked example: Northwind's A record has a TTL of 3600 seconds, which is one hour. At 10:00 the company moves its website to a new server and changes the A record. A resolver that looked up the name at 9:55 keeps the old address until 10:55. Some visitors reach the new server at once, others only up to an hour later. With a TTL of 86,400 seconds (one day), the change could take a day to reach everyone.
This is what people mean when they say a DNS change "takes time to propagate". Nothing travels; old copies simply expire. Before a planned move, administrators lower the TTL a day in advance, so the switch itself spreads quickly.
Look it up yourself
On Windows, macOS and Linux, a terminal can ask DNS directly with nslookup.
nslookup -type=MX example.comnslookup example.com
nslookup -type=AAAA example.com
nslookup -type=TXT example.com
nslookup -type=NS example.comOn macOS and Linux, dig example.com MX gives the same answer with more detail, including the TTL. For MX records without a terminal, use the Mailbox Provider Checker, which looks up the MX records and names the provider behind them.
When you read the output, look for three things: the server that answered (your resolver), whether the answer is "non-authoritative" (it came from a cache, which is normal), and the records themselves.
Common mistakes
Expecting changes to show at once. Old answers stay in caches until their TTL runs out.
Mixing up three different services. The registrar is where the domain was bought, the DNS host answers the lookups, and the web host runs the website. They can be three different companies.
A CNAME on the bare domain. It clashes with the NS and other records the domain needs. Use an A record there, or a special alias feature of the DNS host.
An MX record that points to an IP address. It must name a server, which then has its own A or AAAA record.
Two SPF records. A domain may have only one TXT record that starts with
v=spf1; with two, the check fails.Blaming DNS for everything. If one site does not load but others do, the problem is more often the site than DNS.
Is DNS private and safe?
Classic DNS questions travel unencrypted, so the network you use can see which names you look up. Many browsers and systems can now send lookups encrypted (DNS over HTTPS). A separate extension, DNSSEC, lets a domain sign its records so resolvers can detect forged answers. Not every domain uses it.
Check yourself
1.What does a resolver do?
2.What do the root servers know?
3.A domain has two MX records: priority 10 and priority 20. Which server is tried first?
4.An A record has a TTL of 3600. What does it mean?
5.A company changes its A record. Why do some visitors still reach the old server for a while?
6.Which record would you look up to find out who receives email for a domain?
7.Where do email security rules such as SPF live in DNS?
Practise the record types with the DNS record types exercise.
