DNS Troubleshooting — Diagnosing and Resolving Name Resolution Problems¶
DNS Troubleshooting is the process of identifying and resolving problems related to domain name resolution. Since nearly every modern application depends on DNS, even a small DNS issue can make websites, APIs, cloud services, Kubernetes workloads, and enterprise applications appear unavailable. Effective DNS troubleshooting requires understanding the complete resolution process—from the client and local resolver to authoritative name servers—and using tools such as dig, nslookup, host, ping, tcpdump, and Wireshark. Every Linux Administrator, Network Engineer, DevOps Engineer, SRE, Cloud Architect, and Kubernetes Administrator should master DNS troubleshooting.
Learning Path¶
Course Progress
What You'll Learn¶
After completing this lesson, you'll be able to:
- Understand the DNS troubleshooting process
- Diagnose DNS resolution failures
- Identify common DNS errors
- Troubleshoot DNS servers
- Analyze DNS packets
- Resolve Kubernetes DNS issues
- Troubleshoot enterprise and cloud DNS environments
Prerequisites¶
Complete:
Basic understanding of:
- User Datagram Protocol (UDP)
- Transmission Control Protocol (TCP)
- IP Networking
Why Do We Need DNS Troubleshooting?¶
Imagine users report:
Possible causes:
- DNS Server Down
- Incorrect DNS Record
- Expired Cache
- Firewall Blocking DNS
- Wrong Resolver
- DNS Timeout
DNS troubleshooting identifies where resolution fails.
DNS Resolution Process¶
Before troubleshooting, understand the normal flow.
Application
↓
Local Resolver
↓
Recursive DNS
↓
Root Server
↓
TLD Server
↓
Authoritative DNS
↓
IP Address
↓
Application
A failure at any step can prevent successful resolution.
Common DNS Problems¶
Typical issues include:
- NXDOMAIN
- SERVFAIL
- Timeout
- Incorrect Records
- Stale Cache
- DNS Server Unreachable
- Split DNS Misconfiguration
Step 1 — Verify Network Connectivity¶
Before troubleshooting DNS:
Verify connectivity.
If IP connectivity fails:
DNS is not the root cause.
Fix network connectivity first.
Step 2 — Verify DNS Resolution¶
Test using:
or
If DNS fails:
Continue investigating DNS infrastructure.
Step 3 — Verify DNS Server¶
Linux:
Example:
Verify:
- Correct DNS Server
- Reachable DNS Server
Common DNS Response Codes¶
| Response | Meaning |
|---|---|
| NOERROR | Successful Resolution |
| NXDOMAIN | Domain Does Not Exist |
| SERVFAIL | Server Failure |
| REFUSED | Query Rejected |
| FORMERR | Invalid Query Format |
NXDOMAIN¶
Example:
Response:
Meaning:
Possible causes:
- Typographical Error
- Missing DNS Record
- Incorrect Domain Name
SERVFAIL¶
Example:
Meaning:
The DNS server could not complete the query.
Possible causes:
- Recursive Resolver Failure
- DNSSEC Issues
- Upstream DNS Failure
- Authoritative Server Unreachable
DNS Timeout¶
Example:
Possible causes:
- Firewall
- Network Issue
- DNS Server Down
- Packet Loss
Verify DNS Records¶
Query an A record.
Query an MX record.
Query a TXT record.
Verify that the returned records are correct.
Query a Specific DNS Server¶
Example:
Useful for comparing responses from multiple DNS servers.
Reverse DNS Lookup¶
Query a PTR record.
Useful for:
- Mail Servers
- Security Logs
- Reverse DNS Validation
DNS Cache Issues¶
Applications may receive outdated responses because of caching.
Flush cache.
Linux (systemd-resolved):
Windows:
DNS Packet Capture¶
Capture DNS traffic.
Observe:
Verify:
- Queries Leave
- Responses Return
Analyze DNS in Wireshark¶
Apply filter:
Inspect:
- Query
- Response
- Response Code
- Record Type
- TTL
Split DNS Troubleshooting¶
Example:
Internal:
External:
Verify clients receive the correct response based on their network location.
Kubernetes DNS Troubleshooting¶
Test from a Pod.
Verify:
- CoreDNS
- Service Discovery
- DNS Resolution
CoreDNS Troubleshooting¶
Check CoreDNS Pods.
View logs.
Inspect configuration.
Cloud DNS Troubleshooting¶
Verify:
- AWS Route 53
- Azure DNS
- Google Cloud DNS
Check:
- DNS Records
- Private Zones
- Public Zones
- VPC/VNet Associations
Enterprise DNS Workflow¶
Every stage should be verified during troubleshooting.
Common DNS Tools¶
| Tool | Purpose |
|---|---|
| dig | Detailed DNS Queries |
| nslookup | DNS Lookup |
| host | Quick DNS Query |
| ping | Basic Name Resolution Test |
| tcpdump | DNS Packet Capture |
| Wireshark | DNS Packet Analysis |
CLI Examples¶
Query DNS.
Query a specific server.
Use nslookup.
Perform reverse lookup.
Capture DNS packets.
Hands-on Lab¶
Task 1¶
Verify internet connectivity.
Task 2¶
Resolve a hostname.
Task 3¶
Query multiple DNS servers.
Compare results.
Task 4¶
Capture DNS traffic.
Task 5¶
Open the packet capture in Wireshark.
Filter:
Inspect the DNS query and response.
Task 6¶
Deploy a BusyBox Pod.
Test Kubernetes DNS.
Task 7¶
Flush the DNS cache and repeat the query.
Observe any differences.
Task 8¶
Draw the complete DNS resolution process from:
Identify where each failure scenario can occur.
Production Troubleshooting¶
Problem:
Check:
- IP Connectivity
- DNS Server
- DNS Records
- Resolver Configuration
- Cache
- Firewall
- CoreDNS
- Cloud DNS
- Packet Capture
Workflow:
dig vs nslookup¶
| dig | nslookup |
|---|---|
| Detailed Output | Simple Output |
| Preferred by Professionals | Beginner Friendly |
| Supports Advanced Queries | Basic Queries |
| Better for Automation | Good for Quick Checks |
| Extensive Debug Information | Limited Detail |
Common Mistakes¶
❌ Assuming every connectivity issue is a DNS problem.
✅ Verify IP connectivity first.
❌ Testing only one DNS server.
✅ Compare responses from multiple resolvers.
❌ Ignoring DNS caching.
✅ Flush caches when validating changes.
❌ Forgetting reverse lookups.
✅ Verify PTR records where required.
❌ Overlooking Kubernetes CoreDNS.
✅ Check CoreDNS health for cluster DNS issues.
Best Practices¶
- Verify network connectivity before troubleshooting DNS.
- Use dig for detailed diagnostics.
- Compare results across multiple DNS servers.
- Capture DNS traffic with tcpdump when necessary.
- Analyze DNS packets using Wireshark.
- Monitor DNS latency in production.
- Keep DNS records accurate and up to date.
- Regularly validate CoreDNS health in Kubernetes clusters.
Interview Questions¶
Beginner¶
- What is DNS troubleshooting?
- What does NXDOMAIN mean?
- What is SERVFAIL?
- What is the difference between
digandnslookup?
Intermediate¶
- Explain the DNS resolution process.
- How do you troubleshoot DNS timeouts?
- How do you verify DNS packet exchanges?
- How do you troubleshoot Kubernetes DNS?
Architect Level¶
- Design a production DNS troubleshooting workflow.
- Explain how to diagnose intermittent DNS failures in a hybrid cloud environment.
- How would you troubleshoot inconsistent DNS responses across multiple regions?
Summary¶
In this lesson, you learned:
- DNS Troubleshooting
- DNS Resolution
- NXDOMAIN
- SERVFAIL
- DNS Timeouts
- DNS Packet Analysis
- CoreDNS Troubleshooting
- Cloud DNS
- Enterprise DNS Troubleshooting
DNS is a foundational service for modern applications, and failures can impact every layer of an infrastructure. By following a structured troubleshooting approach—from verifying connectivity to analyzing DNS packets—you can quickly identify and resolve name resolution issues across enterprise networks, cloud platforms, and Kubernetes clusters.
Key Takeaways¶
- Verify network connectivity before investigating DNS.
- Use dig and nslookup to validate DNS resolution.
- Understand common DNS responses such as NOERROR, NXDOMAIN, and SERVFAIL.
- Capture DNS traffic with tcpdump and inspect it using Wireshark.
- Check CoreDNS when troubleshooting Kubernetes DNS.
- Follow a systematic workflow to isolate DNS problems efficiently.
What's Next?¶
In the next lesson, you'll learn about Routing Issues.
You'll explore:
- Route Lookup Process
- Static and Dynamic Routing Problems
- Missing Routes
- Routing Loops
- Asymmetric Routing
- Route Tables
- Production Routing Troubleshooting
By the end of the lesson, you'll be able to identify and resolve routing problems across enterprise networks, cloud infrastructures, and Kubernetes environments.