The command nslookup (short for
Name Server
Lookup) is a command-line tool used for querying
the Domain Name System (DNS) to obtain various information about
domain names and IP addresses. Its key functions are:
Resolve domain names to IP addresses (forward lookup)
Resolve IP addresses to domain names (reverse lookup)
Test DNS servers by querying a specific DNS server
Troubleshoot DNS issues, such as incorrect records or slow response times.
>Synopsis
nslookup [option] [destination]
>Options
-type=<record>
The command -type=<record> specifies
the type of DNS record you want to query. Common types include
A (Address record), MX (Mail Exchange), NS (Name Server),
CNAME (Canonical Name), and PTR (Pointer Record).
Example:
-type=<record>
> nslookup -type=MX google.com
Server: UnKnown
Address: 192.168.0.1
Non-authoritative answer:
google.com mail exchanger = 10 alt1.aspmx.l.google.com
google.com mail exchanger = 20 alt2.aspmx.l.google.com
google.com mail exchanger = 30 alt3.aspmx.l.google.com
-debug
The command -debug provides a more detailed output about the
DNS query process, including the steps taken and the response
received. This can be invaluable for troubleshooting DNS
issues and understanding how the query was processed by the
DNS server.
Example:
-debug
> nslookup -debug www.example.com
Server: UnKnown
Address: 192.168.1.1
; DiG 9.10.6 www.example.com ;; global options: +cmd
www.example.com. 3600 IN A 93.184.216.34
-timeout
The command -timeout=<seconds> sets the timeout period
(in seconds) for waiting for a response from the DNS server,
which is useful when querying a potentially slow /
unresponsive DNS server or, if you're diagnosing timeouts.