Our Thinking / Field Notes / The Fix

TROUBLESHOOTING / WINDOWS SERVER DNS TROUBLESHOOTING

Windows Server DNS: Internal Names Work but External Names Fail

Internal lookups succeed because your server hosts those zones itself. External ones need recursion through forwarders or root hints. Here is how to find which link has broken, using read-only checks first and a careful fix second.

Start here

Internal names resolve because your DNS server is authoritative for those zones and answers from its own data. External names only work if the server can go and ask someone else, via recursion, forwarders or root hints. So test from the DNS server itself, then check in this order: is recursion enabled, are the forwarders correct and answering, is DNS traffic allowed out of the network, and is any local zone or policy getting in the way. The usual culprits are recursion switched off, dead or wrong forwarders (including domain controllers forwarding to each other) and outbound DNS blocked at the firewall.

What this symptom is telling you

A Windows DNS server answers internal names from zones it hosts itself. It is authoritative for them, which simply means it holds the records and does not need to ask anyone. External names are different. The server has to look them up on the client's behalf, which is called recursion, and it does that by passing the query to a forwarder (another DNS server you nominate, usually outside your network) or by starting at the internet's root servers using its root hints.

That is why the symptom is so specific. Your zones, your records and the clients' connection to the server are all fine. The fault sits somewhere on the path from your DNS server to the outside world, or in the settings that decide whether the server is allowed to take that path at all.

The checks below move from read-only to changing things. The first three sections only read settings and send test queries. Nothing is altered until the section on making a change, and that section says what each change does and how to undo it. This article covers a Windows Server DNS service where clients are correctly pointed at it. If clients are using the wrong DNS server in the first place, that is a different problem.

Prove where it fails: client first, then the server itself

The aim here is to separate a client or network problem from a problem inside the DNS server. Microsoft's own troubleshooting sequence starts the same way: if resolution also fails from the DNS server itself, the client and the network between the client and the server are ruled out.

You need a Windows PowerShell prompt on an affected client and another on the DNS server. Neither check changes anything. The examples use example.com as the external test name and FS01.corp.example.com as a stand-in for one of your own internal names. Replace YOUR_DNS_SERVER_IP with the address of the DNS server the client is meant to use, and YOUR_INTERNAL_NAME with a real internal host name.

If you run more than one DNS server, test each one separately. Forwarder settings are held per server and are not replicated between them, so one server can be healthy while its neighbour is not.

  1. On the affected client, confirm which DNS servers it is using. The addresses listed under DNS Servers for the active adapter should be your internal DNS server or servers.
    powershell
    ipconfig /all
  2. Ask that server for an internal name directly. This should return an address immediately and tells you the client can reach the server and the server is answering.
    powershell
    Resolve-DnsName -Name YOUR_INTERNAL_NAME -Server YOUR_DNS_SERVER_IP -DnsOnly
  3. Ask the same server for an external name. A failure here reproduces the problem in a clean way, without the client's cache or hosts file muddying the result. With default timeouts and several unresponsive forwarders, a failure can take over ten seconds to come back, so give it time before assuming the command has hung.
    powershell
    Resolve-DnsName -Name example.com -Server YOUR_DNS_SERVER_IP -DnsOnly
  4. Now repeat the external lookup on the DNS server itself, pointing at the server's own loopback address. If this fails too, the fault is in the server's configuration or its route out, and you can carry on to the next section. If it works on the server but fails from the client, look at what sits between them, such as a firewall rule or a recursion restriction that only applies to some networks.
    powershell
    Resolve-DnsName -Name example.com -Server 127.0.0.1 -DnsOnly

Read the DNS server's recursion, forwarder and zone settings

Run these on the DNS server in an elevated PowerShell window (or remotely with the -ComputerName parameter if you have the DnsServer module installed). They only read settings. Save the output of the forwarder command in particular: if you change anything later, it is your record of the original values.

