Skip to content
Knowledge Base

nslookup is a command-line tool used to query DNS (Domain Name System). It lets you find the IP address of a domain, perform reverse lookups, and query specific DNS records.

Query a specific DNS server Find the IP address (A record) Find IPv6 address (AAAA record) Find MX (Mail Exchange) records Find NS (Name Server) records Find TXT records

Updated 1 min readLinux Command

bash
nslookup google.com

Query a specific DNS server

bash
nslookup google.com 8.8.8.8

Find the IP address (A record)

bash
nslookup -type=A google.com

Find IPv6 address (AAAA record)

bash
nslookup -type=AAAA google.com

Find MX (Mail Exchange) records

bash
nslookup -type=MX gmail.com

Find NS (Name Server) records

bash
nslookup -type=NS google.com

Find TXT records

bash
nslookup -type=TXT google.com

#Useful for checking:

  • SPF
  • DKIM
  • Domain verification

Find CNAME

bash
nslookup -type=CNAME www.github.com

Reverse DNS lookup

Given an IP address, find the hostname.

bash
nslookup 8.8.8.8

Check if a domain resolves

bash
nslookup example.com

Troubleshooting with different DNS servers

Compare results from different resolvers:

bash
nslookup example.com 8.8.8.8
nslookup example.com 1.1.1.1
nslookup example.com 9.9.9.9
text
Common record types
Type	Purpose
A	    IPv4 address
AAAA	IPv6 address
MX	    Mail server
NS	    Name servers
TXT	    Text records (SPF, DKIM, verification)
CNAME	Canonical name (alias)
SOA	    Start of Authority
PTR	    Reverse DNS lookup
linux-command/nslookup.md