# 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.

URL: https://levelrail.com/learn/troubleshooting/fix-a-domain-that-does-not-resolve/
Updated: 2026-11-27

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](https://levelrail.com/learn/domains-https/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

```bash
dig app.example.com A
```

Read the header line `status:` and the `ANSWER SECTION`:

- `NOERROR` with an answer: DNS is fine from this resolver. If your browser still fails, the problem is local (Step 7).
- `NOERROR` with 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:

```bash
dig @1.1.1.1 app.example.com A +short
dig @8.8.8.8 app.example.com A +short
```

## Step 2: Trace the delegation

```bash
dig +trace app.example.com A
```

This 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

```bash
dig NS example.com +short
dig NS example.com @a.gtld-servers.net
```

The 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](https://levelrail.com/learn/domains-https/point-a-domain-at-your-server/)).

## Step 4: Check that the nameservers answer

Ask each nameserver from Step 3 directly:

```bash
dig @ns1.example-dns.net app.example.com A +norecurse
```

Replace 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

```bash
whois example.com
```

Look 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:

```bash
dig app.example.com A +cd
```

If 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:

```bash
sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder
```

On 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](https://levelrail.com/learn/domains-https/dns-propagation-and-ttl/)).

## Check it worked

```bash
dig @1.1.1.1 app.example.com A +short
curl -I https://app.example.com
```

You 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.com` returns 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

```bash
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.com
```

## Related lessons

- [Check DNS with dig](https://levelrail.com/learn/domains-https/check-dns-with-dig/)): read each section of dig output.
- [DNS record types explained](https://levelrail.com/learn/domains-https/dns-record-types-explained/)): A, AAAA, CNAME, NS and when to use each.
- [DNS propagation and TTL](https://levelrail.com/learn/domains-https/dns-propagation-and-ttl/)): why changes appear at different times.
- [Point a domain at your server](https://levelrail.com/learn/domains-https/point-a-domain-at-your-server/)): the records and nameserver steps in order.
- [Fix Let's Encrypt certificate errors](https://levelrail.com/learn/troubleshooting/fix-lets-encrypt-certificate-errors/)): certificates fail when DNS is wrong.

## Next

Continue with [Fix permission denied on a Docker volume](https://levelrail.com/learn/troubleshooting/fix-permission-denied-on-a-docker-volume/)).

## 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

- [Cloudflare Learning, what is DNS](https://www.cloudflare.com/learning/dns/what-is-dns/)
