Every time you open a website, send an email or connect an app to a server, a DNS lookup happens first. It takes a few milliseconds and you never see it, but when it goes wrong, nothing else works: the site doesn't load, mail bounces, and certificates fail to renew.
This guide explains what DNS is, how a lookup travels from your browser to the right server, what each common record type does, and how TTL and caching decide how quickly your changes take effect. By the end you will be able to read a DNS zone, test it from the command line, and diagnose the most common problems yourself.
What DNS does, and why it exists
Computers address each other with IP addresses, such as 203.0.113.10 (IPv4) or 2001:db8::10 (IPv6). People prefer names. The Domain Name System is the distributed database that translates one into the other.
There are two good reasons this is a separate system rather than a hard-coded list:
- Addresses change. When you move a website to a new server, you update one record and every visitor follows. Nobody needs to learn a new address.
- Scale. There are hundreds of millions of domains. No single server could answer every question, so the work is split across a hierarchy of servers, each responsible for its own part of the name space.
DNS does more than websites. It tells the world where to deliver email, proves you own a domain to services like Google, and publishes the security policies that stop others sending mail in your name.
The DNS hierarchy
DNS is organised as a tree, mirroring how domain names are built from right to left:
- Root servers sit at the top. They don't know where
example.comis, but they know who runs.com. - TLD servers handle each top-level domain, such as
.com,.euor.nl. They know which nameservers are responsible forexample.com. - Authoritative nameservers hold the actual zone for a domain: the records that say which IP the website uses, where mail goes, and so on.
When you register a domain and choose its nameservers, the registry publishes that delegation in the TLD servers. That is the link between the domain and the zone you edit.
How a DNS lookup works
Here is what happens when you type www.example.com into a browser:
- The browser and operating system check their own caches. If they have a fresh answer, they use it.
- Otherwise the question goes to a recursive resolver, usually run by your ISP, your company or a public service.
- If the resolver has no cached answer, it asks a root server, which refers it to the
.comservers. - The
.comservers refer it to the authoritative nameservers forexample.com. - The authoritative server returns the record, for example the IP address.
- The resolver caches the answer for as long as the record's TTL allows and returns it to your device.
You can watch every step yourself with dig +trace:
dig +trace www.example.com
dig +short www.example.com A
dig @1.1.1.1 example.com MX
On Windows, nslookup or PowerShell gives you the same information:
nslookup -type=MX example.com
Resolve-DnsName example.com -Type AAAA
The DNS record types you will actually use
A zone is a list of records. Each record has a name, a TTL, a type and a value. These are the ones you will meet most often:
| Type | Purpose | Example value |
|---|---|---|
| A | Points a name to an IPv4 address | 203.0.113.10 |
| AAAA | Points a name to an IPv6 address | 2001:db8::10 |
| CNAME | Makes a name an alias for another name | example.com. |
| MX | Names the mail server for the domain, with a priority | 10 mail.example.com. |
| TXT | Free text: SPF, DKIM, DMARC, ownership verification | "v=spf1 mx -all" |
| NS | Lists the authoritative nameservers for the zone | ns1.example.net. |
| SOA | Administrative data for the zone, such as the serial number | (generated by the DNS host) |
| CAA | Limits which certificate authorities may issue SSL certificates | 0 issue "letsencrypt.org" |
| PTR | Reverse DNS: maps an IP address back to a name | mail.example.com. |
A few rules that trip people up:
- A CNAME can't share its name with other records. That's why the bare domain (
example.com) uses A/AAAA records, whilewwwis often a CNAME. - MX records must point to a hostname, never directly to an IP address or a CNAME.
- PTR records are controlled by whoever owns the IP address, which for a server is the hosting provider, not your domain's DNS zone. They matter mostly for mail servers.
TXT records do a lot of security work for email. If you send mail from your domain, read What are SPF, DKIM and DMARC? next.
TTL and caching
Every record carries a TTL (time to live) in seconds. It tells resolvers how long they may keep a cached copy before asking again.
- A high TTL (for example 86400, one day) means fewer lookups and slightly faster responses, but changes take longer to reach everyone.
- A low TTL (for example 300, five minutes) lets changes spread quickly, at the cost of more queries.
A sensible default for most records is 3600 (one hour). Before a planned server move, lower the TTL on the records you will change to 300, wait at least as long as the old TTL, make the change, and raise it again afterwards.
Tip: You can see the remaining TTL of a cached answer in the second column of
digoutput. Run the same query twice and you will see the number counting down.
What "propagation" really means
People talk about DNS changes "propagating", as if they slowly travel across the internet. In reality the change is live on your authoritative nameservers the moment you save it. What takes time is resolvers around the world letting their old cached copies expire.
That has two practical consequences. First, you can check your change immediately by asking the authoritative server directly:
dig +short NS example.com
dig @ns1.example.net example.com A
Second, if the authoritative answer is correct and your browser still shows the old server, the problem is caching somewhere between you and the nameserver, not your zone. Flush your local cache or test from another network.
Nameserver changes are the slowest kind, because the delegation in the TLD zone has its own TTL, set by the registry and often a day or more.
Common DNS problems
- The old website still appears. A cached record, or a leftover AAAA record pointing to the old server while you only updated the A record.
- The domain doesn't resolve at all. The domain has expired, the nameservers are wrong, or the zone has no record for that name.
- Email stopped after a change. MX, SPF or DKIM records were lost when moving the zone to new nameservers.
- Your changes have no effect. You edited the zone at a provider that isn't authoritative. Check the NS records first to see where DNS is really managed.
If your site is down and you are not sure DNS is the cause, our guide Website not working? walks through the other suspects too.
In short
DNS is a distributed, hierarchical database that turns names into addresses. Resolvers find the answer by walking from the root to the TLD to your authoritative nameservers, then cache it for the record's TTL. The records you will use most are A, AAAA, CNAME, MX and TXT. When something looks wrong, ask the authoritative server first: if it is right, you are only waiting for caches to expire. Ready to put this into practice? See How to point your domain to your VPS or web hosting.
DNS and domains at Hostigan
Hostigan registers domains and runs the hosting they point to, from cPanel web hosting to VPS and dedicated servers, all with always-on DDoS filtering. Find an available name on our domains page.
Frequently asked questions
A record change is live on your nameservers immediately. Other resolvers see it once their cached copy expires, which depends on the TTL, typically minutes to a few hours. Nameserver changes can take up to a day or two.