The nslookup command asks a DNS server one question and shows you who answered and what came back. It ships with Windows, macOS, and most Linux distributions, so it is the fastest way to see whether a name resolves before you blame a firewall, a certificate, or an application.

To use it, type nslookup name [server]: add -type=MX, -type=TXT, or another record type to change the question, and add a resolver address at the end to choose which DNS server answers. Those two levers cover most real DNS triage, from a missing MX record to a stale A record that a change did not replace.
At PacketTools, the same lookups run against production networks every day to verify VPN name resolution, routing changes, and mail records. The examples below use documentation-reserved names and addresses (example.com, 192.0.2.0/24, 2001:db8::/32), so you can map each one onto your own domains without guessing what is real.
How Do You Look Up a Domain or IP Address?
You pass a domain name to get its addresses, or pass an IP address to get its hostname from a PTR record. The command looks the same on every operating system, and only the default resolver and a few output details change between platforms.
Basic Syntax and Your First Annotated Lookup
The noninteractive form puts everything on one line:
nslookup [-option ...] name [server]
Microsoft documents the order plainly: in noninteractive mode, the first parameter is the name or IP address to look up and the second is the DNS server to query. Leave the second argument off and nslookup uses your system’s default resolver.
Here is a basic forward lookup with each part annotated:
nslookup www.example.com
Server: 192.0.2.53 <- resolver that answered
Address: 192.0.2.53#53 <- its IP and port (53 = DNS)
Non-authoritative answer: <- came from cache or recursion
Name: www.example.com <- name you asked about
Address: 192.0.2.10 <- A record (IPv4)
Address: 2001:db8::10 <- AAAA record (IPv6), if present
Read the top two lines first. If the Server line shows an address you did not expect, such as a VPN resolver or an old router, the answer below it reflects that resolver’s view, which may differ from the internet’s.
Running Queries on Windows, macOS, and Linux
The command and flags are the same everywhere, but where the default resolver comes from differs:
| Platform | Default resolver source | Built-in help |
|---|---|---|
| Windows | Adapter DNS settings | nslookup /? |
| macOS | System network configuration | man nslookup |
| Linux | /etc/resolv.conf (often a local stub such as 127.0.0.53) |
man nslookup |
On Linux, a Server: 127.0.0.53 line means you are talking to systemd-resolved, which forwards to the upstream servers. If results look odd, query an upstream resolver directly to rule out the stub. If nslookup is missing on a minimal Linux image, it comes with the dnsutils package on Debian and Ubuntu and bind-utils on Fedora and RHEL.
Windows prints Server: UnKnown when it cannot reverse-resolve its own resolver’s address. That line is cosmetic; the lookup still works. Before blaming DNS on a laptop, confirm which network you are on with a what is my IP check, since a split-tunnel VPN changes both your public address and your resolver.
Finding a Hostname With a Reverse DNS Lookup
Give nslookup an IP address and it queries the PTR record automatically:
nslookup 192.0.2.25
25.2.0.192.in-addr.arpa name = mail.example.com.
nslookup reverses the octets and appends in-addr.arpa for you. You can write the query explicitly, which helps when you are checking delegated reverse zones:
nslookup -type=PTR 25.2.0.192.in-addr.arpa
For IPv6, PTR names live under ip6.arpa with every nibble reversed, so passing the plain IPv6 address is far less error-prone. Reverse records matter most for outbound mail: a sending server whose PTR is missing or does not match its forward A record gets rejected or scored as spam by many receivers. Check both directions, PTR to name and name back to the same IP, and pair the result with a WHOIS IP lookup when you need to know who controls the address block.
How Do You Query Specific DNS Record Types?

