What causes a DNS query to fail and return a SERVFAIL error?
DNS query failure returning SERVFAIL is a relatively common error, but many people are unclear about the reasons behind it. Simply put, SERVFAIL indicates that the DNS server encountered a problem while processing the query request and could not return the correct resolution result. The specific reasons can be analyzed from several perspectives.
First, SERVFAIL does not mean the domain name does not exist (that's NXDOMAIN), nor is it a client network problem; rather, it indicates a failure on the server side or in the resolution process. Common reasons include:
1. Incorrect Domain Configuration
The domain's DNS zone file contains errors, such as incorrect SOA or NS record configuration, incorrect format, or missing necessary records.
The DNS server returns SERVFAIL when it encounters an exception while reading or resolving the zone file. For example, if the parent domain pointed to by the NS does not exist or is inaccessible, the resolver cannot recursively retrieve the domain information.
2. DNSSEC Verification Failure
For domains with DNSSEC enabled, the resolver verifies the integrity of the DNS data signature.
If a domain's DNSSEC signature is incorrect, expired, or the chain is incomplete, the resolver will return SERVFAIL instead of an incorrect IP address.
Common scenarios include forgetting to synchronize the DNSSEC signature after modifying DNS, or misconfiguration by the domain hosting provider.
3. Upstream Server Issues
If your recursive DNS server encounters an error while querying an upstream authoritative server, such as a timeout or an exception, it can also cause SERVFAIL.
Sometimes, the ISP's DNS server may be temporarily unavailable, or a firewall may be blocking DNS requests.
4. Caching or Load Issues
Corrupted cache or insufficient memory on the recursive DNS server can also lead to SERVFAIL.
Excessive query load may overwhelm the server, causing it to return SERVFAIL.
5. Firewall or Security Policy Interference
If a DNS query is blocked or modified by network devices (such as firewalls, DDoS protection, or cloud DNS security policies), recursive resolution will fail, resulting in SERVFAIL.
For example, some public DNS servers may refuse to return results because DNS queries trigger security policies.
How to troubleshoot SERVFAIL errors?
1. Check domain configuration
Use `dig` or `nslookup` to view the domain's authoritative records:
dig example.com NS
dig example.com SOA
Confirm that the NS record points correctly and is accessible, and that the SOA configuration is effective.
2. Verify DNSSEC
If the domain has DNSSEC enabled, you can use:
dig +dnssec example.com
Check if the signature is valid and if there are any RRSIG errors.
3. Try different DNS servers
Use Google DNS (8.8.8.8 / 8.8.4.4) or Cloudflare DNS (1.1.1.1) for queries to rule out local or ISP server issues.
4. Check upstream servers and caches
If you have deployed your own recursive DNS, check the logs to confirm whether upstream requests returned successfully.
Clearing the cache or restarting the DNS service may resolve temporary issues.
5. Rule out network blocking
Confirm that your firewall, routing policies, DDoS protection, or cloud DNS security rules are not blocking DNS requests.
In summary, SERVFAIL is a common error code when a DNS server cannot resolve a request. The causes could include incorrect domain configuration, failed DNSSEC verification, upstream server issues, cache errors, or network blocking. When troubleshooting, first check the domain name and authoritative DNS configuration, then check DNSSEC, upstream servers, and the network environment. In most cases, correcting the configuration or replacing the recursive server will resolve the issue.
CN
EN