As the central directory service for network addresses, the domain name system (DNS) plays an important role in the success of the Internet and World Wide Web. The web of globally dis­trib­uted DNS servicers (also called name servers) does the important work of ensuring that the names of the different network par­ti­cipants and ap­plic­a­tions, such as example.org, are converted into numeric and machine-readable IP addresses (and vice versa). In this way, it guar­an­tees that the correct computer or desired website is always reached via the cor­res­pond­ing IP, even if you are unaware of it.

In some situ­ations (when there are issues with the name res­ol­u­tion, for example), it is helpful to look behind the scenes and research the IP address linked to a domain name, or the domain name linked to an IP address. A useful tool for this is the program nslookup, which Windows, macOS, and Linux all feature as a standard in­stall­a­tion.

Free DNS hosting in the UK
Reduce page loading speeds with free DNS
  • Faster domain res­ol­u­tion to keep you online longer
  • Added pro­tec­tion against outages and downtime
  • UK-based name servers
  • No domain transfer needed

What is nslookup?

nslookup is a simple but very practical command-line tool, which is prin­cip­ally used to find the IP address that cor­res­ponds to a host, or the domain name that cor­res­ponds to an IP address (a process called “Reverse DNS Lookup”). nslookup allows itself to be used in the command-line of the operating system in question; Windows users start the service via the command prompt, and Unix users via the terminal window. Ad­di­tion­ally, there are now a number of services that make it possible to use nslookup online.

Note

The name nslookup stands for “name server look up.”

nslookup retrieves the relevant address in­form­a­tion directly from the DNS cache of name servers, a process which can be achieved through two different modes that the user can choose from. In the non­in­ter­act­ive mode, the tool inspects the resource records (which is what the address entries in the DNS cache are called) that are stored in the local name server, in a standard way. This mode is es­pe­cially well suited for simple queries, for which a single domain entry needs to be looked up. When you want to use a different DNS server for the research and complete more complex search processes, you need the in­ter­act­ive mode, in which the command-line program needs to be started sep­ar­ately at first.

Note

Unlike the wide range of other command-line programs from Windows/DOS, nslookup has the case-sensitive parameter “-q”. In other words, a parameter in which cap­it­al­isa­tion or lack thereof are relevant.

What can nslookup be used for?

There are different scenarios in which the use of nslookup is ap­pro­pri­ate. In this way, the command-line program is an es­pe­cially crucial tool when resolving DNS issues. First and foremost, a data query helps find the cause of the problem at hand. For example, those who use Windows and ex­per­i­ence an issue with the active directory can use nslookup to quickly and easily check whether all involved servers are converted in the domain name system as planned. Generally, this program shows its strengths when various sub­do­mains are involved – not only when it is simply a matter of checking them, but also when there are con­nec­tion problems.

Another typical scenario is the search for optimal mail servers SMTP, POP, IMAP) for a desired domain. In this case, nslookup de­term­ines the servers in question on the basis of the MX-Records (mail exchanger) that belong to the domain of the e-mail provider. These entries contain the IP addresses and names of the provider servers, which sub­sequently only need to be specified during the con­fig­ur­a­tion of the mail clients to perfect the routing of the elec­tron­ic mail service.

Here’s how nslookup functions in Linux, Windows, and macOS

To use nslookup on Mac, Windows, or Linux computers, the first step is to open the command-line of the operating system in question. After that, there are two pre­vi­ously in­tro­duced modes to mobilise the DNS tool for your purposes:

  • In­ter­act­ive mode: start nslookup with the command of the same name and sub­sequently add the para­met­ers sep­ar­ately
  • Non­in­ter­act­ive mode: directly enter the nslookup command as well as the desired para­met­ers

The most ap­pro­pri­ate approach depends on your available know-how. If you are familiar with the necessary para­met­ers, there is nothing stopping you from carrying out the desired DNS server query in a single step (as long as the DNS server doesn’t need to be switched). Beginners who first need to get to know the service can ease the trans­ition by starting nslookup and then learning about syntax and para­met­ers step by step. Re­triev­ing available options with the “help” command is possible and very helpful in the in­ter­act­ive mode.

To close nslookup after the query, simply give the “exit” command, or close the command-line. Al­tern­at­ively, the [CTRL] + [C] key com­bin­a­tion does the trick.

nslookup: Examples of how to use the query tool

