Docs / DNS & Domains / How to Use dig and nslookup for DNS Troubleshooting

How to Use dig and nslookup for DNS Troubleshooting

By Admin · Feb 25, 2026 · Updated Apr 23, 2026 · 138 views · 1 min read

dig — DNS Information Groper

# Basic lookup
dig example.com

# Short output
dig +short example.com

# Specific record type
dig example.com MX
dig example.com TXT
dig example.com NS
dig example.com AAAA

# Query specific DNS server
dig @1.1.1.1 example.com
dig @8.8.8.8 example.com

# Trace the resolution path
dig +trace example.com

# Reverse lookup
dig -x 198.48.63.241

# Show TTL remaining
dig example.com | grep -A1 "ANSWER SECTION"

nslookup

# Basic lookup
nslookup example.com

# Specific record type
nslookup -type=MX example.com
nslookup -type=TXT example.com

# Query specific server
nslookup example.com 1.1.1.1

Common Diagnostic Scenarios

Check Propagation

# Compare results from multiple DNS servers
dig +short example.com @1.1.1.1    # Cloudflare
dig +short example.com @8.8.8.8    # Google
dig +short example.com @9.9.9.9    # Quad9

Verify Email DNS

dig example.com MX +short
dig example.com TXT +short | grep spf
dig mail._domainkey.example.com TXT +short
dig _dmarc.example.com TXT +short

Check Nameservers

dig example.com NS +short

Install dig

# Ubuntu/Debian
sudo apt install -y dnsutils

# Rocky/Alma
sudo dnf install -y bind-utils

Was this article helpful?