Your IP: Unknown · Your Status: ProtectedUnprotectedUnknown

Skip to main content

Nslookup command: What it does and how to use it

When you need to fetch a particular DNS record or pinpoint the domain’s IP address, the nslookup command can come to your rescue. With a few simple commands, you can invoke information from your DNS servers to troubleshoot issues or verify configurations. Read on to learn these commands and use them to your advantage.

Nslookup command: What it does and how to use it

What is the nslookup command?

The name server lookup, or nslookup, is a command-line tool created to help you find a particular domain name’s IP address or a domain name system (DNS) record. For instance, if you want to know the IP address of a specific website, you can use the nslookup command to get it. You can also use nslookup for a reverse action – to find a domain name only by knowing its IP address.

The nslookup command is typically pre-installed on all major operating systems and is available if the device uses the TCP/IP protocol.

What is the nslookup used for?

The nslookup command is often used to troubleshoot DNS tasks, test servers, or retrieve specific information about a particular domain. By using different nslookup prompts, you can obtain valuable information about your domains and pinpoint possible issues related to their infrastructure.

For instance, you can check if you can reach the host server, whether your domain points to the correct nameservers, or whether emails are routed correctly to your mail server.

How to use the nslookup command

You can invoke the nslookup command through a command-line interface (CLI) in major operating systems – either Command Prompt on Windows or Terminal on Linux and macOS. However, before putting in the command, you should first decide if you want to use the nslookup in interactive or non-interactive mode.

The interactive mode is useful when you need to do a detailed DNS infrastructure analysis or perform in-depth troubleshooting. It’s a preferred mode for network administrators and IT professionals. Meanwhile, the non-interactive mode is ideal for quick lookups and simple queries when you only need a specific piece of information.

The main difference between interactive and non-interactive modes is that in interactive mode, you can give numerous commands after the initial one. Meanwhile, you have to start a new session after each command when you’re using a non-interactive mode.

Going further, we’ll provide more information and examples on how to invoke nslookup commands in interactive mode, which allows for more flexibility and gives a chance to make query adjustments.

Nslookup: The main commands

The nslookup commands are great for getting the basic DNS information of a particular domain. Among the most commonly used commands you can find:

NameUses a default server to provide information about the domain name.
Server <server name>Uses the specified server’s information to set a different default DNS server for a session.
Server <root server>Makes the root server a default one.
Set debugProvides detailed information about each DNS query and its response for debugging.
Set recursePrompts the DNS server to ask other servers whether they can provide the requested information.
HelpDisplays a list of nslookup commands with explanations about what they do.
Set type=<record type>Requests a specific type of DNS record.
ExitQuits the nslookup tool and returns you to the command line interface.

Nslookup: The main DNS record types

If you’d like to get more detailed information about the domain servers, you may need to use the “set type” commands.

DNS record type commandPurpose
AShows the IPv4 address of a domain name.
AAAAShows the IPv6 address of a domain name.
MX (mail exchange)Displays mail servers that receive emails sent to a domain.
NS (name server)Displays a domain’s authoritative DNS servers.
CNAME (canonical name)Shows an alternative name to the true (canonical) domain name.
TXT (text)Provides text data used for such services as email verification.
SOA (start of authority)Provides administrative information about a domain’s zone (primary name server, administrator’s email address) and a serial number.
PTR (pointer)Connects an IP address to a domain name, mostly used for reverse DNS lookups.
SRV (service)Reveals a server’s specific location when it’s used for specific services.
CAA (certification authority authorization)Shows the authorities that are allowed to issue domain certificates.
ANYDisplays all the domain’s available DNS server records.

The nslookup command on Linux: Examples

Let’s say you want to learn what the IP address of the domain is. You also want to make sure that if the DNS server can’t get this information from the domain itself, it will ask other servers to provide it. In this case, you need to use the “set recurse” command.

  1. Open the “Terminal” on your Linux computer.
  2. Write “nslookup” in the first line and click “Enter.”
  3. Linux 1
  4. The new prompt (>) will appear. Put in the “set recurse” command and click “Enter.”
  5. Linux 2
  6. In the following prompt, write in “” and click “Enter” – you’ll see the domain’s IP address.
  7. Linux 3
  8. Afterward, the nslookup will open a new prompt so you can enter any follow-up commands.

The nslookup command on Windows: Examples

The process of using the “set recurse” prompt on Windows is almost identical to the one for Linux, except another program is used – Command prompt.

  1. Open the “Command prompt” on your Windows computer.
  2. Write “nslookup” in the first line and click “Enter.”
  3. Windows 1
  4. The new prompt (>) will appear. Put in the “set recurse” command and click “Enter.”
  5. Windows 2
  6. In the following prompt, write in “” and click “Enter” – you’ll see the domain’s IP address.
  7. Windows 3