Nslookup Command, which means “Name Server Lookup,” is a helpful command for retrieving information from the DNS server.
It serves as a network administration tool that queries the Domain Name System (DNS) to find domain name or IP address mappings, as well as other specific DNS records. Additionally, it is used to diagnose DNS-related issues.
What is nslookup?
The nslookup command is a unique tool for exploring the Internet’s phonebook. It allows you to inquire about websites and their connections. The main function of nslookup is to get detailed information about a specific domain. This information is crucial for solving DNS-related issues.
You can use it to:
- Find a website’s address: Similar to searching for a phone number in a phonebook, nslookup helps you locate a website’s IP address.
- Identify issues: If you’re having difficulty accessing a website, nslookup can assist in determining where the problem may be.
- Understand domain settings: By utilizing nslookup, you can learn about a website’s domain, including the servers that manage it.
Installing nslookup (If Not Available)
Prerequisites: Syntax of the nslookup Command in Linux
The nslookup command’s syntax is pretty simple, usually looking like this:
nslookup [option] [domain]
Where:
Get exclusive access to all things tech-savvy, and be the first to receive
the latest updates directly in your inbox.
- [options] are extra parameters that change how the command works.
- [domain] is the domain name or IP address you want to look up.
Now, install the nslookup Command
Newer Linux systems usually come with both dig and nslookup utilities by default, but older versions might not. These tools are often included in packages like bind-utils or dnsutils, which can be installed manually if they are absent.
sudo apt install dnsutils [On Debian, Ubuntu and Mint]<br>sudo dnf install bind-utils [On RHEL/CentOS/Fedora and Rocky/AlmaLinux]<br>sudo emerge -a sys-apps/dnsutils [On Gentoo Linux]<br>sudo apk add bind-tools [On Alpine Linux]<br>sudo pacman -Sy dnsutils [On Arch Linux]<br>sudo zypper install bind-utils [On OpenSUSE]<br>sudo pkg install dnsutils [On FreeBSD]<strong><br><br></strong>
How to Use nslookup in Linux
Nslookup commands are straightforward and user-friendly, needing just a basic grasp of the command-line interface. Follow these easy steps to use it effectively:
- Open Command Prompt or Terminal: Nslookup commands run through the command-line interface. Launch Command Prompt on Windows or Terminal on macOS and Linux.
- Enter Nslookup Command: Input “nslookup” followed by the domain name or IP address you wish to check.
- Interpret the Results: Nslookup will show details like the IP address of the domain you queried, its authoritative DNS server, and other related DNS records.
- Use Specific Options (Optional): Nslookup provides several options to narrow down your query. For example, adding “-type” followed by a record type (such as A, MX, NS) helps you get specific DNS record types.
- Exit: After you have the information you need, you can leave Nslookup by typing “exit” and hitting Enter.
To get information about a domain name with the nslookup tool, use this command.
nslookup fossmint.com<br>
To check a domain with a specific DNS server, like Cloudflare (1.1.1.1), use:
nslookup fossmint.com 1.1.1.1
If you want to do a reverse DNS lookup, just type an IP address instead of a domain name:
nslookup 104.27.179.254
To get the mail server (MX) records for a domain, use the -query=mx option:
nslookup -query=mx fossmint.com
Finally, to see TXT records, which are commonly used for SPF, DKIM, and domain verification, run:
nslookup -query=txt fossmint.com
Useful nslookup Command Examples
To locate the A record of a domain, run the command: $ nslookup example.com
to view the IP addresses.
To verify NS records and find the authoritative server, use: $ nslookup -type=ns example.com
.
To request the SOA record and get zone details, apply: $ nslookup -type=soa example.com
.

To discover MX records that handle email exchange, run: $ nslookup -query=mx example.com
.
To see all DNS records available for a domain, execute the command: $ nslookup -type=any example.com
.
To assess a specific DNS server’s performance, the command is: $ nslookup example.com ns1.nsexample.com
.
For reverse DNS lookups to confirm domain-IP connections, use: $ nslookup 10.20.30.40
and to check a PTR record, apply: $ nslookup -type=ptr 96.96.136.185.in-addr.arpa
.
You can adjust the timeout for replies with: $ nslookup -timeout=20 example.com
and activate debug mode using: $ nslookup -debug example.com
.
Troubleshooting With nslookup
- Timed out: The server did not reply to a request within a specific time frame and after a set number of retries. You can adjust the timeout duration using the nslookup set timeout command. The number of retries can be modified with the nslookup set retry command.
- No response from server: There is no DNS name server operating on the server computer.
- No records: The DNS name server lacks resource records for the current query type for the computer, despite the computer name being valid. The query type can be set using the nslookup set querytype command.
- Nonexistent domain: The computer or DNS domain name does not exist.
- Connection refused or Network is unreachable: The connection to the DNS name server or finger server could not be established. This error often happens with the ” ls and finger requests.
- Server failure: The DNS name server detected an internal inconsistency in its database and was unable to provide a valid response.
- Refused: The DNS name server declined to process the request.
- Format error: The DNS name server determined that the request packet was not formatted correctly. This may suggest an issue with nslookup.
Conclusion: Now You’ve Mastered The nsLookup Command Across All Operating Systems
It’s 2025, and the nslookup command is a vital DNS diagnostic Tool found on all major operating systems. So whether you are checking domain settings, fixing connection problems,, or explaining mail servers, nslookup allows you to easily collect the data you need. This guide tells you everything from what does nslookup command do, how to install and examples .
Just learn the basic flags and formats and enhance your network management abilities.
FAQ’s
1: What is the nslookup command used for?
The nslookup command helps to query DNS (Domain Name System) records to find the mapping of domain names or IP addresses. It is a useful tool for diagnosing DNS issues on Linux, macOS, and Windows.
2: How do I perform a simple DNS lookup with nslookup?
To do a basic DNS lookup, just type:
nslookup example.com
This will give you the IP address linked to the domain.
3: Can I use nslookup to check mail server (MX) records?
Yes, you can check MX (Mail Exchange) records by entering:
nslookup -type=mx example.com
This will show the mail servers set up to manage emails for the domain.
4: How do I change the DNS server in nslookup?
You can change the DNS server by typing it after the domain, like this:
nslookup example.com 8.8.8.8
This command queries Google’s public DNS server (8.8.8.8) instead of your default.