Skip to main content

nslookup command

Detailed Explanation

nslookup (name server lookup) is a network administration command-line tool for querying the Domain Name System (DNS) to obtain domain name or IP address mapping, or other DNS records. It operates in two modes: interactive and non-interactive.

Basic Syntax

nslookup [options] [domain-name] [server]

Common Flags/Options

OptionDescription
-querytype=<type>Specify the DNS record type to query (e.g., A, MX, NS, TXT).
-timeout=<seconds>Set the timeout for a query.
-debugShow debugging information for the query.

Real-world Examples

Find the IP address of a domain (A record):

nslookup google.com

Reverse DNS lookup (find domain from IP):

nslookup 8.8.8.8

Query for MX (Mail Exchange) records:

nslookup -querytype=MX google.com

Query a specific DNS server (e.g., Cloudflare's 1.1.1.1):

nslookup example.com 1.1.1.1