How to Test DNS with Dig and Nslookup

April 29, 2024 / Domain Name

This article explains how to test DNS with dig and nslookup. Testing DNS with dig and nslookup involves querying DNS servers to retrieve information about domain names.

Here is how you can execute basic DNS tests using both dig and nslookup-

  1. Using dig-
    1. Basic Query-
      dig example.com

      The above command recovers the DNS records for the domain example.com.

    2. Query a Specific Record Type-
      dig example.com MX

      The above command regains the MX (Mail Exchange) records for the domain example.com.

    3. Query a Specific DNS Server-
      dig @8.8.8.8 example.com

      This command demands the DNS server at IP address 8.8.8.8 for the DNS records of example.com.

    4. Reverse DNS Lookup-
      dig -x 8.8.8.8

      This command performs a reverse DNS lookup for the IP address 8.8.8.8.

  2. Using nslookup-
    1. Basic Query-
      nslookup example.com

      This command recovers the DNS records for the domain example.com.

    2. Query a Specific Record Type-
      nslookup -type=MX example.com

      This command retrieves the MX records for the domain example.com.

    3. Query a Particular DNS Server-
      nslookup example.com 8.8.8.8

      This command queries the DNS server at IP address 8.8.8.8 for the DNS records of example.com.

    4. Reverse DNS Lookup-
      nslookup 8.8.8.8

      This command accomplishes a reverse DNS lookup for the IP address 8.8.8.8.

This way, both dig and nslookup will offer you information about the queried domain or IP address. You will normally see information such as the IP address related to the domain, any linked mail servers (MX records), and other DNS records like TXT, CNAME, etc.

By utilising the above-outlined commands with different options and parameters, you may troubleshoot DNS-related issues, verify DNS configurations, and gather different types of DNS data. Learn How to Edit or Manage DNS Records in Plesk with this quick guide.

Leave a Reply

Your email address will not be published. Required fields are marked *