DNS EXPLAINED

What is DNS?

How a name like example.com becomes the address your browser connects to, which servers take part, and how to check, fix and protect it.

The short version

  • DNS (the Domain Name System) translates names people can remember, like example.com, into the numeric IP addresses computers use to reach each other.
  • No single server knows every name. The answer is found by asking a chain of servers, each responsible for one part of the name.
  • A recursive resolver does the asking on your behalf; an authoritative nameserver holds the final answer for a domain.
  • The whole lookup usually takes a few milliseconds, and answers are cached so most lookups are even faster.

DNS in a nutshell

Every device on the internet is reached by an IP address, such as 93.184.215.14 or 2606:2800:21f:cb07:6820:80da:af6b:8b2c. Those numbers are hard to remember and can change, so we use domain names instead. DNS is the system that connects the two: you ask for a name, and it tells you the address. It’s often compared to the internet’s address book.

Rather than keeping every name in one central list, DNS is a hierarchy spread across millions of servers around the world. Each organization looks after its own part of the namespace. That split is what lets DNS handle billions of lookups a day and keep working when individual servers fail.

The servers involved

A DNS server stores, or knows how to find, the records that link domain names to IP addresses and other information. Four kinds of server share the work of answering a lookup:

  1. Recursive resolvers receive the question from your device and track down the answer by asking the other servers on this list.
  2. Root nameservers sit at the top of the hierarchy. They don’t know where example.com is, but they know which servers run .com.
  3. Top-level domain (TLD) nameservers handle endings such as .com, .org and .net, and point to the nameservers each domain has chosen.
  4. Authoritative nameservers hold a domain’s actual records and give the final answer. When you host a domain with NSResolver, our nameservers play this role.

Authoritative DNS vs. recursive DNS

Authoritative DNS

An authoritative nameserver is the source of truth for the domains it hosts. It stores their records (A, AAAA, MX, TXT and so on) and answers questions about them directly. It doesn’t go looking for answers elsewhere: if it’s asked about a domain it doesn’t host, it says so. You choose your domain’s authoritative nameservers at your registrar, and the registry publishes that choice in the TLD so the rest of the internet can find them.

Recursive DNS

A recursive resolver works on behalf of the person asking. Your device sends its questions to one, usually run by your internet provider, your employer, or a public DNS service. If the resolver has answered the same question recently, it replies from its cache. If not, it walks the hierarchy (root, then TLD, then authoritative) until it has the answer, returns it to you, and keeps a copy for as long as the record’s TTL (time to live) allows.

How a DNS lookup works, step by step

Here’s what happens between typing a domain into your browser and the page starting to load:

Your device browser + OS 1 checks its cache Website Recursive resolver ISP or public DNS; caches answers Root server top of the tree TLD server runs .com Authoritative holds example.com example.com? 2 93.184.215.14 6 example.com? try .com servers 3 example.com? try ns1.example.net 4 example.com? 93.184.215.14 5 7 connect
Gray arrows are questions, blue arrows are answers. The numbers match the steps below.
  1. Check the local cache. Your browser and operating system look for a recent answer they’ve already stored.
  2. Ask the resolver. If there’s nothing cached, the question goes to your recursive resolver.
  3. Ask a root server. If the resolver doesn’t have the answer either, it asks a root server, which refers it to the right TLD servers.
  4. Ask the TLD server. The .com (or .org, and so on) server replies with the domain’s authoritative nameservers.
  5. Ask the authoritative server. The domain’s own nameserver returns the record that was requested, such as its IP address.
  6. Cache and reply. The resolver stores the answer for its TTL and passes it back to your device.
  7. Connect. Your browser opens a connection to that IP address and loads the site.

Thanks to caching at every level, most lookups skip several of these steps. A full trip through the hierarchy still typically finishes in well under a second.

Kinds of DNS query

A DNS query is simply a question sent to a DNS server. How much work the server is expected to do depends on the kind of query:

How to look up DNS records yourself

Looking up a domain’s records is the quickest way to check a new configuration or work out why something isn’t connecting. nslookup is built into Windows, macOS and Linux; on macOS and Linux, dig gives more detail. Replace example.com with the domain you want to check.

You may see advice to use -type=any to fetch every record at once. Many servers and resolvers no longer answer those queries in full, so it’s more reliable to ask for each record type you need.

Common DNS problems and how to fix them

“DNS server not responding”

Your device couldn’t get an answer from its resolver. The cause is usually a dropped network connection, a router that needs restarting, a firewall or VPN blocking DNS traffic, or the resolver itself being down. Restart your router and device, check any firewall or VPN, and if the problem continues, try a different resolver.

Stale cached answers

Caching makes browsing faster, but it means a change doesn’t reach everyone at once: devices and resolvers keep using the old answer until its TTL runs out. If a site moved to a new IP address and you still land on the old one, clear your browser’s and operating system’s DNS cache. If you’re planning a change, lower the record’s TTL a day or so beforehand so the switch-over is quicker.

Wrong nameservers at the registrar

If records you’ve added never show up, check that your registrar points the domain at the nameservers you’re actually managing. Records on a server the domain isn’t delegated to are never seen by anyone.

Keeping DNS secure

Because nearly every connection starts with a DNS lookup, DNS is an attractive target. In spoofing or cache poisoning, an attacker slips a forged answer to a resolver; in hijacking, they change a domain’s records or nameservers outright. Either way, visitors are quietly sent somewhere they didn’t mean to go, often a lookalike site built to steal passwords. Some practical defences:

Read more about the pros and cons of DNSSEC and DANE.

Where NSResolver fits in

NSResolver provides authoritative DNS: we host your domain’s records on a global anycast network and answer lookups for them. You manage records in the control panel or through the API, and changes reach our nameservers within seconds. See the plans, or sign up for free to get started.