What is nslookup and how to troubleshoot DNS

· Category: Networking

Short answer

Nslookup is a command-line tool for querying DNS servers. It helps diagnose name resolution problems by showing which DNS server responded and what records it returned.

Steps

  1. Query A records: Type nslookup example.com to get the IPv4 address.

  2. Specify a server: Type nslookup example.com 8.8.8.8 to test against a specific DNS resolver.

  3. Query other types: - set type=MX to find mail servers. - set type=NS to find authoritative name servers. - set type=TXT to view text records.

  4. Check reverse DNS: Query an IP address to see its PTR record.

  5. Compare responses: Run queries against multiple DNS servers to check for propagation inconsistencies.

Tips

  • Prefer dig on Linux for more detailed output.
  • Use +trace with dig to follow the full resolution chain.
  • Flush local DNS cache if you suspect stale records.

Common issues

  • Non-authoritative answers indicating cached responses.
  • SERVFAIL responses suggesting zone configuration errors.
  • NXDOMAIN meaning the record does not exist.