Each command answers a different question. Recursion says whether the server is allowed to look names up for clients. Forwarders say who it asks first. Root hints are the fallback starting point, used when no forwarders are set or when the forwarders have all failed and fallback is permitted. The zone list shows whether anything on the server is claiming to be authoritative for names it should be forwarding.

  1. Check recursion. The Enable value should be True. If it is False, the server will normally refuse queries that need recursion, and Microsoft notes that disabling recursion also stops the server from using forwarders. That is a legitimate setting on a server that only hosts public zones, so find out whether it was deliberate before changing it.
    powershell
    Get-DnsServerRecursion
  2. Check the forwarders. Look at the list of IP addresses, the UseRootHint value and the Timeout value. Every address should belong to a server outside your internal DNS estate, and UseRootHint should be True if you want the server to fall back to the root servers when the forwarders do not respond.
    powershell
    Get-DnsServerForwarder | Format-List *
  3. Check the root hints. These matter when there are no forwarders, or when fallback is enabled. You should see the root servers listed with addresses. An empty list with no forwarders configured means the server has no way to start an external lookup, and failure is the expected result.
    powershell
    Get-DnsServerRootHint
  4. List the zones the server hosts. Look for any zone whose name is a single dot, and for anything unexpected that covers the name you are testing. A hosted authoritative zone decides the answer for names inside it and the server will not send those queries to forwarders. Conditional forwarders appear in this list as zones of type Forwarder.
    powershell
    Get-DnsServerZone
  5. If you suspect a particular name or namespace is being blocked, list the query resolution policies on this server and on any Windows forwarder it uses. A policy that denies a zone or record would show up here.
    powershell
    Get-DnsServerQueryResolutionPolicy

Test the route out to your forwarders and the internet

Now find out whether the server can actually reach the servers it depends on. Run these on the DNS server. They send ordinary test queries and a connection test, and change nothing.

Replace YOUR_FORWARDER_IP with each address from the forwarder list in turn, and YOUR_KNOWN_GOOD_RESOLVER with an external resolver your firewall policy allows the server to contact. Comparing the two is the useful part. If your forwarder fails but another resolver answers, the forwarder is the problem. If neither answers, look at the network between the server and the internet.

  1. Query each configured forwarder directly for an external name. A normal answer means that forwarder is healthy. A timeout means it is unreachable or silent. A refusal means it is reachable but is configured not to answer you.
    powershell
    Resolve-DnsName -Name example.com -Server YOUR_FORWARDER_IP -DnsOnly
  2. Query a second resolver you know should work, using the same external name.
    powershell
    Resolve-DnsName -Name example.com -Server YOUR_KNOWN_GOOD_RESOLVER -DnsOnly
  3. Check that TCP port 53 is open to the forwarder. This tests TCP only. DNS normally uses UDP first, so a successful result does not prove UDP is allowed, but a failed result is a strong hint that a firewall is in the way.
    powershell
    Test-NetConnection -ComputerName YOUR_FORWARDER_IP -Port 53

Match what you found to a likely cause

Most real cases fall into one of the patterns below. The type of failure matters as much as the fact of failure. A DNS answer such as NXDOMAIN (the name does not exist) or REFUSED (the server declined) counts as a final response and does not normally trigger any fallback. Fallback only happens when a server stays silent or gives a result the DNS service treats as retryable.

  • Recursion is off. Get-DnsServerRecursion shows Enable as False, and external lookups fail even from the server itself. Fix the setting only if this server is meant to serve internal clients.
  • The forwarders are dead or wrong. Direct queries to them time out, and the client sees a server failure (SERVFAIL) after a delay. This often follows an ISP change, a router replacement or a forwarder that was a firewall's old address.
  • The forwarders are your own domain controllers. Dell's guidance describes DNS servers in a domain forwarding to each other, which adds delay without ever reaching an outside source. Forwarders should be servers outside the domain. It is a polite circle of servers, each assuring the others that someone else will know.
  • The forwarder is reachable but answering REFUSED or NXDOMAIN. Microsoft describes both as final answers. The server will not try the next forwarder or root hints. Check the forwarder's own policies or records, or involve the vendor if it is not a Windows server.
  • Outbound DNS is blocked. Both your forwarders and the independent resolver time out, and Test-NetConnection fails on port 53. Root hint fallback also needs network access to the root servers, so it cannot help here. This is a firewall, router or ISP matter, and the right move is to hand your test results to whoever manages the edge.
  • Timeouts are too tight for your forwarders. With default settings (8-second recursion timeout and 3-second forwarding timeout) Microsoft says a Windows DNS server will query at most three forwarders before time runs out. A long forwarder list therefore does not mean they all get tried.
  • Windows Server 2022 or later is stuck on one forwarder. Microsoft notes that if no forwarder responds, the server uses only the first one in the dynamic list until the DNS Server service restarts. Dynamic reordering can be turned off to restore the older cycling behaviour.
  • A hosted zone is shadowing the names. A zone named with a single dot, or an unexpected zone that covers the name, means the server answers from local data rather than forwarding. Microsoft documents that a hosted authoritative zone controls the result for names it covers.

Make the smallest change that fits what you found

Change one thing at a time and only the thing your tests pointed at. You need rights to manage the DNS server, for example local administrator on it, and the changes take effect straight away without a service restart. Every client using this server is affected the moment you apply them, so on a site with two DNS servers, fix one, check it, and then do the other.

