How to Use Nslookup

The nslookup command is one of the best ways to find a host’s IP address or domain name. It’s a command line tool; most basic operating systems provide their own nslookup tool. The nslookup tool can be accessed through a system’s command center.

How the nslookup command works

The “nslookup” name stands for name server lookup. The nslookup command works to retrieve information directly from name servers in your DNS service. It operates in two different modes: noninteractive mode and interactive mode.

Interactive mode works better for more advanced users. The parameters for lookup are added separately so they can be sent by users. The command queries name servers for information on hosts and domains.

Noninteractive mode enters the nslookup command and the desired parameters, making it easier for beginners getting to know the commands. With noninteractive mode, the nslookup tool inspects the address entries in your DNS servers cache. It retrieves the current DNS server you’re using, the domain URL, and the IPv4 and IPv6 addresses.

nslookup

 

 

 

How to access the nslookup command

Learning how to use the nslookup command is simple. The nslookup command is accessible on almost every software system through the command center. To find the command center on your computer and nslookup an IP address, follow the instructions below for Microsoft, Apple, and Linux.

Nslookup command on Microsoft

Microsoft computer users have several ways to access the command prompt and input the nslookup command in Windows.

Open the Windows start menu and search command prompt in the search bar. It will pop up with a shortcut for access.

  1. Open the Run box by pressing Windows+R.
  2. Type cmd into the box that comes up and hit OK to open command prompt.
  3. If you find yourself running commands often, create a Desktop shortcut by right-clicking an empty spot on the Desktop to pull up the context menu. Select New and Shortcut, then type exe into the Shortcut box. Hit Next and name the shortcut, and you will have an easy way to access command prompt from the Desktop.

Nslookup command on Apple

For Apple Macbook users, the nslookup command is executed through the Terminal app.

  1. Go to the Finder in the top left corner of your device.
  2. Open the Applications
  3. Click on the Utilities folder, then find Terminal.
  4. Enter the command nslookup and the IP address you’re searching for.

Nslookup command on Linux

For IBM Linux users, the Linux nslookup command can be executed through its terminal window.

  1. Press Ctrl+Alt+T in Ubuntu.
  2. Hit Enter.
  3. From here, you can execute the nslookup command by typing in nslookup and the IP address or website you wish to query.

Basic nslookup commands

There are a number of nslookup example commands that can be executed, depending on the information or record types that the user wants. Note that for all of these commands, the domain you wish to search should be put in place of ‘example.com.’

Search for the A records of a domain

Nslookup can ask for the A records of a domain, which reveals all IP addresses related to a particular host. Use the command nslookup example.com.

Search for the NS records of a domain

NS records stand for name server records (just like the “ns” in nslookup). The name server reveals which DNS server contains the DNS records for a particular domain; it shows where to go to find a domain’s IP address. Improperly configured NS records result in difficulties loading websites and other issues. Use the command nslookup -type=ns example.com.

Check the SOA records of a domain

SOA stands for Start of Authority. Every domain has a Start of Authority record, which indicates where the domain diverged from a parent domain. Executing this command will gather zone information. Use the command nslookup -type=soa example.com.

Check MX records

Nslookup can also check mail servers and verify that they are working properly. MX stands for Mail Exchange, which are DNS records necessary for delivering mail to your address. Use the command nslookup -query=mx example.com.

Find all the available DNS records for a domain

The nslookup command works to locate domain name system (DNS) records like a DNS lookup, too. Use the command nslookup -type=any example.com. To check a specific DNS server, use the command nslookup example.com ns1.nsexample.com.

Do a reverse DNS lookup

You can also check if an IP address is related to a specific domain with the nslookup command. Use the command nslookup 10.20.30.40.