nslookup Command


Queries internet domain name servers interactively.


nslookup [ - option ] [ name | - ] [ server ]


The nslookup command queries internet domain name servers in two modes. Interactive mode allows you to query name servers for information about various hosts and domains, or to print a list of the hosts in a domain. In noninteractive mode, the names and requested information are printed for a specified host or domain.

The nslookup command enters interactive mode when no arguments are given, or when the first argument is a - (minus sign) and the second argument is the host name or internet address of a name server. When no arguments are given, the command queries the default name server. The nslookup command enters non-interactive mode when you give the name or internet address of the host to be looked up as the first argument. The optional second argument specifies the host name or address of a name server. You can specify options on the command line if they precede the arguments and are prefixed with a hyphen. For example, to change the default query type to host information, and the initial timeout to 10 seconds, enter the following command:
nslookup -query=hinfo  -timeout=10

Interactive commands

Item Description
host [server] Looks up information for the host using the current default server or using server, if specified. If the host is an Internet address and the query type is A or PTR, the nslookup command returns the name of the host. If the host is a name and does not have a trailing period, the search list is used to qualify the name. To look up a host not in the current domain, append a period to the name.
server Domain lserver Domain  Changes the default server to the value specified by the Domain parameter. The lserver subcommand uses the initial server to look up information about the domain. The server subcommand uses the current default server. If an authoritative answer cannot be found, the names of any additional servers that might have the answer are returned.
exit Exits the program.
set Keyword[=Value] Changes state information that affects lookups. You can specify the following keywords:
Prints the current values of the frequently used options to set. Information about the current default server and host is also printed.
Changes the query class to one of the following value. The class specifies the protocol group of the information. The default is IN.
The Internet class.
The Chaos class.
The Hesiod class.
Wildcard (any of the above).
Turns debugging mode on. The default is nodebug.
Turns comprehensive debugging on. The default is nod2.
Changes the default domain name to the name specified by the name parameter.
Appends the domain names in the domain search list to the request until an answer is received, if the lookup request contains a period other than a trailing period. The default is search.
Changes the default TCP/UDP name server port to the number specified by the value parameter. The default value is 53.
Changes the type of the information query to the type specified by the value parameter. The default value is A.
Tells the name server to query other servers if it does not have the information. The default is recurse.
Sets the number of retries to the number specified by the number parameter.
Changes the initial timeout interval for waiting for a reply to the seconds specified by the number parameter.
Always uses a virtual circuit when sending requests to the server. The default is novc.
Tries the next name server if a name server responds with SERVFAIL or a referral (nofail) or terminate query (fail) on such a response. The default is nofail.


Item Description
/etc/resolv.conf Contains the initial domain name and nameserver addresses.

nslookup command - BIND 9.16

For a complete description, see the nslookup command in the BIND 9.16 Administrator Reference Manual.