nslookup (HPUX)

vendredi 17 avril 2009
par  Jerome ROBERT
popularité : 1%






nslookup - query name servers


<B><FONT COLOR="#ff0000">nslookup</FONT></B>
[-option ...] host-to-find [server]

<B><FONT COLOR="#ff0000">nslookup</FONT></B> [-option
...] [- [server]]


<B><FONT COLOR="#ff0000">nslookup</FONT></B> is a
program to query Internet domain name servers. <B><FONT COLOR="#ff0000">nslookup</FONT></B>

has been extended to follow the configured name resolution algorithm
of the host and to query NIS, as well as, DNS and host tables.

Both an interactive and non-interactive mode are available with
<B><FONT COLOR="#ff0000">nslookup</FONT></B>.
Interactive mode allows the user to query a name server for
information about various hosts and domains, or print a list of hosts
in the domain. Non-interactive mode is used to query a name server
for information about one host or domain.

By default, <B><FONT COLOR="#ff0000">nslookup</FONT></B>
accesses name services for name and address resolution based on the
policy information obtained from the switch configuration file
/etc/nsswitch.conf. When the policy is set to use NIS or
/etc/hosts first, or when DNS is first but unavailable,
then <B><FONT COLOR="#ff0000">nslookup</FONT></B> will
only provide a limited command set (a help command while
in this situation will show what actions are possible when querying
NIS or /etc/hosts). To override the switch policy and
query DNS servers directly, the server command can be
used to specify a nameserver. This same overriding of the switch
policy can also be done by providing a nameserver as the second
argument on the command line. In this case, <B><FONT COLOR="#ff0000">nslookup</FONT></B>

will ignore the switch policy and directly query nameservers, until a
reset command is issued. Whenever an action is taken that
causes the switch policy to be overridden, a warning message is

Note, NIS+ is not supported by <B><FONT COLOR="#ff0000">nslookup</FONT></B>.
If the hosts source nisplus is found in the
/etc/nsswitch.conf file. It will be ignored.


Interactive mode is entered in the following cases :

  • No arguments are given.

  • The first argument is a hyphen (-). The optional
    second argument is a host name or Internet (IP) address of a name

Non-interactive mode is used when the name of the host to be
looked up is given as the first argument. The optional second
argument is a host name or Internet address of a name server.

Options listed under the set command below can be
specified one per line in the .nslookuprc file in the
user’s home directory. Alternatively, these options may be specified
on the command line by prefixing them with a hyphen and they must
precede other command line arguments. For example, to change the
default query type to host information, and the initial timeout to 10
seconds, type :

<CODE><B><FONT COLOR="#ff0000">nslookup</FONT></B>

-query=hinfo -timeout=10

The command line option -swdebug may be used to debug
syntactic errors in the switch configuration file. This option turns
on tracing during initialization, causing the switch module to print
out a trace of the scan and parse actions on the "hosts"
entry (see nsswitch.conf(4)
) in the /etc/nsswitch.conf file.


can be interrupted at any time by using the interrupt character. To
exit, type a Ctrl-D (EOF) or type exit. 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.

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 A or PTR,
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 set

options domain, srchlist, defname,
and search). Answers from a name server’s cache are
labeled ``non-authoritative.’’

server <I>domain</I>


lserver <I>domain</I>


Change the default server to domain. lserver
uses the initial server to look up information about domain
while server uses the current default server. When
server is used while the current name service being
pointed to is either NIS or /etc/hosts, then the
switch policy will be overridden until a reset is



Changes the default server to the server for the root of the
domain name space. Currently, the host ns.nic.ddn.mil
is used (this command is a synonym for lserverns.nic.ddn.mil).
The name of the root server can be changed with the set
root command.



Prints out the policy read from the switch configuration file.
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 the
four positions within the square brackets. The order of the
statuses are : SUCCESS, NOTFOUND, UNAVAIL and TRYAGAIN. The two
actions of the criteria are represented by the two possible
letters used in the four status positions : R for
return and C for continue. However, if no criteria is
specified between two sources, then the default actions are
assigned to the statuses :