If you have begun by starting nslookup in a single step, the command-line will wait for the entry of further commands. Now, users have the op­por­tun­ity to complete queries with the standard setup or to determine in­di­vidu­al­ised options. For the former method, simply enter the domain name for which you want to find out the IP address (or vice versa) into the command-line and confirm your choice by pressing the enter key. nslookup, for example, presents the following result in the search for the address to the example.org domain:

In this case, a “non-au­thor­it­at­ive answer” no­ti­fic­a­tion is given, as the local DNS server was unable to answer the query itself, and instead had to contact one or more other name servers. The content of the nslookup results are the IPv4 (four-figure) and IPv6 addresses (longer, divided with colons) of the example domain.

For in­di­vidu­ally con­figured nslookup queries in the in­ter­act­ive mode, see the following two examples.

Re­triev­ing specific addresses out of the resource records

nslookup is fun­da­ment­ally set up for the query of IPv4 and IPv6 addresses. However, as pre­vi­ously mentioned, the command-line tool can retrieve other address types of a domain through its method of accessing the DNS entries. To this end, the user must next set the desired type, before they can enter the domain name into the command-line. The syntax of the cor­res­pond­ing nslookup commands looks like this:

set type= <RESOURCE RECORD TYPE>

The “resource record type” cor­res­ponds to the desired type of query, some of the options for which are included in the following chart:

nslookup parameter values Type of query
A IPv4 address
AAAA IPv6 address
MX Domain name mailserv­er (mail exchanger)
NS Domain name name server
PTR “Pointer” entry (pinpoints the host name that cor­res­ponds to an IP address)
SOA “Start-of-Authority” entry (details about the ad­min­is­tra­tion of the DNS zone)

Switch DNS servers for accurate results

It is standard procedure for nslookup to contact the local DNS server, which is usually pre­de­ter­mined by the router, or rather the Internet provider. But using it for the query can oc­ca­sion­ally result in in­ac­cur­ate results, for example, because the server being searched for is not listed in the cache of the local name server. Luckily, the command-line tool provides the option to choose the DNS server you want to use for the query yourself. If you choose the server that is connected to the cor­res­pond­ing domain, you even receive au­thor­it­at­ive answers. This firstly involves finding the name server or name servers in question, by setting the “NS” query type and then entering the domain name to be shown the DNS entry:

set type=NS
    example.org

In this nslookup example, the tool offers up two possible name servers (“a.iana-servers.net” and “b.iana-servers.net”), as the following screen­shot shows:

One of the two presented name servers must next be des­ig­nated as the standard server, so that future queries are completed through it. The cor­res­pond­ing command is composed of the “server” parameter and the name of the desired server. Ac­cord­ingly, these two commands are possible for the nslookup example in question:

server a.iana-servers.net
server b.iana-servers.net

The last step requires the user to change the query type, which is still set to a name server search, to the desired address query, such as “A” for the domain, “MX” for the mail server IP check, or “ANY” for an overall check (used here):

set type=ANY

If you once again enter example.org to start the query, nslookup provides extensive DNS data for the example domain, for which the name server that has been des­ig­nated as standard server (here, a.iana-servers.net) is the data source:

The au­thor­it­at­ive and accurate answer received this time around shows, among other things, the pre­vi­ously mentioned name servers and the primary name server, from which the DNS data was retrieved.

DNS server query in a browser with nslookup online tools

Con­duct­ing DNS server queries with nslookup doesn’t ne­ces­sar­ily require the tool to be run on your own system. The web features various ap­plic­a­tions that provide these resources. In this case, the IP address (or rather, domain name) then occurs on a different computer – guided by your own browser. Two nslookup examples of such web ap­plic­a­tions are ping.eu and cent­ralops.net.

ping.eu limits itself to the basic function of nslookup. After entering an IP address or a host name, the tool offers up the cor­res­pond­ing coun­ter­part:

In the tool provided by cent­ralops.net, nslookup lets itself be used in in­ter­act­ive mode online as well. This way, users can enter the name server of their choice instead of using the provider’s standard DNS driver, switch the port, or determine the query type. It is also possible to receive au­thor­it­at­ive answers in this process, just like in the previous nslookup example.

Note

ping.eu as well as cent­ralops.net offer ad­di­tion­al network tools, such as Traceroute or WHOIS.

Go to Main Menu