“It’s always DNS” is a meme because it’s usually true. When something network-related breaks, DNS is the first suspect. Here’s how to investigate.
The Essential Tools
dig - The DNS Swiss Army Knife
| |
nslookup - Quick and Simple
| |
host - Even Simpler
| |
Common DNS Problems
Problem: Domain Not Resolving
Symptoms: NXDOMAIN or SERVFAIL errors
Debug steps:
| |
Common causes:
- Domain expired or not registered
- Nameservers not configured
- Zone file missing the record
- Propagation still in progress
Problem: Wrong IP Address
Symptoms: Domain resolves but to the wrong IP
| |
Common causes:
- Old record cached (wait for TTL to expire)
- Changed IP but forgot to update DNS
- Multiple A records (load balancing)
- CNAME pointing to wrong target
Problem: Email Not Delivered
Symptoms: Emails bouncing or going to spam
| |
Common causes:
- Missing or misconfigured MX records
- SPF record too restrictive or missing
- DKIM not set up
- DMARC policy rejecting mail
Problem: SSL Certificate Errors
Symptoms: Browser shows certificate mismatch
| |
Common causes:
- Certificate doesn’t include the subdomain
- CNAME pointing to wrong target
- Mixed www/non-www configuration
Understanding DNS Resolution
The Resolution Path
Tracing Resolution
| |
TTL and Caching
| |
TTL gotchas:
- Changes won’t be visible until TTL expires
- Different resolvers may have different cached values
- Lower TTL = faster propagation but more DNS queries
Flush DNS Cache
| |
Record Types Cheat Sheet
| Type | Purpose | Example |
|---|---|---|
| A | IPv4 address | example.com. A 93.184.216.34 |
| AAAA | IPv6 address | example.com. AAAA 2606:2800:220:1:... |
| CNAME | Alias to another name | www.example.com. CNAME example.com. |
| MX | Mail server | example.com. MX 10 mail.example.com. |
| TXT | Text data (SPF, DKIM, etc.) | example.com. TXT "v=spf1 ..." |
| NS | Nameserver | example.com. NS ns1.example.com. |
| SOA | Zone authority info | Start of Authority record |
| CAA | Certificate authority authorization | example.com. CAA 0 issue "letsencrypt.org" |
| SRV | Service location | _sip._tcp.example.com. SRV 10 5 5060 sip.example.com. |
Debugging Workflow
Step 1: Verify the Problem
| |
Step 2: Find the Authoritative Source
| |
Step 3: Compare Authoritative vs Cached
| |
Step 4: Verify the Fix
| |
Useful Online Tools
When CLI isn’t enough:
- dnschecker.org - Check propagation globally
- mxtoolbox.com - Email DNS diagnostics
- whatsmydns.net - Visual propagation checker
- dnsviz.net - DNSSEC visualization
Common Mistakes
Forgetting the trailing dot: In zone files,
example.com(no dot) is relative,example.com.(with dot) is absoluteCNAME at apex: You can’t have a CNAME at the root domain (
example.com), only at subdomainsConflicting records: A record and CNAME can’t coexist for the same name
Low TTL after migration: Remember to increase TTL after changes are confirmed working
Not checking all record types: An A record might be fine, but the AAAA record could be wrong
Next time something doesn’t work, start with dig. Nine times out of ten, you’ll find the problem is DNS. And the tenth time? Check DNS again — you probably missed something.