Networking

DNS Resolution Problems: How to Troubleshoot Them Step by Step

DNS resolution problems mean a name such as example.com could not be turned into an IP address. Run nslookup example.com 1.1.1.1 and compare it with plain nslookup example.com: the error text and the difference between the two results tell you whether the fault is the DNS server, the name itself, or your computer.

This guide works from the symptom to the cause. If your error is specifically a timeout, the dedicated article on fixing "DNS server not responding" goes deeper on that one case. Here the aim is to sort out which kind of failure you have, because each kind has a different fix.

First check: is it DNS at all?

A browser error such as "site can't be reached" can come from a dead connection, a dead website or DNS. Separate them with one test: reach something by IP address. On Windows, macOS and Linux alike:

ping 1.1.1.1

If this gets replies, your connection works. Now try a name:

ping example.com

Replies from the IP address but a failure on the name is the signature of a DNS problem. If the IP address fails too, restart the router or check the cable or Wi-Fi first, because no DNS setting will fix a connection that is down. Some networks block ping, so a failed ping to one address is a hint, not proof. Trying a second address or opening a site by IP in a browser confirms it.

What the error tells you

A DNS server can fail in several distinct ways. RFC 1035 defines the response codes a server puts in its reply, and Microsoft's nslookup reference maps them to the messages you see on Windows:

What you seeMeaning (from the sources)Where to look
timed outThe server didn't respond after a certain amount of time and a certain number of retries.The path to the server, or the server itself
No response from serverNo DNS name server is running on the server computer.A wrong server address
Nonexistent domain (RFC code 3, "Name Error")The name does not exist.Typo, expired domain, missing record
Server failure (RFC code 2)The server was unable to process the query due to a problem with the name server.The resolver, or the domain's own DNS
Refused (RFC code 5)The server refuses to perform the operation for policy reasons.The server does not serve your network
No recordsThe name is valid, but there are no records of the type you asked for.You asked for the wrong record type, such as AAAA for a name with only an A record

RFC 1035 also notes that "Name Error" is meaningful only for responses from an authoritative name server. In practice, a resolver passes that answer along to you, which is why "Nonexistent domain" is a reliable sign the name itself is the problem and the server is healthy.

Step 1: Compare your resolver with a public one

The second argument of nslookup chooses the server to ask. In noninteractive mode, Microsoft's documentation says the first parameter is the name to look up and the second is the DNS server to use; with no second parameter, the default server is used.

nslookup example.com
nslookup example.com 1.1.1.1
nslookup example.com 8.8.8.8

On macOS and Linux, dig does the same with an @ prefix for the server:

dig example.com
dig @1.1.1.1 example.com
dig @8.8.8.8 example.com

Read the three results together:

  • Default fails, both public servers work. Your configured server (usually the router, which forwards to your provider) is the problem. Restart the router, or point your computer at a public server using the steps to change your DNS server on Windows.
  • All three fail the same way. The failure is not about your server. If it is "Nonexistent domain" everywhere, the name does not exist. If it is a timeout everywhere, DNS traffic is not getting out: a firewall, VPN or adapter problem.
  • All three work but the application still fails. DNS is fine. Move to the cache and hosts file checks below.
  • Public servers give different answers from each other. A record changed recently and the servers hold different cached copies. This resolves when the old copies expire.

The two tools are covered in more detail in the nslookup and dig guide.

Step 2: Tell NXDOMAIN from SERVFAIL

These two get confused, and the fix differs.

NXDOMAIN is the server saying the name does not exist. Check the spelling first. Then consider whether the domain registration expired, or whether a subdomain (app.example.com) was never created in the domain's DNS zone. If you own the domain, the record has to be added at whoever hosts its DNS. Nothing on your computer changes that answer.

SERVFAIL says the server tried and could not complete the lookup. The RFC describes it as a problem with the name server, and the usual real-world reasons are on the domain's side: its authoritative servers are down, unreachable or misconfigured. Because a different resolver may reach those servers by a different route, query another public resolver:

nslookup example.com 8.8.8.8
nslookup example.com 1.1.1.1

If one resolver returns SERVFAIL and another returns an address, the fault is specific to the first resolver and switching resolvers is a valid workaround. If every resolver returns SERVFAIL, the domain's DNS itself is broken and only its owner can fix it. I can't tell you the cause from the code alone: SERVFAIL is a general failure, so the code narrows the search but does not name one reason.

Step 3: Follow the delegation with dig +trace

When the answer is wrong or failing for everyone, find which server in the chain breaks. The dig manual describes +trace as tracing the delegation path from the root name servers for the name being looked up. It makes iterative queries and shows the answer from each server it uses.

dig +trace example.com

