Skip to content

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.

  • 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.

If you’re not comfortable with the command line, you can use free online tools:

  1. Open Command Prompt.

  2. Run a basic query:

    Terminal window
    nslookup example.com

    → Shows the IP address (A record) for the domain.

  3. Query a specific DNS server→

    Terminal window
    nslookup example.com 8.8.8.8

    Uses Google DNS (8.8.8.8) instead of your default resolver.

  4. Look up MX (mail) records:

    Terminal window
    nslookup
    set type=MX
    example.com
  1. Open Terminal.

  2. Run a basic query:

    Terminal window
    dig example.com

    → Displays the A record for the domain.

  3. Query a specific DNS server:

    Terminal window
    dig @8.8.8.8 example.com
  4. Look up MX records:

    Terminal window
    dig example.com MX
  5. Look up TXT records (useful for SPF/DKIM):

    Terminal window
    dig example.com TXT
  • 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).