nslookup

>Usage

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:

Dots

-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:

Dots

-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.

Example 1:

Dots

-timeout=<seconds>

> nslookup -timeout=5 www.example.com


Server: UnKnown

Address: 192.168.1.1

Non-authoritative answer: Name: www.example.com
Addresses: 93.184.216.34

Example 2:

Timeout (DNS Server Not Responding in Time)

Dots

-timeout=<seconds>

> nslookup -timeout=5 www.example.com


Server: UnKnown

Address: 192.168.1.1

** server can't find www.example.com: Timed out

server

The command server <DNS_server_IP> specifies a custom DNS server to query instead of the default system resolver.

Example:

Dots

server <DNS_server_IP>

> nslookup -server 8.8.8.8 www.nonexistentdomain.xyz


Server: google-public-dns-a.google.com Address: 8.8.8.8
Non-authoritative answer: Name: www.example.com

Addresses: 93.184.216.34

>Quiz

Progress: Question ? out of ?

Question Title

Page written by Marianna Dinon Spindola