Fix a domain that does not resolve
A domain that does not resolve returns NXDOMAIN, SERVFAIL or an empty answer, and dig +trace shows which step of the lookup broke so you know whose settings to fix.
- Updated Nov 27, 2026
- Markdown
Tell NXDOMAIN, SERVFAIL and empty answers apart, find the broken hop with dig, and fix the record, delegation or cache.
- A domain that fails to load or resolve
- A terminal with dig installed
Where a lookup fails when a domain does not resolve
- Your machine asks the resolver, which may answer from a cache.
- The resolver asks the registry which nameservers the domain uses.
- If the domain expired or has no nameservers set, the lookup stops here with NXDOMAIN.
- The resolver asks your nameserver for the record.
- A missing record or a broken zone gives an empty answer or SERVFAIL.
- dig +trace shows which hop failed, so you know whose settings to fix.
Static diagram
- Youexample.com?Resolver
- Resolverwho is authoritative?Registry
- RegistryNS listResolver
- ResolverA record?Your nameserver
- Your nameserverno answerResolver
- ResolvererrorYou
You open app.example.com and the browser says the site cannot be found, or dig returns status: NXDOMAIN or status: SERVFAIL. The name is not turning into an IP address. The cause sits in one of a few places: the record, the delegation at your registrar, the authoritative nameservers, the domain’s registration, or a cache on your side. dig can tell you which one in a few commands.
How it works#
DNS is a chain of delegations. The root servers know who runs .com. The .com registry knows which nameservers the registrar listed for example.com. Those nameservers hold the records, such as the A record that gives your server’s address. A resolver walks that chain and caches what it learns. The pieces are described in DNS record types explained.
A failure at each hop looks different. A missing registry entry or an unregistered name gives NXDOMAIN from the top. A broken nameserver or a validation failure gives SERVFAIL. A name that exists but has no record of the type you asked for gives NOERROR with an empty answer. Knowing the three apart saves most of the debugging.
Step 1: Ask a public resolver#
dig app.example.com ARead the header line status: and the ANSWER SECTION:
NOERRORwith an answer: DNS is fine from this resolver. If your browser still fails, the problem is local (Step 7).NOERRORwith no answer section: the name exists, but there is no A record. Add one.NXDOMAIN: the name does not exist in the zone, or the domain is not delegated.SERVFAIL: the resolver could not get a valid answer.
Compare with a second resolver to rule out a bad one:
dig @1.1.1.1 app.example.com A +short
dig @8.8.8.8 app.example.com A +shortStep 2: Trace the delegation#
dig +trace app.example.com AThis follows the lookup from the root servers to the TLD servers to your domain’s nameservers. Read it from the top. The last block should come from your nameservers and include the A record. If the trace stops after the TLD with no example.com nameserver lines, the delegation is missing. If it reaches your nameservers but they do not answer or answer without data, the zone there is wrong.
Step 3: Check the nameservers the registry knows#
dig NS example.com +short
dig NS example.com @a.gtld-servers.netThe first shows what resolvers see. The second asks a .com registry server directly (use the correct TLD server for your domain, which +trace prints). The nameservers listed must be the ones where you edit records. A common story: you moved DNS to a new provider and created all the records there, but the registrar still lists the old nameservers, so the new zone is never consulted. Change the nameservers at the registrar and wait for the old NS records’ TTL to pass. See point a domain at your server.
Step 4: Check that the nameservers answer#
Ask each nameserver from Step 3 directly:
dig @ns1.example-dns.net app.example.com A +norecurseReplace the name with one of your nameservers. A proper answer includes the aa flag (authoritative answer) and your record. A timeout, a refusal, or an answer without aa suggests a lame delegation: the nameserver is listed but does not host the zone. Create the zone at that provider, or remove the stale nameserver from the list.
Step 5: Check that the domain has not expired#
whois example.comLook at the status and expiry lines. An expired domain may stop resolving after a grace period, and the registrar may put placeholder nameservers on it. The output format varies by registry. Renewing at your registrar is the fix, and it can take a while to propagate. Also check for a registrar hold, such as an unverified contact email, which can suspend a domain.
Step 6: Think about DNSSEC carefully#
If dig shows SERVFAIL on resolvers like 1.1.1.1 and 8.8.8.8 but the authoritative servers answer fine, DNSSEC validation may be failing. Test by asking a resolver to skip validation:
dig app.example.com A +cdIf that returns an answer while the normal query fails, validation is the problem. The typical cause is a DS record left at the registrar after you moved DNS providers, so it points at keys the new provider does not publish. Remove the DS record at the registrar, or enable DNSSEC properly at the new provider and publish its DS. Do this with care and one change at a time, because a wrong DS can take the whole domain offline for validating resolvers.
Step 7: Rule out local caches#
If public resolvers answer but your machine does not, flush local caches. On macOS:
sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponderOn a systemd-resolved Linux machine: sudo resolvectl flush-caches. Check /etc/hosts for an old override, and test with dig @1.1.1.1 to bypass your router. A resolver may also cache a negative answer for a while, so a record you just added can take time to show for those who looked up the missing name first. See DNS propagation and TTL.
Check it worked#
dig @1.1.1.1 app.example.com A +short
curl -I https://app.example.comYou should get your server’s IP, for example 203.0.113.10, and an HTTP response. Check from a second network, such as a phone on mobile data, to be sure it is not only your cache.
Prevent it#
- Turn on auto-renew at the registrar and keep the contact email current.
- When you change DNS providers, change nameservers first and handle DNSSEC records deliberately.
- Keep two or more nameservers, and monitor the domain from outside.
Edge cases and gotchas#
- Typos in the name:
www.exmaple.comreturns NXDOMAIN, and the fix is in the browser bar. - CNAME at the root: A CNAME cannot sit beside other records at the zone apex, and some providers reject or flatten it.
- Trailing dots in zone files: A name without a final dot gets the zone appended, producing
app.example.com.example.com. - Split DNS: An internal resolver may answer differently from public ones. Compare both.
- TTL on the old record: Changing a record shows slowly for those who cached the old one for its full TTL.
- Search domains: Your OS may append a search suffix, so test with the full name and a trailing dot.
Troubleshooting#
| Symptom | Likely cause | Fix |
|---|---|---|
| NXDOMAIN for the whole domain | Domain expired or not delegated | Renew it, set nameservers at the registrar |
| NXDOMAIN only for one subdomain | Record missing | Add the record at the zone provider |
| NOERROR, no answer | No record of that type | Add an A or AAAA record |
SERVFAIL, +cd works | DNSSEC validation failure | Fix or remove the DS record at the registrar |
| SERVFAIL, nameserver times out | Lame or unreachable nameserver | Fix or remove that nameserver |
| Works on phone, not laptop | Local cache or router resolver | Flush cache, test with dig @1.1.1.1 |
Quick reference#
dig app.example.com A
dig +trace app.example.com A
dig NS example.com +short
dig @1.1.1.1 app.example.com A +short
dig app.example.com A +cd
whois example.comRelated lessons#
- Check DNS with dig: read each section of dig output.
- DNS record types explained: A, AAAA, CNAME, NS and when to use each.
- DNS propagation and TTL: why changes appear at different times.
- Point a domain at your server: the records and nameserver steps in order.
- Fix Let’s Encrypt certificate errors: certificates fail when DNS is wrong.
Next#
Continue with Fix permission denied on a Docker volume.
Check what you learned
Frequently asked questions
What does NXDOMAIN mean?
NXDOMAIN means the name does not exist according to the authoritative nameserver. Either the record is missing, the name is misspelled, or the domain itself is not registered or delegated.
What does SERVFAIL mean in dig?
The resolver could not get a valid answer. Common causes are broken nameservers, a lame delegation, or DNSSEC validation failing. It is a server-side failure, not a missing record.
Why does my domain work on my phone but not my laptop?
Your laptop or router probably caches an old or failed answer, or uses a different resolver. Query a public resolver with dig @1.1.1.1 and flush the local cache.
How long does DNS take to update?
It depends on the record's TTL and on caches that already hold the old answer. A new record with no cached negative answer is often visible at once, while a change can take as long as the old TTL.
Sources
Keep going: guides and tutorials
- Docker Container Restarting in a Loop: 5 Causes, Fixed Five real reasons a Docker container keeps restarting, each reproduced with its exit code, the command that finds it and the fix. Then the same crash on Levelrail.
- Our Health Check Failed and the Deploy Went Live Anyway A postmortem from our own dogfood run: a failed readiness probe still received traffic. What broke, why two correct parts added up to a bug, and the fix.
- Roll Back a Failed Docker Deploy Without Downtime Ship a broken release on purpose, watch your users stay on the old version, then roll back with one command. Real commands, real output, self-hosted.