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
-
Query A records: Type
nslookup example.comto get the IPv4 address. -
Specify a server: Type
nslookup example.com 8.8.8.8to test against a specific DNS resolver. -
Query other types: -
set type=MXto find mail servers. -set type=NSto find authoritative name servers. -set type=TXTto view text records. -
Check reverse DNS: Query an IP address to see its PTR record.
-
Compare responses: Run queries against multiple DNS servers to check for propagation inconsistencies.
Tips
- Prefer
digon Linux for more detailed output. - Use
+tracewith 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.