Add -type= (or -query=) before the name to ask for a specific record; without it, nslookup returns addresses. Each record type answers a different operational question, so pick the type that matches the symptom.
A, AAAA, and CNAME Queries for Addresses and Aliases
A records hold IPv4 addresses and AAAA records hold IPv6 addresses:
nslookup -type=A www.example.com
nslookup -type=AAAA www.example.com
www.example.com has AAAA address 2001:db8::10
Query both when a site works on one network and fails on another. A broken AAAA record breaks dual-stack clients that prefer IPv6 while IPv4-only users never notice; the IPv4 vs IPv6 differences explain why the symptom splits that way.
A CNAME makes one name an alias for another:
nslookup -type=CNAME shop.example.com
shop.example.com canonical name = stores.example.net.
If the name has no CNAME, you get No answer, which is correct for a name that holds A records directly. When you query a CNAME’d name for its A record, nslookup follows the chain and lists the alias line before the address, so you can see every hop to the final target.
NS and SOA Queries for Zone Authority
NS records name the servers authoritative for a zone, and the SOA record describes the zone itself:
nslookup -type=NS example.com
example.com nameserver = ns1.example.com.
example.com nameserver = ns2.example.com.
nslookup -type=SOA example.com
primary name server = ns1.example.com
responsible mail addr = hostmaster.example.com
serial = 2026111001
refresh = 7200
retry = 3600
expire = 1209600
default TTL = 3600
The serial is the field you will use most. If two authoritative servers return different serials, a secondary has not picked up the latest zone transfer, and clients will see different answers depending on which server they hit. Compare the NS list against what your registrar shows; a mismatch points to a DNS delegation problem at the parent zone.
MX and TXT Queries for Mail Routing and Authentication
MX records tell senders where to deliver your mail, and the number before each host is its preference:
nslookup -type=MX example.com
example.com mail exchanger = 10 mx1.example.com.
example.com mail exchanger = 20 mx2.example.com.
Lower numbers win, so senders try mx1 first and fall back to mx2. Each MX target must resolve to an A or AAAA record; an MX pointing at a CNAME or a raw IP is a common misconfiguration.
TXT records carry SPF policies, domain verification tokens, and DMARC policies:
nslookup -type=TXT example.com
example.com text = "v=spf1 ip4:192.0.2.0/24 include:spf.example.net -all"
nslookup -type=TXT _dmarc.example.com
nslookup -type=TXT selector1._domainkey.example.com
DKIM keys sit under selector._domainkey, so you need the selector name from a message header or your mail platform. Watch for two separate v=spf1 strings on the root: receivers treat multiple SPF records as a permanent error.
Why an ANY Query Does Not Return Every Record
nslookup -type=ANY example.com asks for everything, but many resolvers and authoritative servers now answer with a minimal response or refuse it. RFC 8482 lets servers reply to ANY with a single record set, largely because ANY was abused for amplification attacks.
Treat ANY output as a sample. When you need the complete picture for a zone, query each type you care about (A, AAAA, CNAME, MX, TXT, NS, SOA, CAA) individually. A full map of DNS record types helps you build that checklist so nothing gets skipped.
How Do You Choose a Resolver and Run Repeated Queries?

