15%

Save 15% on All Hosting Services

Test your skills and get Discount on any hosting plan

Use code:

Skills
Get Started
30.10.2024

What Is NSLOOKUP and How to Use It: The Complete DNS Troubleshooting Guide

DNS issues are among the most frustrating problems in web infrastructure — and they're often invisible until something breaks. Whether a website suddenly stops loading, emails bounce back, or a newly configured server refuses to resolve, the culprit is almost always a misconfigured or misbehaving DNS record. That's where NSLOOKUP comes in.

NSLOOKUP (Name Server Lookup) is a battle-tested, cross-platform command-line utility that lets you query DNS servers directly, inspect DNS records in real time, and diagnose resolution problems before they escalate. In this comprehensive guide, you'll learn exactly what NSLOOKUP is, how it works under the hood, and how to use it effectively — from basic lookups to advanced troubleshooting techniques.

What Is NSLOOKUP?

NSLOOKUP stands for Name Server Lookup. It is a command-line diagnostic tool built into Windows, macOS, and Linux that allows users to query the Domain Name System (DNS) and retrieve detailed information about domain names, IP addresses, and DNS records.

At its core, NSLOOKUP lets you:

  • Resolve domain names to IP addresses — find the IP address associated with any domain.
  • Perform reverse DNS lookups — identify the domain name linked to a specific IP address.
  • Query specific DNS record types — including A, AAAA, MX, NS, CNAME, SOA, and TXT records.
  • Test DNS server responses — query any DNS server, not just your default one.
  • Verify DNS configurations — confirm that records are correctly set after changes.
  • Troubleshoot DNS propagation — check whether updated records have spread across the internet.

NSLOOKUP is indispensable for system administrators, DevOps engineers, web developers, and anyone managing hosting infrastructure. If you're running a VPS Hosting environment or a Dedicated Server, understanding NSLOOKUP is a fundamental skill for keeping your services online and properly configured.

How Does NSLOOKUP Work?

When you type a domain name into a browser, the Domain Name System (DNS) acts as the internet's phonebook — translating that human-readable name (e.g., example.com) into a machine-readable IP address (e.g., 93.184.216.34) so your device knows where to connect.

NSLOOKUP bypasses your browser and operating system's cached DNS responses, querying DNS servers directly and in real time. This makes it an accurate diagnostic tool that reflects the actual current state of DNS records.

Here's the typical resolution flow NSLOOKUP follows:

  1. You issue an NSLOOKUP command with a domain name or IP address.
  2. NSLOOKUP contacts the configured DNS resolver (or one you specify).
  3. The DNS resolver queries the appropriate authoritative name servers.
  4. The result — IP addresses, mail server records, name server details, etc. — is returned and displayed in your terminal.

