nslookup commands

: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /var/www/virtual/rlogix/includes/unicode.inc on line 311.

Using nslookup, dig, and host

nslookup, dig, and host

are useful commands that allow you to perform DNS queries,
and to test out your DNS configuration.

You can use the nslookup command
to enter a shell from which you can
change servers, set query options, and debug DNS.
You can also use nslookup
from the command line to issue simple queries.
Also see


Finally, you can use the
command to provide answers to simple host queries.
for more information.

Using nslookup interactively

  1. Enter nslookup at the command line.
    The nslookup prompt appears.

  2. View the current options by entering set all.

  3. Change any desired options by entering set option.

  4. Issue nslookup commands.

  5. Enter exit to leave nslookup.

For a list of sample commands, see
``nslookup interactive commands''.
For a list of options, see

``nslookup interactive options''.

nslookup interactive commands

These sample commands are available from the nslookup shell:


Return the IP address of volga.

Return the name matching the IP address you enter.

set querytype=ns

Set the query type to the Name Server record. Future
queries of names and IP addresses return the NS record from
that host.

set querytype=a

Restore the query type to the Address record.

server server

Make server the default server that is queried.

nslookup interactive options

Here are the commonly used options of nslookup. For a
complete list, see the manual page for


Sets the query type to recursive. When toggled to norecurse, nslookup
performs iterative queries.


Sets the query type to the DNS data type specified. Common types
include a (Address), any (any data type),
mx (Mail Exchanger), and ns (Name Server).


Resends the query n times before giving up.

root=root server

Sets the root server to the server you enter.


The period of time nslookup waits for a response after the query is sent.
This period doubles between each retry.

You can save any of these options in a .nslookuprc file

in your home directory. The format of this file, which is searched for
each time you invoke nslookup, is one set command
per line. Here is an example, which sets the query type to address records,
the domain to mynet.com, and sets the timeout on requests to
10 seconds:

   set querytype=a
   set domain=mynet.com
   set timeout=10

Querying a single name or address

To issue a simple query from the command line, use one
of the following forms of the nslookup command:

nslookup name

nslookup IP_address

nslookup should return the desired answer by querying the
default server. To query a different server, enter one of the following
forms of the command:

nslookup name server

nslookup IP_address server

Examples of using the dig command

Obtain the latest list of root domain servers:

dig . ns

Find out the name servers for a zone:

dig @server domain ns

Request all records for a zone from an authoritative server:

dig @server domain axfr

This command requires a zone transfer which the server may disallow.

Look up the domain name corresponding to the IP address

dig -x

Examples of using the host command

Use host to find all the host records for a zone:

host -l domain

Use host to request all the records for a zone:

host -l -v -t any domain


These commands require a zone transfer which the server may disallow.