The nslookup command queries a DNS server for a hostname’s records or an IP address’s reverse record. Run nslookup example.com for a basic lookup, or nslookup example.com 1.1.1.1 to query a specific resolver. To diagnose failures, compare the same record type across resolvers, then distinguish NXDOMAIN, missing records and timeouts before changing settings. See Microsoft’s syntax and error reference.
Start with the hostname and record your application needs. Identify which server answered, interpret the response, and use that evidence to choose the next check. This separates local command problems from DNS configuration problems and failures after resolution.
Key Facts
- The second positional argument selects the DNS server for a lookup. Microsoft
nslookupreference. Arecords contain IPv4 addresses;AAAArecords contain IPv6 addresses. RFC 1035 section 3.4.1; RFC 3596 section 2.NXDOMAINreports that a name does not exist. If resolution follows aCNAMEchain, the nonexistent name can be its final target rather than the alias originally entered.NODATAmeans that the requested record type is absent at the name reached. RFC 2308 section 2.- Non-authoritative answers are normal responses from recursive resolvers; the label alone does not establish that an answer was cached. DNS header and
AAflag. - An
ANYquery cannot reliably enumerate every DNS record. RFC 8482 section 4. - Successful DNS resolution does not establish that an HTTP service works. RFC 9110 HTTPS access model.
How do you run your first nslookup command?
Pass a hostname as the first argument and, optionally, a DNS server as the second. Without a server argument, nslookup uses its default DNS server, as documented in Microsoft’s command reference.
nslookup example.com
nslookup example.com 1.1.1.1
Use example.com, not https://example.com/account: the input is a DNS name rather than a web page URL. The general form is nslookup [options] name [server]. Cloudflare lists 1.1.1.1 as a public resolver address in its official resolver documentation.
For an exact fully qualified name, include the trailing dot: example.com.. Without it, nslookup can apply configured DNS search suffixes. Keep the trailing dot, record type and resolver consistent when comparing results. See the BIND search behavior documentation.
Read the response in two parts: the initial server information identifies the resolver; the answer describes the requested name. The default lookup on Ubuntu 24.04 returned this resolver line:
Server: 127.0.0.53
The lookup with an explicit resolver returned:
Server: 1.1.1.1
Both responses included this answer label:
Non-authoritative answer:
- Resolver identity: these
Serverlines identify the DNS endpoint used, not the website’s destination address. - Answer status: the non-authoritative label is normal for recursive resolution. It does not by itself prove a cache hit; see the DNS header definition.
- Answer records: both lookups returned two
Arecords and twoAAAArecords forexample.com. Addresses can change over time.
Our IP address lookup guide explains the broader distinction between names and addresses.
A DNS answer does not establish HTTP availability. A client still needs to connect and exchange application traffic; HTTPS also requires a secure connection. These are separate stages in RFC 9110’s HTTPS access model.

