nslookup(1) General Commands Manual nslookup(1)
NAME
nslookup - query name servers interactively
SYNOPSIS
Single Host Mode
host [server]
Interactive Mode
[server]]
DESCRIPTION
The program queries Internet domain name servers. It follows the configured name resolution algorithm of the host and queries NIS, DNS,
and host tables.
In (noninteractive), queries a name server for information about one host or domain. This mode occurs when you specify a host in the com-
mand.
In lets you make several requests in the same session. For example, you can query a name server for information about various hosts and
domains or print a list of hosts in the domain. This mode occurs when you omit the host (and server) in the command or when you use the
special placeholder.
Options
Set the setoption, as defined for the command. See subsection in the section.
Turn on tracing during command initialization,
causing the switch module to print out a trace of the scan and parse actions on the database entry in the file (see nss-
witch.conf(4)). It may be used to debug syntactic errors in the switch configuration file. See also the option
Note: is a command option, so you cannot turn it off in interactive mode.
Operands
host The host name or IP address of a host system. If host is present, the command is executed immediately (noninteractively). If it
is omitted, enters interactive mode.
Set interactive mode.
This placeholder is needed if you specify server for interactive mode.
server The host name or IP address of a domain name server. If omitted, uses the policy described in the subsection.
Initialization File
The setoptions and (see the subsection) can be specified in a startup file in the user's home directory. Enter them one per line without
the leading hyphen
Default Lookup Policy
If a server has not been specified explicitly to override the switch policy, initializes each of the name services in the database in the
switch configuration file (see nsswitch.conf(4)), but uses the first name service for lookup. The initialization of the name services may
cause a delay in obtaining the response if any of the name services is not responding. For example, consider when the database is defined
with the following name services:
If the name servers mentioned in (see resolver(4)) are unavailable, there will be a delay in trying to initialize the name servers. The
handling of the query thereafter follows the switch policy, as would be expected.
contacts the name servers mentioned in sequentially but does not cycle through them like the resolver routines do (see resolver(3N)).
Note: should not be used as a command-line substitute for the resolver routines unless the differences in resolution behavior between and
the resolver routines are understood and are acceptable for the scripting environment where will be employed.
The following name services are recognized:
Use the servers defined in the
file.
Use the entries in the
file.
Use the maps at the NIS server.
Note: NIS+ is not supported by If the name service is included in the database, it is ignored.
If there is no database in the file or there is no file, uses this name service sequence:
To override the switch policy and query DNS servers directly, you can specify a name server by entering the server operand on the command
line or by using the or command in interactive mode. Whenever an action is taken that causes the switch policy to be overridden, a warning
message is displayed.
If the first successful name service is or has a reduced interactive command set; the command shows which commands are currently valid.
Use the command in interactive mode to restore the default policy.
INTERACTIVE COMMANDS
Commands can be interrupted at any time with the character, commonly Ctrl-C. To exit, type the character, commonly Ctrl-D, or use the com-
mand. (See stty(1).) To treat a built-in command as a host name, precede it with an escape character When using NIS or the host table,
only host names and Internet addresses are allowed as commands. An unrecognized command is interpreted as a host name.
General Commands
host [server] Look up information for host using the current default server or using server if specified. If host is an Internet address
and the query type is or the name of the host is returned. If host is a name and does not have a trailing period, one or
more domains are appended to the name. This behavior depends on the state of the options and see Answers from a name
server's cache are labeled
See the command.
Exit the program.
Connects with the finger server on the current host.
name is a user name or user ID on the host; it is optional. The current host is defined when a previous lookup for a host
was successful and returned address information. The output can create/overwrite or append to filename.
Print a brief summary of commands that are valid in the current context.
List information available for
domain. The default output contains host names and their Internet addresses. option can be one of the following:
List aliases of hosts in the domain (synonym for
List all records for the domain (synonym for
List CPU and operating system information for the domain (synonym for
List well-known services of hosts in the domain (synonym for
List all records of the specified type.
See in
The output can create/overwrite or append to filename. When output is directed to a file, a character is printed to stan-
dard output for every 50 records received from the server.
See the command.
Print out the policy read from the
database in the switch configuration file (see nsswitch.conf(4)). The number of name services specified in the file are
shown, as well as the order and criteria on how the name services are to be used. The four statuses of the criteria are
represented by four characters in square brackets. The order of the status characters is:
The letters used in the four status positions are:
If no criteria are specified between two sources, then the default actions assigned to the statuses are
Return to using the configured name service switch policy
and reset to the original name servers.
Change the default server to the server
for the root of the domain name space. The command is a synonym for where root-host is the root server specified with the
command. The default root server is
Change the default server to
domain. uses the initial server to look up information about domain while uses the current default server. When is used
while the current name service being pointed to is either NIS or then the switch policy will be overridden until a is
issued.
Change state information that affects lookups.
See
Sort and list the contents of
filename, using (see more(1)). This is useful for viewing files written by the and commands.
The set Command
The command changes state information that affects the lookups. The options can also be entered as setoption values on the command line.
For example,
The prefix
negates the request. The action is described in brackets ([...]).
The keyword option is set to
value.
Other characters in brackets ([...]) are optional, allowing for keyword abbreviations. Spaces are not permitted.
Print the current values of the various
options, along with information about the current default server and host.
Change the query class to one of:
The Internet class.
The Chaosnet class.
The MIT Athena Hesiod class.
Wildcard (any of the above).
The class specifies the protocol group of the information. The default is
Turn on [turn off] exhaustive debugging mode.
Essentially all fields of every packet are printed. The default is
Turn on [turn off] debugging mode.
More information is printed about the packet sent to the server and the resulting answer. The default is
Append [do not append] the default domain name
to a single-component lookup request (that is, one that does not contain a period character). The default is
Change the default domain name to
name. The default domain name is appended to a lookup request, depending on the state of the and options. The domain
search list contains the parents of the default domain if it has at least two components in its name. For example, if the
default domain is the search list is and Use the command to specify a different list. Use the command to display the list.
The default is the value from host name, or the environment variable.
Ignore [do not ignore] truncation errors.
The default is
Change the default TCP/UDP name server port to
value. The default is
Change the type of information returned from a query to one of:
Host's IPv4 address
Host's IPv6 address
All types of data
Canonical name for an alias
Group ID
Host CPU and operating system type
Mailbox domain name
Mail group member
Mailbox or mail list information
Mail rename domain name
Mail exchanger
Name server for the named zone
Host name if the query is an Internet address,
otherwise the pointer to other information.
Start of authority record
Text information
User ID
User information
Well-known service description
Tell the name server to query [not to query] other servers
if it does not have the information. The default is
Set the number of retries to
number. When a reply to a request is not received within a certain amount of time (changed with the command ), the timeout
period is doubled and the request is resent. The retry value controls how many times a request is resent before giving up.
The default is
Change the name of the root server to
host. This affects the command. The default is
If the lookup request contains at least one period
but doesn't end with a trailing period, append [do not append] the domain names in the domain search list to the request
until an answer is received. See hostname(5). The default is
Change the default domain name to
name1 and the domain search list to name1, name2, and so on. A maximum of 6 names separated by slashes can be specified.
For example,
sets the domain to and the search list to the three names. This command overrides the default domain name and search list
of the command. Use the command to display the list. The default is a value based on the host name, or the environment
variable.
Display [do not display] information about the
sources used for resolving a name or an address lookup. This flag traces the behavior generated by the switch policy. The
default is
Change the initial timeout interval for waiting for a reply to
number seconds. Each retry doubles the timeout period. The default is
See the option.
Always use [do not use] a virtual circuit when sending requests to the server.
The default is
DIAGNOSTICS
If the lookup request was not successful, an error message is printed. Possible error messages are:
The connection to the name server could not be made
at the present time.
The name server found that the request packet
was not in the proper format.
The connection to the name server could not be made
at the present time.
The server does not have resource records
of the current query type for the host, although the host name is valid. The query type is specified with the command.
No name server is running on the server machine.
The host or domain name does not exist.
The name server refused to service the request.
The name server found an internal inconsistency in its database
and could not return a valid answer.
The server did not respond to a request after a certain amount of
time (changed with value) and a certain number of retries (changed with value).
EXAMPLES
To change the default query type to host information and the initial timeout to 10 seconds, and enter interactive mode:
AUTHOR
was developed by the Internet Systems Consortium (ISC).
FILES
User's initial options.
Host name data base.
Configuration file for the name-service switch.
Initial domain name and name server addresses.
SEE ALSO
more(1), stty(1), named(1M), resolver(3N), hosts(4), nsswitch.conf(4), resolver(4), hostname(5).
Requests for Comments (RFC): 1034, 1035, available online at
available online at
available from the Internet Systems Consortium at
BIND 9.3 nslookup(1)