Nslookup
Nslookup is a classic DNS‑query utility used to obtain hostnames, IP addresses, and DNS record details. It supports both interactive and non‑interactive modes, making it useful for troubleshooting, enumeration, and passive reconnaissance during the information‑gathering phase.
Common Options
Query Types
Option |
Description
|
-type=A |
Request an IPv4 address (A) record
|
-type=MX |
Request mail‑exchange (MX) records
|
-type=PTR |
Perform a reverse lookup with a PTR query
|
-class=IN |
Specify the DNS class (default IN – Internet)
|
Server & Control
Option |
Description
|
SERVER [DNS] |
Direct the query to a specified DNS resolver
|
-port=<PORT> |
Send the query to a custom UDP/TCP port
|
-retry=<COUNT> |
Set the number of retry attempts for a query
|
-timeout=<SEC> |
Define the wait time before a query attempt times out
|
Output & Debug
Option |
Description
|
-debug |
Enable verbose output, showing query packets and flags
|
-sil |
Suppress all banners and prompts in script usage
|
Examples
Basic A‑Record Lookup
nslookup -type=A example.com
MX‑Record Lookup
nslookup -type=MX example.com
Reverse (PTR) Lookup
nslookup -type=PTR 8.8.8.8
Query a Specific DNS Server
nslookup example.com 1.1.1.1
Verbose Debug Output
nslookup -debug example.com
See Also