Read the output from the top: the root servers point to the servers for the top-level domain, which point to the domain's own name servers, which give the final record. The step where the output stops, shows an error, or returns an unexpected server list is where the problem sits. A stop at the last step means the domain's name servers are not answering. A wrong list at the second step means the registrar's name server settings are wrong. The manual notes that +trace turns recursion off automatically, and that if you give an @server, that server is used only for the first root query.

Windows has no dig built in. nslookup can query a domain's authoritative server directly if you set the NS record type and then ask that server:

nslookup -type=NS example.com 1.1.1.1

Pick a name server from the answer and run nslookup example.com <that-server>. If it times out or refuses, the authoritative server is the weak point.

Step 4: Check for a stale or wrong answer on your computer

If the public servers give the right address but your computer uses a different one, something local overrides DNS. Look in this order:

  1. The DNS cache. Your system stores answers, including failures, for a period set by each record's time to live. After a record changes, flush the cache. Commands for each system are in how to flush the DNS cache; on Windows it is ipconfig /flushdns.
  2. The hosts file. A line in it overrides DNS for one name. Developers often leave one behind from testing. See how to edit the hosts file and remove any entry for the name that fails.
  3. A VPN or security client. These often set their own DNS servers while connected. Disconnect and test again.
  4. The browser's own DNS setting. A browser can use its own encrypted DNS provider instead of the system's. If the browser fails but nslookup works, check that setting.

Step 5: Rule out blocked or truncated queries

RFC 1035 says name servers are reached over both UDP and TCP on port 53. UDP messages are limited to 512 bytes, and longer ones are truncated with the TC bit set, which tells the client to retry over TCP. The RFC describes that mechanism in 1987 terms, and modern extensions allow larger UDP messages, so treat the 512-byte figure as the baseline, not the current limit. The practical point is that a firewall allowing UDP 53 but dropping TCP 53 can break only some lookups: small answers work and large ones fail. You can test TCP directly:

dig +tcp @1.1.1.1 example.com

The manual says +tcp makes dig use TCP when querying name servers, where UDP is the default. If the TCP query fails while the normal one works, a firewall or network filter is the likely cause. The related options +time and +tries set the timeout (default 5 seconds) and the number of UDP attempts (default 3), which helps when a slow link makes a test look like a failure.

Quick reference: symptom to fix

SymptomMost likely causeFix
Works by IP, fails by nameDNS, not the connectionContinue with step 1
Only your default server failsRouter or provider resolverRestart router, or use a public resolver
Nonexistent domain everywhereName wrong or record missingCheck spelling, or add the record at the DNS host
SERVFAIL on one resolver onlyThat resolver's route or stateUse another resolver
SERVFAIL on all resolversDomain's DNS is brokenContact the domain owner or DNS host
Public servers right, one computer wrongCache, hosts file, VPNFlush the cache, check the hosts file
Some sites fail, small ones workTCP port 53 blockedTest with dig +tcp, review the firewall

If it still fails

Test from a second device on the same network, then from a different network such as a phone on mobile data. If the name resolves on mobile data but not on your home network, the fault lies in your router or provider. If it fails everywhere, the name or the domain's DNS is the problem, and the result of dig +trace shows exactly which server in the chain you should report to the domain's owner. Keep the output of that command: it is the most useful thing to send to a support team.

Frequently asked questions

What causes DNS resolution problems?
A resolution problem means a name could not be turned into an IP address. The cause is one of four things: no answer from the DNS server (timeout), an answer saying the name does not exist (NXDOMAIN), an answer saying the server failed (SERVFAIL), or a wrong answer from a cache, hosts file or misconfigured record.
What is the difference between NXDOMAIN and SERVFAIL?
NXDOMAIN is RFC 1035's Name Error (code 3): the server answered and said the name does not exist. SERVFAIL is Server failure (code 2): the server could not process the query because of a problem on its side, for example it could not reach the domain's own name servers. NXDOMAIN usually means a typo or a missing record, while SERVFAIL points at the resolver or the domain's DNS hosting.
How do I tell if the problem is DNS or my internet connection?
Try reaching a site by IP address, for example by pinging a public IP. If that works but the same site by name fails, the connection is fine and DNS is the problem. If the IP address also fails, fix the connection first.
Why does a site work on my phone but not on my computer?
The two devices may use different DNS servers, caches or hosts files. If the phone resolves the name on the same Wi-Fi network, the fault is likely your computer's cache, a stale hosts file entry, a VPN or a manually set DNS server.
Does flushing the DNS cache fix every resolution problem?
No. It only removes answers your computer already stored, including stored failures. It helps after you have fixed the real cause, or when a record changed recently. It does not repair an unreachable or misconfigured DNS server.

Sources