How do you query the record you actually need?
Specify the record type instead of relying on a default lookup. An IPv4 question and a mail-routing question require different answers.
nslookup -type=a example.com.
nslookup -type=aaaa example.com.
nslookup -type=mx gmail.com.
nslookup -type=txt example.com.
nslookup -type=ns example.com.
nslookup -type=soa example.com.
The -type option selects the query type in the BIND nslookup manual. Interpret each result according to the record’s purpose:
| Type | What it describes | Practical question |
|---|---|---|
A |
IPv4 address | Which IPv4 destination is published? |
AAAA |
IPv6 address | Is an IPv6 destination published? |
MX |
Mail exchanger and preference | Where should incoming mail go? |
TXT |
Text strings | Is the expected text present at this exact name? |
NS |
Authoritative name server | Which servers are named for this domain? |
SOA |
Zone authority and maintenance fields | What serial and zone parameters are published? |
RFC 1035 defines MX, NS, SOA and TXT in section 3.3, and A records in section 3.4.1. RFC 3596 section 2 defines AAAA records. For address-family context, see our IPv4 and IPv6 guide.
For reverse DNS, pass an IP address:
nslookup 1.1.1.1
This requests reverse naming information through PTR records. It does not inventory every domain hosted at that address. Forward and reverse mappings are separate DNS data, described in RFC 1035’s reverse-mapping section.
Interactive mode and repeated lookups
Start nslookup without arguments, then enter the remaining lines individually. Server selection and query type remain in effect until changed:
nslookup
server 1.1.1.1
set type=mx
gmail.com.
exit
The BIND interactive-command reference documents these commands. Use exit to leave interactive mode. In a typical terminal, Ctrl+C interrupts a foreground command; Bash’s signal documentation explains the shell behavior.
For multiple hosts, keep the loop in your shell. In Bash:
for host in example.com. example.org.; do
nslookup -type=a "$host" 1.1.1.1
done
In PowerShell:
'example.com.', 'example.org.' | ForEach-Object {
nslookup -type=a $_ 1.1.1.1
}
These use Bash’s for loop and PowerShell’s ForEach-Object.
How do you read the output correctly?
After identifying the resolver, inspect aliases and record-specific fields:
- Aliases: a
CNAMEpoints to a canonical name. The alias is the record’s owner; its value names the target. See RFC 1035’sCNAMEdefinition. - Mail routing: lower
MXpreference numbers are preferred. Read the preference together with its mail exchanger hostname, as described in RFC 1035’sMXdefinition. - Address families: an
Aanswer describes IPv4 destinations; anAAAAanswer describes IPv6 destinations. One type can be present while the other is absent.
Do not use ANY as a completeness check. Servers can return a subset of records or a synthesized response. RFC 8482 permits minimal responses. Ask for the specific type you need.
To inspect response details, enable debugging while keeping the name, type and resolver fixed:
nslookup -debug -type=a example.com. 1.1.1.1
Inspect the response code, answer records and TTLs. Repeat against another permitted resolver. Different answers or TTLs are clues to investigate, not proof of a fault. Microsoft documents additional response information in its debug option reference.
Preserve the complete response when recording an incident. Include the query, resolver, time and network context so another administrator can repeat the same question.
How do you diagnose nslookup command failures?
Classify the symptom before changing settings. These checks help identify the responsible component:
| Symptom | Check | Meaning | Fix or owner |
|---|---|---|---|
| Command not found | Executable discovery and package installation | Local command discovery failed; see shell command search. | Client: repair installation or PATH. |
NXDOMAIN |
Spelling, resolver and alias targets | The queried name, or the final target of a CNAME chain, is reported nonexistent. See RFC 2308. |
Client checks spelling; DNS owner checks the queried name and any CNAME target. |
| No requested records | Query A and the required type separately |
A name can exist without that type: NODATA. |
DNS owner adds a record only if the service needs it. |
| Timeout | Known-good name and alternate permitted resolver | No timely response; investigate the resolver and network path. | Administrator checks service and UDP/TCP port 53. See DNS transport requirements. |
Non-authoritative answer |
Identify the responding resolver | Normal for recursive responses; see the AA flag. |
No repair required for this label alone. |
| Resolvers disagree | Compare type, TTL and split DNS | Cache state, policy or location can differ; see DNS resolver terminology. | Administrator checks intended configuration. |
| DNS works; application fails | Application resolver, proxy and connection | The application may use a different resolution or transport path. | Investigate that path, server or CDN; HTTP routing involves more than DNS. |
Inspect any returned CNAME records before deciding which name needs correction. NODATA is inferred from a NOERROR response with no records answering the requested type, after ruling out a referral; it is not a separate response code. An empty address listing alone is insufficient. See RFC 2308 section 2.
For an NXDOMAIN check, repeat the fully qualified name with its trailing dot, record type and resolver. A missing AAAA record does not establish that the whole name is absent. For browser-specific checks, use the NXDOMAIN troubleshooting guide.
To inspect a lookup under the reserved .invalid domain without search-suffix expansion, run:
nslookup missing.invalid.
The expected DNS result is NXDOMAIN, according to RFC 6761 section 6.4. Record the actual response: a timeout or local command failure does not establish that a DNS server returned NXDOMAIN.
A lookup of missing.invalid returned this response with exit status 1:
** server can't find missing.invalid: NXDOMAIN
Use an alternate resolver only where permitted. Private names and split DNS may intentionally produce different answers inside and outside an organization, as RFC 9499 explains.
If a browser disagrees, inspect whether it uses another DNS endpoint. RFC 8484 discusses resolution-path differences; our DNS-over-HTTPS guide adds context. If resolution succeeds but the connection is refused, continue with connection-refused troubleshooting.
For a proxy connection, identify where hostname resolution happens. The curl manual distinguishes proxy-side resolution with --socks5-hostname from local resolution with --socks5. Local nslookup cannot validate that connection. Follow the proxy connection troubleshooting guide.
Fix nslookup command not found on Windows, macOS and Linux
Check executable discovery before investigating DNS traffic. If the command never starts, changing DNS records cannot fix that local problem.
Windows
In Command Prompt or PowerShell, check whether Windows can locate the executable:
where.exe nslookup.exe
By default, where.exe searches the current directory and PATH. See Microsoft’s command reference. In PowerShell, you can also inspect command discovery with:
Get-Command nslookup.exe
Get-Command identifies discoverable applications. If discovery fails, have the administrator check executable availability and PATH.
For a PowerShell alternative with explicit DNS-only behavior:
Resolve-DnsName -Name example.com. -Type A -Server 1.1.1.1 -DnsOnly
Microsoft documents -Name, -Type, -Server and -DnsOnly in the Resolve-DnsName reference.
macOS
Apple documents using nslookup in Terminal in its DNS text-record instructions. Check command discovery and inspect the installed manual:
command -v nslookup
man nslookup
If discovery returns no path, ask the administrator to check executable availability and the active shell’s PATH. A missing manual is a separate issue. Read the installed manual’s resolver caveats before interpreting differences between nslookup and an application.
Compare the same fully qualified hostname and record type while reproducing the application failure on the same network. Inspect DNS servers and search domains using Apple’s DNS settings instructions: open System Settings, select Network, select the network service, open Details, then select DNS. Also inspect the application’s DNS, VPN and proxy configuration.
Linux
Ubuntu 24.04 and Debian trixie list bind9-dnsutils in their official package catalogs: Ubuntu and Debian. On those distributions:
sudo apt update
sudo apt install bind9-dnsutils
Fedora lists bind-utils; Red Hat also documents that package in its RHEL 9 DNS guidance:
sudo dnf install bind-utils
Use the package manager for the actual distribution and release. After installation, retry the original query before changing resolver settings.
When should you choose nslookup, dig, Resolve-DnsName or ping?
Choose according to the question. These checks are complementary:
| Tool | Use when | Limitation |
|---|---|---|
nslookup |
You need a direct record or resolver comparison. | Does not prove that a web request succeeds. |
dig |
You need DNS headers, flags and TTL details. | Extra output can obscure a simple answer. |
Resolve-DnsName |
You want DNS results as PowerShell objects. | Not portable across all shells and platforms. |
ping |
You want to check ICMP echo responses. | Does not query mail or text records or establish HTTP availability. |
See the BIND dig manual, Resolve-DnsName reference and Microsoft ping reference.
How do you verify the fix?
Repeat the identical fully qualified name, record type and resolver, then retry the affected application. Change one variable at a time:
nslookup -type=a example.com. 1.1.1.1
For an incident, retain the date, operating system, tool version, resolver, network context and complete output. These observations are a snapshot of the failure and recovery.
For a DNS change, ask the owner to confirm the authoritative data and account for cached answers. Negative responses can also be cached, as RFC 2308 explains. Avoid repeatedly changing settings while waiting for an existing cached response to expire.
Close the investigation when the intended application works on its intended network path. If DNS is correct but the request still fails, preserve the evidence and continue with the connection or application owner.
Frequently Asked Questions
How do I check DNS with nslookup?
Start with nslookup example.com., replacing the hostname with the one you are investigating. Specify the relevant record type and note which resolver answered. See Microsoft’s nslookup reference.
How do I specify a DNS server?
Put the resolver after the hostname: nslookup -type=a example.com. 1.1.1.1. Keep the trailing dot and record type unchanged when comparing permitted resolvers. See Microsoft’s argument syntax.
What is the 1.1.1.1 DNS server?
It is a public DNS resolver address operated by Cloudflare, as listed in Cloudflare’s documentation. As the second argument to nslookup, it selects the server answering your query.
What are the four types of DNS?
That wording often refers to four server roles:
| Role | Function |
|---|---|
| Recursive resolver | Returns cached answers or performs resolution |
| Root nameserver | Authoritative for the root zone; provides TLD referrals |
| TLD nameserver | Authoritative for a TLD zone; provides delegation information |
| Domain authoritative nameserver | Answers from the zones it serves |
Root and TLD servers are also authoritative servers. See RFC 9499 section 6 and Cloudflare’s explanation. Record types are a separate classification, including A, AAAA, MX and TXT.
Can nslookup show my DNS history?
A current lookup cannot reconstruct previous answers or browsing history. Historical investigation requires records retained before the incident.
Does an unexpected answer mean DNS was hacked?
An unexpected answer is a reason to investigate, not proof of compromise. Compare the intended authoritative configuration, resolver policy and network context.
Why does a website fail when nslookup works?
The application may resolve differently or fail later during connection establishment, TLS or HTTP processing. See RFC 8484 on resolution differences and RFC 9110 on HTTPS access.
How do I exit nslookup?
Enter exit at the interactive prompt. A lookup started with a hostname normally returns to the shell after completing. See the BIND nslookup manual.
Troubleshoot the path your application actually uses
If your application uses DataImpulse proxies, identify where the hostname is resolved, then use the proxy troubleshooting checklist to investigate the connection. A successful nslookup provides DNS evidence; validating the entire request also requires checking the application’s network path.
Last updated: November 18, 2026.
