Operations 5 min read

Mastering DNS Queries with nslookup: 10 Essential Commands

This guide walks you through ten practical nslookup commands for retrieving A, NS, SOA, MX, any, server-specific, reverse, PTR, timeout, and debug DNS records, complete with example syntax and screenshots to help you troubleshoot and verify DNS configurations.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Mastering DNS Queries with nslookup: 10 Essential Commands
Source: Network Engineer Alon

1. How to Find a Domain's A Record

Use nslookup to list A records and their IP addresses.

$ nslookup example.com
A record output
A record output

2. How to View a Domain's NS Records

Checking NS records reveals the authoritative name servers for the domain.

$ nslookup -type=ns example.com
NS record output
NS record output

3. How to Query a Domain's SOA Record

The SOA record shows the start of authority and zone information.

$ nslookup -type=soa example.com
SOA record output
SOA record output

4. How to Find MX Records for Email Exchange

MX records list the mail servers responsible for receiving email for the domain.

$ nslookup -query=mx example.com
MX record output
MX record output

5. How to Retrieve All Available DNS Records

Querying with type=any returns every DNS record type for the domain.

$ nslookup -type=any example.com
All records output
All records output

6. How to Check a Specific DNS Server's Responsiveness

Use nslookup to query a particular DNS server and see if it answers.

$ nslookup example.com ns1.nsexample.com
Specific DNS server query
Specific DNS server query

7. How to Perform a Reverse DNS Lookup

Reverse lookup verifies which domain name is associated with an IP address.

$ nslookup 10.20.30.40
Reverse lookup output
Reverse lookup output

8. How to View PTR Records

PTR records map an IP address back to its domain name; they are stored under the in-addr.arpa zone.

$ nslookup -type=ptr 96.96.136.185.in-addr.arpa
PTR record output
PTR record output

9. How to Adjust the Query Timeout Interval

Modify the timeout (in seconds) to give the DNS server more or less time to respond.

$ nslookup -timeout=20 example.com
Timeout setting output
Timeout setting output

10. How to Enable Debug Mode

Debug mode provides detailed information about the query process and responses.

$ nslookup -debug example.com
Debug mode output
Debug mode output
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

network troubleshootingDNSSOAnslookupA RecordMXNS recordPTR
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.