Troubleshooting DNS with dig and nslookup
When your domain is not resolving correctly, two of the most useful tools for diagnosing DNS issues are dig (on Linux/macOS) and nslookup (on Windows). These tools let you query DNS servers directly to see how your domain is configured.
Why Use These Tools?
Section titled “Why Use These Tools?”- Verify if your domain points to the correct IP address.
- Check if DNS propagation is complete.
- Inspect specific DNS records (A, MX, CNAME, TXT, etc.).
- Identify misconfigurations between your registrar and hosting provider.
Using Web-Based DNS Tools
Section titled “Using Web-Based DNS Tools”If you’re not comfortable with the command line, you can use free online tools:
- whatsmydns.net → Check global DNS propagation.
- digwebinterface.com → Run
digqueries online.
Using nslookup on Windows
Section titled “Using nslookup on Windows”-
Open Command Prompt.
-
Run a basic query:
Terminal window nslookup example.com→ Shows the IP address (A record) for the domain.
-
Query a specific DNS server→
Terminal window nslookup example.com 8.8.8.8Uses Google DNS (8.8.8.8) instead of your default resolver.
-
Look up MX (mail) records:
Terminal window nslookupset type=MXexample.com
Using dig on Linux/macOS
Section titled “Using dig on Linux/macOS”-
Open Terminal.
-
Run a basic query:
Terminal window dig example.com→ Displays the A record for the domain.
-
Query a specific DNS server:
Terminal window dig @8.8.8.8 example.com -
Look up MX records:
Terminal window dig example.com MX -
Look up TXT records (useful for SPF/DKIM):
Terminal window dig example.com TXT
Interpreting Results
Section titled “Interpreting Results”- ANSWER SECTION → Shows the record returned (e.g., IP address for A record).
- AUTHORITY SECTION → Shows which nameservers are authoritative for the domain.
- ADDITIONAL SECTION → May include related records (like IPs of nameservers).