One caution on recursion. Only enable it if this server is meant to resolve external names for your own clients. A DNS server that answers recursive queries from untrusted networks can be abused, so make sure it is not reachable for recursion from the internet. Microsoft's guidance is to allow recursive queries only from trusted clients and networks.

Rollback in every case is to put back the values you saved from the forwarder and recursion checks earlier.

  1. If recursion was off and should be on, enable it.
    powershell
    Set-DnsServerRecursion -Enable $true
  2. If the forwarders were wrong, replace the whole list. This overwrites the existing list, so use only external servers you are permitted to use, such as your ISP's resolvers or another service your organisation allows. Two or three is enough, given the default timeouts. UseRootHint set to true keeps root hint fallback available if the forwarders stop responding.
    powershell
    Set-DnsServerForwarder -IPAddress "YOUR_FORWARDER_1","YOUR_FORWARDER_2" -UseRootHint $true
  3. Clear the server's DNS cache so earlier failed lookups are not served from memory. The server will need to look names up afresh, so the first few lookups may be a little slower. Then clear the client's cache on the machine you are testing from.
    powershell
    Clear-DnsServerCache -Force
    powershell
    Clear-DnsClientCache
  4. Only if you run Windows Server 2022 or later and the server stayed stuck on a single failing forwarder, turn off dynamic forwarder reordering. The trade-off is that the server no longer promotes faster forwarders to the front of its list.
    powershell
    Set-DnsServerForwarder -EnableReordering $false
  5. If results get worse, restore the saved original forwarder list. Replace the placeholders with the addresses you recorded earlier. If you also changed reordering, set it back to its original value.
    powershell
    Set-DnsServerForwarder -IPAddress "YOUR_ORIGINAL_FORWARDER_1","YOUR_ORIGINAL_FORWARDER_2"

Confirm external and internal names both resolve

Check from both ends, and check internal names again so you know the fix has not broken what already worked. If you have more than one DNS server, repeat the checks against each.

  1. On the DNS server, query the external name against its own address. You should get an A record back promptly.
    powershell
    Resolve-DnsName -Name example.com -Server 127.0.0.1 -DnsOnly
  2. On the client, query the external name against the DNS server. Success here means the full path from client to server to the outside world is working.
    powershell
    Resolve-DnsName -Name example.com -Server YOUR_DNS_SERVER_IP -DnsOnly
  3. Query an internal name against the same server to confirm internal resolution is unchanged.
    powershell
    Resolve-DnsName -Name YOUR_INTERNAL_NAME -Server YOUR_DNS_SERVER_IP -DnsOnly

If it still fails, or only some names fail

If lookups still fail after the settings look right, the useful next step is evidence, not more changes.

  • Every resolver times out from the DNS server, including ones that work from elsewhere. The problem is almost certainly at the firewall, router or ISP. Hand over the failing commands, the timestamps and the forwarder list you saved.
  • Only certain external names or one partner domain fail. Look for a conditional forwarder or hosted zone covering that namespace, then check the target servers for policies or missing records. Microsoft's scenarios show a forwarder returning REFUSED or a name error ends processing without trying the next forwarder.
  • Lookups work but are slow, then sometimes fail. Review the forwarding and recursion timeouts, and whether one forwarder in the list is slow or silent. Microsoft's guidance is to monitor forwarder health separately because the server does not tell you whether a forwarder is offline or merely slow.
  • You need proof of what is on the wire. Flush the client cache, capture traffic filtered to port 53 on the client, DNS server and forwarder at the same time, then reproduce the lookup. The capture shows whether a query was sent, whether a reply came back and what kind of reply it was.
Technical terms explained
authoritative
A DNS server is authoritative for a zone when it holds the records itself and can answer without asking anyone else.
conditional forwarder
A rule that sends queries for one specific domain name to designated DNS servers instead of using the general forwarders.
forwarder
A DNS server that your own DNS server passes external queries to, so that the forwarder completes the lookup and returns the answer.
NXDOMAIN
A DNS response meaning the name does not exist. It is treated as a final answer and does not normally trigger fallback to another server.
recursion
The process where a DNS server looks up a name on behalf of a client by asking other DNS servers, then returns the final answer to the client.
REFUSED
A DNS response meaning the server declined to answer the query, for example because policy or recursion settings forbid it.
root hints
A built-in list of the internet's root DNS servers. A server uses it as a starting point to look up names itself when no forwarder is available.
SERVFAIL
A DNS response meaning the server tried to resolve the name but could not complete the lookup.

Sources and further reading

KEEP THE CONVERSATION GOING

Traced it to the network edge, or not comfortable changing the DNS server?

If your tests point at a firewall, router or ISP, or you would like a second pair of eyes before changing a production DNS server, tell us what you are seeing and we will help you work out the cause.

Talk to Rismor