General

nslookup Cheatsheet

Basic Syntax

Core nslookup command forms.

Command Description
nslookup example.com Look up a domain using the default resolver
nslookup example.com 8.8.8.8 Query a specific DNS server
nslookup -type=mx example.com Query a specific record type
nslookup 192.0.2.1 Run a reverse DNS lookup
nslookup Start interactive mode

Common Lookups

Quick checks for hostnames and addresses.

Command Description
nslookup example.com Look up A and AAAA records using the default resolver
nslookup www.example.com Check a hostname or subdomain
nslookup localhost Verify local name resolution
nslookup 127.0.0.1 Reverse lookup for the local loopback address
nslookup 192.0.2.1 Reverse lookup for a public IP address

Record Types

Use -type to query specific DNS records.

Command Description
nslookup -type=a example.com Query IPv4 address records
nslookup -type=aaaa example.com Query IPv6 address records
nslookup -type=mx example.com Query mail exchanger records
nslookup -type=ns example.com Query authoritative name servers
nslookup -type=txt example.com Query TXT records
nslookup -type=soa example.com Query the SOA record
nslookup -type=cname www.example.com Check whether a hostname is an alias
nslookup -type=any example.com Run an ANY query

Specific DNS Servers

Compare answers from different resolvers.

Command Description
nslookup example.com 8.8.8.8 Query Google Public DNS
nslookup example.com 1.1.1.1 Query Cloudflare DNS
nslookup example.com 9.9.9.9 Query Quad9
nslookup -type=mx example.com 8.8.8.8 Query MX records from a specific resolver
nslookup -type=txt example.com 1.1.1.1 Compare TXT answers between resolvers

Interactive Mode

Run multiple queries in one session.

Command Description
nslookup Open interactive mode
set type=mx Switch the active query type to MX
set type=txt Switch the active query type to TXT
server 8.8.8.8 Change the active DNS server
example.com Query a domain after entering interactive mode
exit Leave the interactive session

Troubleshooting

Quick checks for common nslookup errors.

Issue Check
NXDOMAIN Verify the domain name and make sure it exists
SERVFAIL Try another resolver such as 8.8.8.8 or 1.1.1.1
Connection timed out; no servers could be reached Check network access and verify /etc/resolv.conf
Non-authoritative answer Normal cached response from a resolver
No answer The queried record type is not set for that name

Related Guides

Use these guides for fuller DNS troubleshooting workflows.

Guide Description
nslookup Command in Linux Full nslookup guide with practical examples
How to Use the dig Command to Query DNS in Linux Detailed dig guide for deeper DNS debugging
ping Cheatsheet Quick connectivity checks before DNS troubleshooting
IP command cheatsheet Inspect interfaces, addresses, and routes
curl Cheatsheet Test HTTP reachability after DNS resolution succeeds
AI Assistant
Context loaded: nslookup Cheatsheet