How DNS works in five minutes
A plain-language explanation of how a name like example.com becomes an IP address, and the DNS records every admin should know.
Computers talk to each other using IP addresses, but people use names. DNS (Domain Name System) is the system that translates one into the other. Many “the internet is down” problems are really DNS problems, so it is worth understanding.
What happens when you open a website
When you type learn.example.com:
- Your computer checks its own cache for a recent answer.
- If it has none, it asks a recursive resolver, usually run by your ISP, your company or a public provider.
- The resolver asks a root server, which points it to the servers for the top-level domain (
.com). - The
.comservers point it to the authoritative name servers forexample.com. - Those servers give the final answer: the IP address.
- The resolver returns the answer to your computer and caches it, so the next request is quick.
TTL: why changes take time
Each DNS answer carries a TTL (time to live), in seconds. It tells caches how long they may keep the answer. If you change a record with a TTL of 3600, some users may still see the old value for up to an hour. Lowering the TTL before a planned change makes it take effect sooner.
Records every admin should know
| Record | Purpose | Example |
|---|---|---|
| A | Name to IPv4 address | www points to 203.0.113.10 |
| AAAA | Name to IPv6 address | www points to 2001:db8::10 |
| CNAME | Alias to another name | blog is an alias for www |
| MX | Where to deliver email | mail servers for the domain |
| TXT | Free text, used for SPF, DKIM and verification | v=spf1 ... |
| NS | Which servers are authoritative | ns1.example.net |
Try it yourself
On Windows, macOS or Linux:
nslookup example.com
On macOS or Linux, dig gives more detail:
dig example.com A
dig example.com MX
Ask a specific server by adding it at the end, for example nslookup example.com 1.1.1.1. Comparing answers from different servers is a handy way to find out whether a problem is local or wider.
Where it goes wrong
- Wrong DNS server configured on a PC or over a VPN, so internal names do not resolve.
- Stale cache: clear it with
ipconfig /flushdnson Windows. - Missing or wrong record, often after a migration.
- Slow propagation, when a long TTL keeps the old answer alive.
Next, you can read how to check whether a VPN problem is DNS, routing or authentication.