Troubleshooting Let’s Encrypt HTTP-01 DNS Resolution Timeout on Ubuntu 22.04 LTS
Fix 'Let's Encrypt HTTP-01 challenge DNS resolution timeout' errors on Ubuntu 22.04 LTS. Diagnose common DNS record, firewall, and propagation issues to secure your website.
Fix 'Let's Encrypt HTTP-01 challenge DNS resolution timeout' errors on Ubuntu 22.04 LTS. Diagnose common DNS record, firewall, and propagation issues to secure your website.
When attempting to obtain or renew a Let's Encrypt SSL certificate using the http-01 challenge, encountering a "DNS resolution timeout" error can be a significant roadblock. This error indicates that the Let's Encrypt validation servers are unable to resolve the IP address for your domain name, preventing them from verifying control over your web server. This guide provides a deep dive into diagnosing and resolving this specific issue on an Ubuntu 22.04 LTS system.
Symptom & Error Signature
Users typically experience this issue when running certbot commands, either for initial certificate issuance or renewal. The command will fail, often displaying output similar to the following:
sudo certbot renew --dry-run
Saving debug log to /var/log/letsencrypt/letsencrypt.log
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing /etc/letsencrypt/renewal/example.com.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Hook 'pre-hook' ran successfully
Attempting to renew cert (example.com) from /etc/letsencrypt/renewal/example.com.conf produced an unexpected error:
[... truncated output ...]
Domain: example.com
Type: connection
Detail: During secondary validation: DNS problem: query timed out looking up A for example.com:53
To fix this, please make sure that your domain name was entered correctly and that the DNS A/AAAA record(s) for that domain contain(s) the right IP address. Additionally, please check that your domain's nameservers are working correctly and not blocking ACME requests.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
All renewal attempts failed. The following certs could not be renewed:
/etc/letsencrypt/live/example.com/fullchain.pem (failure)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Or, during an initial request:
sudo certbot certonly --nginx -d example.com -d www.example.com
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Requesting new certificate for example.com and www.example.com
Performing the following challenges:
http-01 challenge for example.com
http-01 challenge for www.example.com
Waiting for verification...
Challenge failed for domain example.com
Challenge failed for domain www.example.com
http-01 challenge for example.com failed
http-01 challenge for www.example.com failed
Certbot failed to authenticate some domains (authenticator: nginx). The Certificate Authority reported these problems:
Domain: example.com
Type: unauthorized
Detail: 1.2.3.4: Invalid response from http://example.com/.well-known/acme-challenge/TOKEN: DNS problem: query timed out looking up A for example.com
Hint: The Certificate Authority failed to download the temporary file created by Certbot. Ensure that the host name's DNS A/AAAA records point to the correct IP address.
The critical part of the error message is usually "DNS problem: query timed out looking up A for yourdomain.com:53" or similar, indicating that the Certificate Authority (CA) could not complete a DNS lookup for your domain.
Root Cause Analysis
A "DNS resolution timeout" in the context of a Let's Encrypt http-01 challenge signifies that the Let's Encrypt validation servers, which are distributed globally, failed to successfully query the authoritative DNS servers for your domain to find its A (IPv4) or AAAA (IPv6) records.
Crucially, this is not a problem with your local server's /etc/resolv.conf or its ability to resolve external domains. The issue lies with how the public internet (specifically Let's Encrypt's infrastructure) perceives and accesses your domain's DNS information.
Common underlying reasons include:
- Incorrect or Missing A/AAAA Records: The most frequent cause. The
AorAAAArecord for your domain (and any subdomains you're requesting a certificate for, likewww) might be missing, incorrect, or pointing to an old/wrong IP address. - DNS Propagation Delays: If you've recently updated your DNS records, it can take time (up to 48 hours, though often much faster) for changes to propagate across the internet's DNS resolvers. Let's Encrypt's validators might be querying a resolver that hasn't received the update yet.
- Authoritative DNS Server Issues:
- Unreachable: Your domain's authoritative nameservers (e.g.,
ns1.example.com,ns2.example.comas listed in your domain registrar's settings) might be down, misconfigured, or unreachable due to a network or firewall issue. - Overloaded/Rate-limited: Some DNS providers or self-hosted DNS servers might be experiencing high load or apply rate limiting, causing queries from Let's Encrypt's validators to time out.
- Incorrect NS Records: The nameserver records (
NSrecords) delegated for your domain in the parent zone (e.g.,.comTLD servers) might be pointing to non-existent or incorrect authoritative servers.
- Unreachable: Your domain's authoritative nameservers (e.g.,
- DNSSEC Validation Failures: If your domain uses DNS Security Extensions (DNSSEC) and it's misconfigured (e.g., expired keys, mismatched DS records, incorrect signing), recursive resolvers may return a
SERVFAILresponse or simply time out due when they cannot validate the signature chain. Let's Encrypt validators respect DNSSEC. - Firewall Blocking DNS Queries: A firewall on your authoritative DNS server (if self-hosted) or an upstream network firewall might be blocking incoming UDP/TCP port 53 queries from parts of the internet, including Let's Encrypt's validation network.
Step-by-Step Resolution
Address these potential causes systematically, focusing on the external view of your domain's DNS.
1. Verify Public DNS Records and Propagation
This is the most critical first step. You need to ascertain what the rest of the internet sees for your domain's A/AAAA records.
Check A/AAAA Records: Use
digfrom your local machine, but more importantly, use online DNS lookup tools that query various global DNS resolvers.# From your Ubuntu server, query Google's DNS for your A record dig @8.8.8.8 example.com A +short # Query your domain's nameservers directly (replace ns1.example.com) dig @ns1.your-dns-provider.com example.com A +short dig @ns1.your-dns-provider.com www.example.com A +shortOnline tools like DNS Checker, What's My DNS, or Digwebinterface are invaluable here. Enter your domain, select
Arecord, and observe results from multiple locations.Ensure that the
Arecord(s) forexample.comandwww.example.com(or any other subdomains you are certifying) point precisely to the public IPv4 address of your Ubuntu 22.04 web server. If you are using IPv6, verifyAAAArecords as well.Check NS Records and Delegation: Verify which nameservers are authoritative for your domain and if they are correctly delegated.
dig example.com NS +shortCompare this output with the nameservers configured at your domain registrar. They must match.
Check Whois Records: Use
whoisto verify the nameservers specified at the domain registry level.whois example.com | grep "Name Server"These are the servers that top-level domain (TLD) servers delegate to. If these are incorrect or don't match your actual authoritative DNS servers, resolution will fail.
2. Test Authoritative DNS Server Reachability
If your A records appear correct, the problem might be that the authoritative DNS servers themselves are unreachable or unresponsive.
Identify Authoritative Nameservers: From
dig example.com NS, note down the nameservers (e.g.,ns1.your-dns-provider.com,ns2.your-dns-provider.com).Test Direct Queries: Try querying these nameservers directly from your server or another external machine.
dig @ns1.your-dns-provider.com example.com A dig @ns2.your-dns-provider.com example.com ALook for
;; connection timed out; no servers could be reachedor similar errors. If these direct queries fail consistently, it indicates a problem with the nameserver itself or network path to it.Check for Network Blocks: While less common for major DNS providers, if you are self-hosting DNS or using a less common provider, ensure that UDP/TCP port 53 is open on the nameserver's firewall and that there are no network ACLs blocking access from public IPs.
If you operate your own authoritative DNS servers, ensure that the
bind9(or PowerDNS, Knot, etc.) service is running and configured correctly. Checksudo systemctl status bind9andsudo journalctl -u bind9for errors.
3. Inspect DNSSEC Configuration
Misconfigured or expired DNSSEC records are a common cause of SERVFAIL responses, which can manifest as resolution timeouts.
Use DNSSEC Debugger Tools: Utilize online tools like DNSSEC Debugger by Verisign or dnsviz.net. Enter your domain name and review the results for any errors, especially
SERVFAILorunsignedstatus where it should be signed.Common DNSSEC Issues:
- Expired Keys: Your DNSKEY records might have expired.
- Mismatched DS Records: The
DS(Delegation Signer) record in the parent zone (at your domain registrar) must precisely match theKSK(Key Signing Key) in your zone. Even a single character mismatch will break DNSSEC validation. - Incorrect Signing: Your authoritative DNS server might not be correctly signing your zone or re-signing it on schedule.
If you suspect DNSSEC issues and are not an expert, temporarily disabling DNSSEC at your domain registrar can help confirm this as the root cause. If
certbotthen works, you can re-enable DNSSEC and correctly configure it. Disabling DNSSEC makes your domain vulnerable to cache poisoning attacks until re-enabled.
4. Firewall on the Target Web Server (Less Likely for DNS Resolution Timeout)
While the DNS resolution timeout error specifically points to an issue with resolving the domain, it's worth a quick check on your web server's firewall (ufw or iptables) to ensure it's not inadvertently blocking any external DNS-related traffic, though this is rare for this specific error. The primary concern for http-01 is typically port 80.
sudo ufw status verbose
Ensure that 80/tcp (and ideally 443/tcp) are allowed. If ufw is active and blocking these, certbot will fail with an HTTP connection error after DNS resolution. This is a good general check but not the primary cause of a DNS resolution timeout.
5. Address Caching and Propagation Issues
If you recently made DNS changes, it's possible that older, cached records are still being served by some DNS resolvers.
- Wait for Propagation: Patience is key. Wait a few hours after making DNS changes before retrying
certbot. - Check with Fresh Resolvers: Use online tools or
digagainst specific public resolvers (e.g.,dig @1.1.1.1 example.com A) that might have fresh caches.
6. Retry Certbot with Verbose Output
After performing the above checks and making any necessary corrections, retry your certbot command with increased verbosity to gather more details if it still fails.
sudo certbot renew --dry-run -v
# Or for initial issuance:
sudo certbot certonly --nginx -d example.com -d www.example.com -v
The verbose output (-v) can sometimes reveal more specific issues reported by the ACME client or the CA.
7. Consider the dns-01 Challenge (Workaround)
If you've exhausted all troubleshooting for http-01 and your DNS provider offers an API, you might consider switching to the dns-01 challenge. This method verifies domain ownership by adding a specific TXT record to your DNS, bypassing the need for Let's Encrypt to connect to your web server directly via HTTP.
# Example for Cloudflare DNS (requires certbot-dns-cloudflare plugin)
sudo certbot certonly --dns-cloudflare --dns-cloudflare-credentials /etc/letsencrypt/cloudflare.ini -d example.com -d www.example.com
This requires a certbot plugin specific to your DNS provider and API credentials. While effective, it's a workaround if the http-01 challenge itself has a fundamental DNS resolution problem from the CA's perspective.
By systematically working through these steps, focusing on how your domain's DNS is publicly resolved and served by its authoritative nameservers, you should be able to pinpoint and resolve the "Let's Encrypt HTTP-01 challenge DNS resolution timeout" error on your Ubuntu 22.04 LTS system.
Our Production Verification Guarantee
Encountering a bug not covered here or running a non-standard kernel configuration? Our solutions are continually refined against real production incidents. Submit an environment trace for our editorial team to replicate.