Skip to content

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

Networking Mastery → Module 12: Network Troubleshooting → Lesson 5

Difficulty: Advanced

Reading Time: 220 Minutes

Course Progress

Course: Networking Mastery

Module: Network Troubleshooting

Lesson: 5 of 10


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:

Website

Cannot

Be

Accessed

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.

ping 8.8.8.8

If IP connectivity fails:

DNS is not the root cause.

Fix network connectivity first.


Step 2 — Verify DNS Resolution

Test using:

nslookup example.com

or

dig example.com

If DNS fails:

Continue investigating DNS infrastructure.


Step 3 — Verify DNS Server

Linux:

cat /etc/resolv.conf

Example:

nameserver 8.8.8.8

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:

dig abcxyz.invalid

Response:

NXDOMAIN

Meaning:

Domain

Does

Not

Exist

Possible causes:

  • Typographical Error
  • Missing DNS Record
  • Incorrect Domain Name

SERVFAIL

Example:

SERVFAIL

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:

Connection

Timed Out

Possible causes:

  • Firewall
  • Network Issue
  • DNS Server Down
  • Packet Loss

Verify DNS Records

Query an A record.

dig example.com A

Query an MX record.

dig example.com MX

Query a TXT record.

dig example.com TXT

Verify that the returned records are correct.


Query a Specific DNS Server

Example:

dig @8.8.8.8 example.com

Useful for comparing responses from multiple DNS servers.


Reverse DNS Lookup

Query a PTR record.

dig -x 8.8.8.8

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):

sudo resolvectl flush-caches

Windows:

ipconfig /flushdns

DNS Packet Capture

Capture DNS traffic.

sudo tcpdump port 53

Observe:

DNS Query


DNS Response

Verify:

  • Queries Leave
  • Responses Return

Analyze DNS in Wireshark

Apply filter:

dns

Inspect:

  • Query
  • Response
  • Response Code
  • Record Type
  • TTL

Split DNS Troubleshooting

Example:

Internal:

app.company.local


10.0.0.15

External:

app.company.com


203.0.113.10

Verify clients receive the correct response based on their network location.


Kubernetes DNS Troubleshooting

Test from a Pod.

kubectl exec -it busybox -- nslookup kubernetes.default

Verify:

  • CoreDNS
  • Service Discovery
  • DNS Resolution

CoreDNS Troubleshooting

Check CoreDNS Pods.

kubectl get pods -n kube-system

View logs.

kubectl logs -n kube-system deployment/coredns

Inspect configuration.

kubectl get configmap coredns -n kube-system -o yaml

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

Client


DNS Server


Recursive Resolver


Authoritative DNS


Response

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.

dig example.com

Query a specific server.

dig @8.8.8.8 example.com

Use nslookup.

nslookup example.com

Perform reverse lookup.

dig -x 8.8.8.8

Capture DNS packets.

sudo tcpdump port 53

Hands-on Lab

Task 1

Verify internet connectivity.

ping 8.8.8.8

Task 2

Resolve a hostname.

dig example.com

Task 3

Query multiple DNS servers.

Compare results.


Task 4

Capture DNS traffic.

sudo tcpdump port 53

Task 5

Open the packet capture in Wireshark.

Filter:

dns

Inspect the DNS query and response.


Task 6

Deploy a BusyBox Pod.

Test Kubernetes DNS.

kubectl exec -it busybox -- nslookup kubernetes.default

Task 7

Flush the DNS cache and repeat the query.

Observe any differences.


Task 8

Draw the complete DNS resolution process from:

Browser


Local Resolver


Recursive DNS


Root


TLD


Authoritative DNS


IP Address


Browser

Identify where each failure scenario can occur.


Production Troubleshooting

Problem:

Website

Not

Reachable

By

Hostname

Check:

  • IP Connectivity
  • DNS Server
  • DNS Records
  • Resolver Configuration
  • Cache
  • Firewall
  • CoreDNS
  • Cloud DNS
  • Packet Capture

Workflow:

Ping


dig


nslookup


tcpdump


Wireshark


Root Cause

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

  1. What is DNS troubleshooting?
  2. What does NXDOMAIN mean?
  3. What is SERVFAIL?
  4. What is the difference between dig and nslookup?

Intermediate

  1. Explain the DNS resolution process.
  2. How do you troubleshoot DNS timeouts?
  3. How do you verify DNS packet exchanges?
  4. How do you troubleshoot Kubernetes DNS?

Architect Level

  1. Design a production DNS troubleshooting workflow.
  2. Explain how to diagnose intermittent DNS failures in a hybrid cloud environment.
  3. 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?

Routing Issues

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.