Or copy link
Copy link
Network troubleshooting and information gathering can often be a complex task. One of the most essential tools for these purposes is nslookup. This command-line utility is used to query Domain Name Systems (DNS) to obtain domain name or IP address mapping as well as other DNS records. In both Windows and Linux environments, nslookup is a powerful tool for network diagnostics and verification tasks.
Below, we’ll explore how to use nslookup commands across both Windows and Linux systems, including basic usage and some advanced functions.
NsLookup stands for ‘name server lookup’ and is a built-in utility within Windows and Unix-like operating systems such as Linux. It queries DNS servers to obtain the domain name or IP address associated with a particular host or domain.
The most common use of nslookup is to find the IP address associated with a domain name. First, we will discuss two modes used in nslookup command:
nslookup domain_name
nslookup
set querytype=a
By default, nslookup displays responses from a non-authoritative source. This means the information might be cached by your local DNS server and not directly from the domain’s authoritative name servers. Both Windows and Linux allow for one-off commands without entering into nslookup interactive mode. Here is how you can use nslookup command in Windows and Linux:
For nslookup Windows, open the Command Prompt by pressing Windows Key + R, and typing “cmd” or you can access the Command Prompt by typing cmd in the Start menu search bar and then pressing Enter.
Once the Command Prompt opens type nslookup and press Enter. You will see a “>” prompt, indicating nslookup mode. Simply type a domain name to get its corresponding IP address(es). For example:
> example.com
It displays the IP address as given picture below:
Type exit to leave nslookup mode.
For nslookup Linux, open your Terminal application from the applications menu or by using a shortcut, typically Ctrl+Alt+T. Similar to Windows, type nslookup and hit Enter.
At the prompt, entering a domain name will return its IP address(es). For instance:
google.com
It displays the IP address in the Linux terminal as given picture below:
To exit nslookup mode type exit or use Ctrl+D.
Practice NsLookup Command on Our Linux Server!
With Ultahost, the Linux VPS Server has never been easier or faster. Enjoy ultra-fast SSD NVME speeds with no dropouts and slowdowns.
Nslookup offers a variety of flags and options to specialize your queries. Here are some commonly used ones:
Query Specific DNS Records
You can query specific types of DNS records by adding the record type to your command. For example, to find the Mail Exchange (MX) records for a domain which are crucial for email delivery you can use:
nslookup -type=mx gmail.com
Set a Different DNS Server
By default, nslookup uses the DNS server configured on your system. To use a different server for your query:
> server 8.8.8.8 > example.com
Here “8.8.8.8” is the DNS server of Google which we are setting for our current session.
Reverse DNS Lookup:
If you have the IP address and need to find out the associated hostname:
> set type=ptr > 8.8.8.8
This performs a reverse lookup on the IP address to find the related domain name. You can find a comprehensive list of nslookup options by typing nslookup help or nslookup ? in your terminal.
nslookup help
nslookup ?
Follow our quick guide on How to troubleshoot DNS with dig and nslookup.
Nslookup is a valuable tool for troubleshooting DNS-related problems. Here are some effective use for nslookup examples:
Understanding how to effectively use nslookup can significantly useful in diagnosing network issues and ensuring proper DNS configurations. Its ability to look up various types of DNS records makes it versatile for many different scenarios in both Windows and Linux environments. It is important to respect privacy and legal boundaries during network diagnostics and troubleshooting activities.
Using nslookup on Windows can be a handy tool for basic DNS lookups, but it might not be suitable for managing multiple domains or complex DNS configurations. Upgrading to an Ultahost cheap Windows VPS plan empowers you with greater control and functionality which provides a more robust solution for managing your DNS health
NsLookup is a command-line tool to query DNS servers and obtain domain name information.
Open Command Prompt, type “nslookup”, then enter the domain name to get its DNS information.
Type “nslookup” followed by an IP address to find the associated domain name.
Yes, NsLookup is available in Linux distributions and operates similarly to Windows.
Check your network connection, and DNS server settings, and ensure proper syntax when using NsLookup.
The internet is an essential component of our online ex...
The "Temporary failure in name resolution" ping error i...
Imagine you're playing your favorite online game, but y...
Save my name, email, and website in this browser for the next time I comment.
Δ