Put a server address after the name for a one-off query, or open interactive mode when you plan to run several lookups against the same server. Choosing the resolver deliberately is how you separate “the record is wrong” from “my resolver is wrong.”
Specifying a DNS Server in a One-Off Query
The server goes last:
nslookup -type=MX example.com 8.8.8.8
nslookup www.example.com 1.1.1.1
nslookup www.example.com ns1.example.com
You can give an IP address or a hostname. A hostname has to be resolved first by your default resolver, so if that resolver is the thing failing, use the server’s IP. Non-standard ports are set with -port=5353, which is handy for testing a local resolver listening off port 53.
Comparing Local, Public, and Authoritative DNS Answers
Three queries tell you where a problem lives:
- Local resolver:
nslookup www.example.comshows what your clients see. - Public resolver:
nslookup www.example.com 8.8.8.8shows what a large outside cache sees. - Authoritative server:
nslookup www.example.com ns1.example.comshows what the zone says right now.
If the authoritative answer is correct and the public one is old, you are waiting on a cache to expire. If public is correct and local is wrong, check internal forwarders, split-horizon zones, or a VPN-pushed resolver, and review how you change DNS settings on the affected host. If even the authoritative server returns the old value, the change was never published.
Using Interactive Mode With Server, Set Type, and Exit
Run nslookup with no arguments (or nslookup - 192.0.2.53 to pick a server at launch) and you get a > prompt:
> server 8.8.8.8
Default server: 8.8.8.8
> set type=MX
> example.com
example.com mail exchanger = 10 mx1.example.com.
> set type=TXT
> _dmarc.example.com
_dmarc.example.com text = "v=DMARC1; p=quarantine"
> set all
> exit
set all prints current settings, which is useful when results look wrong because an earlier set is still active. set timeout=10 and set retry=3 help on lossy links. On Windows, interactive mode appends your search domain to names without a trailing dot, so type example.com. with the final period when you want an exact name.
What Do DNS Answers and Errors Actually Mean?
Every nslookup result tells you either where the answer came from or why there is no answer. Reading those labels correctly decides your next command.
Authoritative vs. Non-Authoritative Answers
Non-authoritative answer means a recursive resolver supplied the data from cache or by asking other servers for you. It is normal on nearly every query and the data is valid; it may simply lag a very recent change until the cached copy expires.
When you query a domain’s own name server directly, that label disappears because the server holds the zone. If you query ns1.example.com and still see Non-authoritative answer, that server is not authoritative for the zone, which usually means a stale NS record or a lame delegation. Whether a server will chase answers for you depends on DNS recursion being enabled for your client.
NXDOMAIN vs. No Answer: Missing Names and Missing Record Types
These two look similar and mean different things:
| Output | Meaning | Next check |
|---|---|---|
** server can't find name: NXDOMAIN (or Non-existent domain) |
The name does not exist in DNS at all | Spelling, registration status, the zone’s NS records |
*** Can't find name: No answer (or No records) |
The name exists, but has no record of the type you asked for | Query other types; add the missing record |
NXDOMAIN on a domain that should work often traces to an expired registration or a delegation to name servers that do not host the zone. Browsers surface the same failure as DNS_PROBE_FINISHED_NXDOMAIN. A No answer for AAAA on an IPv4-only host is expected, not a fault.
Timeouts, SERVFAIL, and REFUSED: Choosing the Next Check
- Timed out / no servers could be reached: nslookup got no reply. Test another resolver by IP; if that works, your default resolver is down or blocked. If nothing works, check that UDP and TCP port 53 are open outbound. The DNS server not responding fixes apply here.
- SERVFAIL (Server failure): the resolver tried and failed. Query the authoritative servers directly; if they answer, suspect a DNSSEC validation failure or a broken delegation chain.
- REFUSED: the server will not answer you, usually because it does not offer recursion to your network or is not authoritative for the zone. Use a resolver that serves your clients.
Using Debug Output and TTL Values to Investigate DNS Propagation
Add -debug to see the full response, including TTLs:
nslookup -debug www.example.com 8.8.8.8
ANSWERS:
-> www.example.com
internet address = 192.0.2.10
ttl = 2841
Run it twice against a recursive resolver and the TTL counts down, which confirms you are reading a cached copy. That number is roughly how many seconds remain before the resolver fetches a fresh answer. Query the authoritative server to see the full configured TTL. “Propagation” is mostly caches expiring on this schedule, so lowering a TTL a day before a planned change shortens the wait. Use -d2 when you need every packet field, and remember nslookup shows little DNSSEC detail.
When Should You Use Dig or PacketTools Instead?
Use nslookup for quick checks on any machine, switch to dig when you need full protocol detail, and use browser-based checks when you need answers from outside your own network. Each covers a gap the others leave.
Nslookup vs. Dig for Detailed DNS Inspection
| Criterion | nslookup | dig |
|---|---|---|
| Installed on Windows | Yes | No (separate install) |
| Output | Short, readable | Full sections and flags |
| Delegation trace | No | +trace |
| DNSSEC detail | Limited | +dnssec, ad flag |
| Script-friendly output | Harder to parse | +short |
Reach for dig when an answer is wrong and you need to see the aa flag, the exact response code, or each delegation step from the root down.
Cross-Checking Results With PacketTools DNS Lookup and DNS Propagation Checker
Your terminal only sees the resolvers your network can reach. The PacketTools DNS Lookup runs the same record queries from outside your network, and the DNS propagation checker compares answers across multiple resolvers at once, which nslookup cannot do in a single command. Neither logs your IP, queries, or test data, and no sign-in is required.
Extending Mail Checks With PacketTools Email Health and SuperTool
nslookup shows you raw SPF, DKIM, and DMARC strings but does not evaluate them. PacketTools Email Health checks those records together, and SuperTool runs DNS, MX, SPF, DKIM, DMARC, blacklist, and SSL tests for a domain in one pass, so a syntax error in a TXT record surfaces next to its effect on delivery.
Verify the Record, the Resolver, and the Result
Every useful nslookup session confirms three things: you asked for the right record type, you asked the right resolver, and you read the result label correctly.
- Record: use
-type=for MX, TXT, NS, SOA, CNAME, or AAAA, and query types one at a time when ANY comes back thin. - Resolver: compare your local resolver, a public one such as 8.8.8.8, and the authoritative name server to locate where answers diverge.
- Result:
Non-authoritative answeris normal, NXDOMAIN means the name is missing,No answermeans the record type is missing, and timeouts point at reachability before DNS configuration.
When those checks still leave a gap, -debug shows the TTL that controls how long a stale answer lingers, and the broader steps to troubleshoot DNS issues take you from a confirmed DNS fault to the fix.

Leave a Reply