Name server lookup (nslookup)

Utilize nslookup to query domain name servers, effortlessly retrieving vital domain information and streamlining your workflow.

Back to glossary

The nslookup command, short for 'name server lookup', is a versatile tool used in the field of cybersecurity and network administration. It is a network administration command-line tool available in many computer operating systems for querying the Domain Name System (DNS) to obtain domain name or IP address mapping, or other DNS records. This tool is crucial in diagnosing network issues and investigating potential security breaches.

Understanding nslookup is essential for anyone involved in network administration or cybersecurity, as it provides valuable insight into how data is routed through the internet and can help identify potential vulnerabilities or anomalies. This article will delve into the intricacies of nslookup, explaining its functions, usage, and significance in cybersecurity.

Understanding DNS

Before delving into nslookup, it's important to understand the system it interacts with: the Domain Name System (DNS). DNS is essentially the phonebook of the internet. It translates human-friendly domain names like '' into IP addresses that computers use to identify each other on the network.

Without DNS, we would have to remember the IP addresses of every website we want to visit, which is not practical. DNS servers do the job of translating these domain names into IP addresses. However, like any system, DNS can be vulnerable to attacks, and that's where nslookup comes in handy.

DNS records

DNS records are essentially mapping files in the DNS that tell the DNS server which IP address each domain is associated with, and how to handle requests for each domain. There are several types of DNS records, including A (Address) records, CNAME (Canonical Name) records, and MX (Mail Exchange) records, among others.

Understanding these records is crucial when using nslookup, as the command can be used to query specific types of records to gather information about a domain. For example, querying the A records for a domain will return the IP address associated with that domain.

Using nslookup

Now that we have a basic understanding of DNS, let's delve into how to use nslookup. The basic syntax of the command is nslookup [option] [hostname] [server]. The 'option' parameter can be used to specify the type of DNS record to query, the 'hostname' parameter is the domain name you want to look up, and the 'server' parameter is optional and specifies the DNS server to use for the lookup.

For example, to look up the IP address for, you would simply type nslookup This would return the A record for, showing the IP address associated with the domain. There are many other options and parameters that can be used with nslookup to perform more specific or advanced queries, which we will explore in the following sections.

Interactive and non-interactive modes

nslookup has two modes of operation: interactive and non-interactive. Interactive mode allows you to enter a series of commands to perform multiple queries, while non-interactive mode is used for single queries. To enter interactive mode, simply type nslookup without any parameters. You can then enter commands directly into the nslookup prompt.

Non-interactive mode is used by simply typing the nslookup command followed by the domain you want to query. For example, nslookup This will return the A record for the specified domain. To exit interactive mode, simply type 'exit'.

Querying specific DNS records

As mentioned earlier, nslookup can be used to query specific types of DNS records. This is done using the -query option followed by the type of record you want to query. For example, to query the MX records for a domain, you would type nslookup -query=mx

This command will return the MX records for, showing the mail servers associated with the domain. This can be useful for diagnosing email issues or investigating potential email-related security breaches.

nslookup in cybersecurity

In the realm of cybersecurity, nslookup is a valuable tool for investigating potential security breaches and diagnosing network issues. By querying DNS records, cybersecurity professionals can gain insight into how data is being routed, identify potential vulnerabilities, and track down the source of attacks.

For example, if a company's website is being targeted by a DDoS attack, nslookup can be used to identify the IP addresses that the attack is coming from. This information can then be used to block the attacking IP addresses and mitigate the attack.

Investigating phishing attacks

Phishing attacks often involve the attacker setting up a fake website that mimics a legitimate one, in an attempt to trick users into entering their login details. These fake websites often have domain names that are very similar to the legitimate ones, in an attempt to trick users into thinking they are on the correct site.

By using nslookup to query the DNS records for the suspicious domain, cybersecurity professionals can compare the IP address of the fake site to the IP address of the legitimate site. If they don't match, this is a clear indication that the site is a phishing site.

Identifying botnets

Botnets are networks of compromised computers that are controlled by an attacker. These botnets can be used to carry out a variety of malicious activities, including DDoS attacks, spamming, and data theft. Identifying and dismantling botnets is a key aspect of cybersecurity.

nslookup can be used to identify botnets by querying the DNS records for known botnet command and control servers. If a computer is making frequent DNS queries to these servers, it is a strong indication that it is part of a botnet.

Limitations and alternatives of nslookup

While nslookup is a powerful tool, it does have its limitations. For example, it cannot perform reverse lookups for IPv6 addresses, and it does not support DNSSEC (Domain Name System Security Extensions). Additionally, the output of nslookup can be difficult to parse in scripts due to its inconsistent formatting.

Because of these limitations, there are other tools that are often used in conjunction with or as alternatives to nslookup, such as dig and host. These tools provide similar functionality to nslookup but with additional features and more consistent output formatting.


Dig (domain information groper) is a network administration command-line tool for querying DNS servers. It is similar to nslookup, but it supports more query types and has more extensive output. Dig is often used in scripts and by network administrators for troubleshooting DNS issues.

One of the main advantages of dig over nslookup is its support for DNSSEC, which allows it to verify the authenticity of DNS data. This can be crucial in preventing DNS spoofing attacks, where an attacker attempts to alter DNS data to redirect traffic to a malicious site.


The host command is another alternative to nslookup. It is a simple utility for performing DNS lookups and displays information about the domain including the associated IP address, mail information, and DNS server information. It is often used for converting domain names to IP addresses and vice versa.

While host does not have as many features as nslookup or dig, its simplicity and ease of use make it a popular choice for basic DNS queries. However, like nslookup, host does not support DNSSEC.


In conclusion, nslookup is a powerful tool for querying DNS records and diagnosing network issues. It is widely used in the field of cybersecurity for investigating potential security breaches and identifying vulnerabilities. While it does have its limitations, its versatility and ease of use make it a valuable tool for any network administrator or cybersecurity professional.

By understanding how to use nslookup and interpret its output, you can gain valuable insight into how data is routed on the internet, identify potential security threats, and protect your network from attacks. Whether you're a seasoned cybersecurity professional or just starting out in the field, mastering nslookup is a valuable skill that will serve you well in your career.

This post has been updated on 17-11-2023 by Sofie Meyer.

Author Sofie Meyer

About the author

Sofie Meyer is a copywriter and phishing aficionado here at Moxso. She has a master´s degree in Danish and a great interest in cybercrime, which resulted in a master thesis project on phishing.

Similar definitions

Firmware Proxy Exception Wireless access point (WAP) Advanced systems format (ASF) Granular Ransomware Internet protocol address (IP) Pages per minute (PPM) Concurrent use Circuit Speech synthesis Network block device (NBD) Inference Chief Technology Officer (CTO)