Skip to main content

nslookup Cheatsheet

By Dejan Panovski Updated on Download PDF

Quick reference for querying DNS records and checking name resolution with nslookup

The `nslookup` command queries DNS servers for domain and reverse lookup records. This cheatsheet covers quick host lookups, record type queries, reverse DNS, interactive mode, and a few practical troubleshooting checks.

Basic Syntax

Core nslookup command forms.

CommandDescription
nslookup example.comLook up a domain using the default resolver
nslookup example.com 8.8.8.8Query a specific DNS server
nslookup -type=mx example.comQuery a specific record type
nslookup 192.0.2.1Run a reverse DNS lookup
nslookupStart interactive mode

Common Lookups

Quick checks for hostnames and addresses.

CommandDescription
nslookup example.comLook up A and AAAA records using the default resolver
nslookup www.example.comCheck a hostname or subdomain
nslookup localhostVerify local name resolution
nslookup 127.0.0.1Reverse lookup for the local loopback address
nslookup 192.0.2.1Reverse lookup for a public IP address

Record Types

Use -type to query specific DNS records.

CommandDescription
nslookup -type=a example.comQuery IPv4 address records
nslookup -type=aaaa example.comQuery IPv6 address records
nslookup -type=mx example.comQuery mail exchanger records
nslookup -type=ns example.comQuery authoritative name servers
nslookup -type=txt example.comQuery TXT records
nslookup -type=soa example.comQuery the SOA record
nslookup -type=cname www.example.comCheck whether a hostname is an alias
nslookup -type=any example.comRun an ANY query

Specific DNS Servers

Compare answers from different resolvers.

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

Interactive Mode

Run multiple queries in one session.

CommandDescription
nslookupOpen interactive mode
set type=mxSwitch the active query type to MX
set type=txtSwitch the active query type to TXT
server 8.8.8.8Change the active DNS server
example.comQuery a domain after entering interactive mode
exitLeave the interactive session

Troubleshooting

Quick checks for common nslookup errors.

IssueCheck
NXDOMAINVerify the domain name and make sure it exists
SERVFAILTry another resolver such as 8.8.8.8 or 1.1.1.1
Connection timed out; no servers could be reachedCheck network access and verify /etc/resolv.conf
Non-authoritative answerNormal cached response from a resolver
No answerThe queried record type is not set for that name

Use these guides for fuller DNS troubleshooting workflows.

GuideDescription
nslookup Command in LinuxFull nslookup guide with practical examples
How to Use the dig Command to Query DNS in LinuxDetailed dig guide for deeper DNS debugging
ping CheatsheetQuick connectivity checks before DNS troubleshooting
IP command cheatsheetInspect interfaces, addresses, and routes
curl CheatsheetTest HTTP reachability after DNS resolution succeeds