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:
- Recursive resolvers receive the question from your device and track down the answer by asking the other servers on this list.
- Root nameservers sit at the top of the hierarchy. They don’t know where
example.comis, but they know which servers run.com. - Top-level domain (TLD) nameservers handle endings such as
.com,.organd.net, and point to the nameservers each domain has chosen. - 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:
- Check the local cache. Your browser and operating system look for a recent answer they’ve already stored.
- Ask the resolver. If there’s nothing cached, the question goes to your recursive resolver.
- 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.
- Ask the TLD server. The
.com(or.org, and so on) server replies with the domain’s authoritative nameservers. - Ask the authoritative server. The domain’s own nameserver returns the record that was requested, such as its IP address.
- Cache and reply. The resolver stores the answer for its TTL and passes it back to your device.
- 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:
- Recursive query: “Get me the final answer.” Your device sends this to its resolver, which must come back with the record or an error, doing all the legwork in between.
- Iterative query: “Tell me what you know.” The resolver sends these to root, TLD and authoritative servers, each of which replies with an answer or a referral to the next server to try.
- Non-recursive query: a question the server can answer straight away, either from its cache or because it’s authoritative for the domain, with no further lookups needed.
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.
- IP address:
nslookup example.comordig example.com A(useAAAAfor IPv6). - Nameservers:
nslookup -type=ns example.comordig example.com NSshows which authoritative servers the domain uses. - Mail servers:
nslookup -type=mx example.comordig example.com MX. Swapmxfor any other record type, such astxtorcaa. - Straight from the source: add a nameserver to the end, as in
nslookup example.com ns1.example.netordig @ns1.example.net example.com, to ask an authoritative server directly and skip any cached answers. - Reverse lookup:
nslookup 192.0.2.10ordig -x 192.0.2.10finds the name, if any, published for an IP address.
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:
- Turn on DNSSEC (DNS Security Extensions), which signs your records so resolvers can confirm they haven’t been tampered with on the way.
- Lock down your accounts. Use strong, unique passwords and multi-factor login at your registrar and DNS host, and ask your registrar about a registry lock for important domains.
- Choose a reliable provider that runs nameservers in several locations and on more than one network, so a single outage or attack can’t take your domain offline.
- Filter and monitor. DNS filtering can block known malicious domains on your network, and watching your records and query patterns helps you spot unexpected changes early.
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.