NSLOOKUP also distinguishes between authoritative answers (coming directly from the domain's own name servers) and non-authoritative answers (coming from a caching resolver that has stored the result). This distinction is critical when troubleshooting propagation issues.

How to Use NSLOOKUP: Step-by-Step

1. Basic Domain Name Lookup

The most common use case: resolving a domain name to its IP address.

On Windows:

  1. Open Command Prompt — press Windows + R, type cmd, and hit Enter.
  2. Run the following command:
nslookup example.com

On macOS / Linux:

  1. Open Terminal — press Command + Space, type Terminal, and hit Enter.
  2. Run the same command:
nslookup example.com

Example Output:

Server:  dns.google
Address: 8.8.8.8

Non-authoritative answer:
Name:    example.com
Address: 93.184.216.34

Reading the output:

  • Server / Address — the DNS server that answered your query (in this case, Google's public DNS at 8.8.8.8).
  • Non-authoritative answer — the result came from a caching resolver, not the domain's own name server.
  • Name / Address — the resolved domain and its corresponding IP address.

2. Reverse DNS Lookup

A reverse DNS lookup does the opposite — it takes an IP address and returns the associated domain name. This is useful for identifying servers, verifying PTR records, and detecting spoofed or suspicious traffic.

nslookup 93.184.216.34

Example Output:

34.216.184.93.in-addr.arpa  name = example.com.

NSLOOKUP automatically queries the in-addr.arpa reverse DNS zone and returns the PTR record associated with that IP address.

> Pro Tip: If you're managing a mail server on a VPS or dedicated server, ensuring your reverse DNS (PTR record) is correctly configured is critical for email deliverability. Many spam filters reject emails from IPs without a valid PTR record.

3. Querying Specific DNS Record Types

NSLOOKUP can retrieve any type of DNS record. Here are the most important ones:

#### A Records (IPv4 Address)

nslookup -query=A example.com

Returns the IPv4 address(es) associated with the domain. This is the default query type.

#### AAAA Records (IPv6 Address)

nslookup -query=AAAA example.com

Returns the IPv6 address for the domain, useful when verifying dual-stack configurations.

#### MX Records (Mail Exchange)

MX records specify which mail servers are responsible for receiving email for a domain. This is essential when configuring or troubleshooting Email Hosting.

nslookup -query=MX example.com

Example Output:

example.com     mail exchanger = 10 mail.example.com.

The number (10) is the priority value — lower numbers indicate higher priority. If multiple MX records exist, mail is delivered to the highest-priority server first.

#### NS Records (Name Servers)

NS records identify the authoritative name servers for a domain. Querying these is the first step when diagnosing delegation or propagation issues.

nslookup -query=NS example.com

Example Output:

example.com     nameserver = ns1.example.com.
example.com     nameserver = ns2.example.com.

#### TXT Records

TXT records store text-based data associated with a domain. They are commonly used for:

  • SPF records — authorizing mail servers to send email on behalf of your domain.
  • DKIM records — cryptographic email authentication.
  • Domain verification — proving ownership to Google, Microsoft, and other services.
nslookup -query=TXT example.com

#### CNAME Records (Canonical Name)

CNAME records create aliases pointing one domain to another. Useful for subdomains like www pointing to the root domain.

nslookup -query=CNAME www.example.com

#### SOA Records (Start of Authority)

SOA records contain administrative information about a DNS zone, including the primary name server, the responsible party's email, and refresh intervals.

nslookup -query=SOA example.com

4. Querying a Specific DNS Server

By default, NSLOOKUP uses the DNS server configured on your device or network. You can override this to query any DNS server — invaluable for testing DNS propagation across different resolvers.

Syntax:

nslookup example.com [DNS_SERVER_IP]

Common public DNS servers to test against:

DNS ProviderPrimary IPSecondary IP
Google Public DNS8.8.8.88.8.4.4
Cloudflare DNS1.1.1.11.0.0.1
OpenDNS208.67.222.222208.67.220.220

Examples:

nslookup example.com 8.8.8.8
nslookup example.com 1.1.1.1
nslookup example.com 208.67.222.222

By comparing results across multiple DNS servers, you can determine whether a DNS change has fully propagated or is still cached in certain regions.

5. Using NSLOOKUP in Interactive Mode

NSLOOKUP's interactive mode allows you to run multiple queries in a single session without re-entering the command each time. This is particularly efficient when performing a series of diagnostic checks.

To enter interactive mode:

nslookup

You'll see a > prompt. From here, you can type commands directly:

> example.com
> set querytype=MX
> google.com
> set querytype=NS
> cloudflare.com
> server 1.1.1.1
> example.com

Useful interactive mode commands:

CommandDescription
set querytype=AQuery for IPv4 address records
set querytype=AAAAQuery for IPv6 address records
set querytype=MXQuery for mail exchange records
set querytype=NSQuery for name server records
set querytype=TXTQuery for text records
set querytype=CNAMEQuery for canonical name records
set querytype=SOAQuery for start of authority records
set querytype=ANYQuery for all available record types
server [IP]Switch to a different DNS server
set timeout=[seconds]Set the query timeout duration
set retry=[number]Set the number of retries on failure
set debugEnable verbose debug output
exitExit interactive mode

To exit interactive mode, type exit or press Ctrl + C.

NSLOOKUP Command Reference

Here's a quick-reference table of the most useful NSLOOKUP commands and flags:

CommandPurpose
nslookup example.comBasic forward DNS lookup
nslookup 93.184.216.34Reverse DNS lookup
nslookup -query=MX example.comQuery MX records
nslookup -query=NS example.comQuery NS records
nslookup -query=TXT example.comQuery TXT records
nslookup -query=AAAA example.comQuery IPv6 records
nslookup -query=SOA example.comQuery SOA records
nslookup -query=ANY example.comQuery all record types
nslookup example.com 8.8.8.8Query using Google DNS
nslookup -debug example.comEnable debug/verbose mode
nslookup -timeout=10 example.comSet 10-second query timeout

Real-World Use Cases for NSLOOKUP

1. Troubleshooting Website Loading Failures

When a website fails to load, the problem could be a DNS misconfiguration, a propagation delay, or a server-side issue. NSLOOKUP helps you isolate the cause:

  • Run nslookup yourdomain.com — does it return the expected IP?
  • Query multiple DNS servers to check for inconsistencies.
  • Compare the returned IP against your server's actual IP address.

If NSLOOKUP returns the correct IP but the site still won't load, the issue is likely at the server level, not DNS.

2. Verifying DNS Records After Configuration Changes

After setting up a new domain, migrating a website, or reconfiguring DNS records, NSLOOKUP lets you confirm that everything is in order. This is especially important when:

  • Launching a new website on Shared Web Hosting or a VPS.
  • Pointing a domain to a new server IP.
  • Configuring MX records for email delivery.
  • Adding TXT records for SPF, DKIM, or domain verification.

3. Checking DNS Propagation

DNS changes don't take effect globally the instant you save them — propagation can take anywhere from a few minutes to 48 hours, depending on the TTL (Time to Live) values of your records. NSLOOKUP lets you check propagation status by querying different DNS servers around the world:

nslookup example.com 8.8.8.8       # Google DNS (US)
nslookup example.com 1.1.1.1       # Cloudflare DNS (Global)
nslookup example.com 208.67.222.222 # OpenDNS

If different servers return different IPs, propagation is still in progress.

4. Validating SSL Certificate Domain Configuration

Before installing an SSL Certificate, you need to confirm that your domain's A record correctly points to your server's IP address. If the DNS isn't resolving properly, certificate issuance will fail. NSLOOKUP gives you an instant verification check.

5. Diagnosing Email Delivery Problems

If emails are bouncing or not being received, NSLOOKUP can help you verify:

  • MX records — are they pointing to the correct mail server?
  • TXT records — are SPF and DKIM records present and correct?
  • PTR records — does your mail server's IP have a valid reverse DNS entry?

6. Identifying Unauthorized DNS Changes

If a domain is resolving to an unexpected IP address, it could indicate DNS hijacking or an unauthorized configuration change. NSLOOKUP lets you quickly compare current DNS responses against your expected settings.

NSLOOKUP vs. DIG: Which Should You Use?

While NSLOOKUP is universally available and beginner-friendly, DIG (Domain Information Groper) is the preferred tool among experienced Linux/Unix administrators for its more detailed and scriptable output.

FeatureNSLOOKUPDIG
AvailabilityWindows, macOS, LinuxmacOS, Linux (install on Windows)
Output verbosityModerateHighly detailed
ScriptabilityLimitedExcellent
Ease of useBeginner-friendlyIntermediate
Interactive modeYesNo
Default on WindowsYesNo

For quick checks and cross-platform use, NSLOOKUP is ideal. For deep diagnostic work on Linux servers, DIG is often preferred. On a VPS with cPanel, both tools are typically available.

Common NSLOOKUP Errors and What They Mean

Error MessageLikely CauseSolution
** server can't find example.com: NXDOMAINDomain does not exist or is not registeredVerify the domain name; check Domain Registration status
** server can't find example.com: SERVFAILDNS server encountered an errorTry a different DNS server; check name server configuration
** server can't find example.com: REFUSEDDNS server refused the queryThe server may not allow recursive queries from your IP
Request to [server] timed outDNS server is unreachable or slowCheck network connectivity; try an alternative DNS server
Non-authoritative answerResponse came from a caching resolverNormal behavior; query the authoritative NS directly for definitive results
No response from serverFirewall blocking DNS (port 53)Check firewall rules on your server or network

Best Practices When Using NSLOOKUP

  1. Always query multiple DNS servers — never rely on a single resolver's response when diagnosing propagation issues.
  2. Check TTL values — high TTL values mean cached records persist longer; plan DNS changes accordingly.
  3. Use debug mode for detailed outputnslookup -debug example.com reveals the full query/response exchange.
  4. Verify both forward and reverse DNS — especially critical for mail servers and SSL Certificates.
  5. Document your DNS records — maintain a record of your expected DNS configuration so you can quickly spot discrepancies.
  6. Test before and after changes — run NSLOOKUP before making DNS changes to establish a baseline, then verify afterward.

Conclusion

NSLOOKUP is one of the most essential tools in any system administrator's or developer's toolkit. Whether you're diagnosing a website that won't load, verifying email server configuration, confirming SSL certificate prerequisites, or monitoring DNS propagation after a migration, NSLOOKUP gives you direct, real-time visibility into the DNS layer of your infrastructure.

Mastering NSLOOKUP — from basic forward lookups to advanced record-type queries and interactive mode sessions — puts you in control of your DNS environment and dramatically reduces the time it takes to diagnose and resolve issues.

If you're managing web infrastructure and need a reliable hosting foundation to go with your DNS expertise, AlexHost offers a full range of solutions — from Shared Web Hosting for simple websites to high-performance Dedicated Servers for demanding workloads — all backed by expert support and robust network infrastructure.

15%

Save 15% on All Hosting Services

Test your skills and get Discount on any hosting plan

Use code:

Skills
Get Started