finger [name] [&gt;


finger [name] [&gt;&gt;


Connects with the finger server on the current host. The
current host is defined when a previous lookup for a host was
successful and returned address information (see the set
querytype=A command). name is optional. &gt;
and &gt;&gt; can be used to redirect output in the
usual manner.

ls [option] domain [&gt;



ls [option] domain [&gt;&gt;



List the information available for domain, optionally
creating or appending to filename. The default output
contains host names and their Internet addresses. option
can be one of the following :

-t<I> querytype</I>


lists all records of the specified type (see querytype



lists aliases of hosts in the domain (synonym for





lists all records for the domain (synonym for -t ANY).



lists CPU and operating system information for the domain
(synonym for -t HINFO).



lists well-known services of hosts in the domain (synonym for
-t WKS).

output is directed to a file, # characters are
printed for every 50 records received from the server.

view<I> filename</I>


Sorts and lists the output of previous ls
command(s) using more (see more(1)





Prints a brief summary of commands.



Exits the program.



Returns to the use of the configured name service switch policy
and resets to use the original nameservers.

set keyword[=value]


This command is used to change state information that affects
the lookups. Valid keywords are :



Prints the current values of the various options to set.
Information about the current default server and host is also



Change the query class to one of :



the Internet class.



the Chaos class.



the MIT Athena Hesiod class.



wildcard (any of the above).

class specifies the protocol group of the information. (Default
= IN)



Turn debugging mode on. More information is printed about the
packet sent to the server and the resulting answer. (Default =



Turn exhaustive debugging mode on. Essentially all fields of
every packet are printed. (Default = nod2)



If set, append the default domain name to a single-component
lookup request (i.e., one that does not contain a period
character). (Default = defname)



Change the default domain name to name. The default
domain name is appended to a lookup request, depending on the
state of the defname and search 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 CC.Berkeley.EDU, the search list is
CC.Berkeley.EDU and Berkeley.EDU. Use
the set srchlist command to specify a
different list. Use the set all command
to display the list. (Default = value from hostname,
/etc/resolv.conf or LOCALDOMAIN)



Ignore truncation errors. (Default = noignore)





Change the type of information returned from a query to one
of :



Host’s Internet 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



Change the default TCP/UDP name server port to value.
(Default = 53)



Tell the name server to query other servers if it does not have
the information. (Default = recurse)



Set the number of retries to number. When a reply to a
request is not received within a certain amount of time (changed
with set timeout), the timeout period is doubled and
the request is resent. The retry value controls how many times a
request is resent before giving up. (Default = 4)



Change the name of the root server to host. This affects
the root command. (Default = ns.nic.ddn.mil)



If the lookup request contains at least one period but doesn’t
end with a trailing period, append the domain names in the domain
search list to the request until an answer is received. See
. (Default = search)



Change the default domain name to name1 and the domain
search list to name1, name2, etc. A maximum of 6
names separated by slashes (/) can be specified. For


the domain to lcs.MIT.EDU and the search list to the
three names. This command overrides the default domain name and
search list of the set domain command.
Use the set all command to display the
list. (Default = value based on hostname, /etc/resolv.conf




When set, this flag causes <B><FONT COLOR="#ff0000">nslookup</FONT></B>
to print out information about the sources used for resolving a
name or an address lookup. This flag traces the behavior generated
by the switch policy. (Default = noswtrace)



Change the initial timeout interval for waiting for a reply to
number seconds. Each retry doubles the timeout period.
(Default = 5 seconds)



Always use a virtual circuit when sending requests to the
server. (Default = novc)


If the lookup request was not
successful, an error message is printed. Possible errors are :



The server did not respond to a request after a certain amount
of time (changed with set timeout=

value) and a certain number of retries (changed with set
retry= value).

No response from


No name server is running on the server machine.

No records


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 set querytype

Non-existent domain


The host or domain name does not exist.

Connection refused


Network is unreachable


The connection to the name server could not be made at the
present time.

Server failure


The name server found an internal inconsistency in its database
and could not return a valid answer.



The name server refused to service the request.

Format error


The name server found that the request packet was not in the
proper format.


<B><FONT COLOR="#ff0000">nslookup</FONT></B> was
developed by the University of California, Berkeley.




Initial domain name and name server addresses



User’s initial options

Commentaires  Forum fermé


Dernière mise à jour

mardi 9 novembre 2021


275 Articles
Aucun album photo
Aucune brève
6 Sites Web
2 Auteurs


233 aujourd’hui
690 hier
903662 depuis le début
7 visiteurs actuellement connectés