xref: /netbsd/external/mpl/bind/dist/bin/dig/nslookup.rst (revision 497bf0b8)
1.. Copyright (C) Internet Systems Consortium, Inc. ("ISC")
2..
3.. SPDX-License-Identifier: MPL-2.0
4..
5.. This Source Code Form is subject to the terms of the Mozilla Public
6.. License, v. 2.0.  If a copy of the MPL was not distributed with this
7.. file, you can obtain one at https://mozilla.org/MPL/2.0/.
8..
9.. See the COPYRIGHT file distributed with this work for additional
10.. information regarding copyright ownership.
11
12.. highlight: console
13
14.. _man_nslookup:
15
16nslookup - query Internet name servers interactively
17----------------------------------------------------
18
19Synopsis
20~~~~~~~~
21
22:program:`nslookup` [-option] [name | -] [server]
23
24Description
25~~~~~~~~~~~
26
27``nslookup`` is a program to query Internet domain name servers.
28``nslookup`` has two modes: interactive and non-interactive. Interactive
29mode allows the user to query name servers for information about various
30hosts and domains or to print a list of hosts in a domain.
31Non-interactive mode prints just the name and requested
32information for a host or domain.
33
34Arguments
35~~~~~~~~~
36
37Interactive mode is entered in the following cases:
38
39a. when no arguments are given (the default name server is used);
40
41b. when the first argument is a hyphen (-) and the second argument is
42   the host name or Internet address of a name server.
43
44Non-interactive mode is used when the name or Internet address of the
45host to be looked up is given as the first argument. The optional second
46argument specifies the host name or address of a name server.
47
48Options can also be specified on the command line if they precede the
49arguments and are prefixed with a hyphen. For example, to change the
50default query type to host information, with an initial timeout of 10
51seconds, type:
52
53::
54
55   nslookup -query=hinfo  -timeout=10
56
57The ``-version`` option causes ``nslookup`` to print the version number
58and immediately exit.
59
60Interactive Commands
61~~~~~~~~~~~~~~~~~~~~
62
63``host [server]``
64   This command looks up information for ``host`` using the current default server or
65   using ``server``, if specified. If ``host`` is an Internet address and the
66   query type is A or PTR, the name of the host is returned. If ``host`` is
67   a name and does not have a trailing period (``.``), the search list is used
68   to qualify the name.
69
70   To look up a host not in the current domain, append a period to the
71   name.
72
73``server domain`` | ``lserver domain``
74   These commands change the default server to ``domain``; ``lserver`` uses the initial
75   server to look up information about ``domain``, while ``server`` uses the
76   current default server. If an authoritative answer cannot be found,
77   the names of servers that might have the answer are returned.
78
79``root``
80   This command is not implemented.
81
82``finger``
83   This command is not implemented.
84
85``ls``
86   This command is not implemented.
87
88``view``
89   This command is not implemented.
90
91``help``
92   This command is not implemented.
93
94``?``
95   This command is not implemented.
96
97``exit``
98   This command exits the program.
99
100``set keyword[=value]``
101   This command is used to change state information that affects the
102   lookups. Valid keywords are:
103
104   ``all``
105      This keyword prints the current values of the frequently used options to
106      ``set``. Information about the current default server and host is
107      also printed.
108
109   ``class=value``
110      This keyword changes the query class to one of:
111
112      ``IN``
113         the Internet class
114
115      ``CH``
116         the Chaos class
117
118      ``HS``
119         the Hesiod class
120
121      ``ANY``
122         wildcard
123
124      The class specifies the protocol group of the information. The default
125      is ``IN``; the abbreviation for this keyword is ``cl``.
126
127   ``nodebug``
128      This keyword turns on or off the display of the full response packet, and any
129      intermediate response packets, when searching. The default for this keyword is
130      ``nodebug``; the abbreviation for this keyword is ``[no]deb``.
131
132   ``nod2``
133      This keyword turns debugging mode on or off. This displays more about what
134      nslookup is doing. The default is ``nod2``.
135
136   ``domain=name``
137      This keyword sets the search list to ``name``.
138
139   ``nosearch``
140      If the lookup request contains at least one period, but does not end
141      with a trailing period, this keyword appends the domain names in the domain
142      search list to the request until an answer is received. The default is ``search``.
143
144   ``port=value``
145      This keyword changes the default TCP/UDP name server port to ``value`` from
146      its default, port 53. The abbreviation for this keyword is ``po``.
147
148   ``querytype=value`` | ``type=value``
149      This keyword changes the type of the information query to ``value``. The
150      defaults are A and then AAAA; the abbreviations for these keywords are
151      ``q`` and ``ty``.
152
153      Please note that it is only possible to specify one query type. Only the default
154      behavior looks up both when an alternative is not specified.
155
156   ``norecurse``
157      This keyword tells the name server to query other servers if it does not have
158      the information. The default is ``recurse``; the abbreviation for this
159      keyword is ``[no]rec``.
160
161   ``ndots=number``
162      This keyword sets the number of dots (label separators) in a domain that
163      disables searching. Absolute names always stop searching.
164
165   ``retry=number``
166      This keyword sets the number of retries to ``number``.
167
168   ``timeout=number``
169      This keyword changes the initial timeout interval to wait for a reply to
170      ``number``, in seconds.
171
172   ``novc``
173      This keyword indicates that a virtual circuit should always be used when sending requests to the server.
174      ``novc`` is the default.
175
176   ``nofail``
177      This keyword tries the next nameserver if a nameserver responds with SERVFAIL or
178      a referral (nofail), or terminates the query (fail) on such a response. The
179      default is ``nofail``.
180
181Return Values
182~~~~~~~~~~~~~
183
184``nslookup`` returns with an exit status of 1 if any query failed, and 0
185otherwise.
186
187IDN Support
188~~~~~~~~~~~
189
190If ``nslookup`` has been built with IDN (internationalized domain name)
191support, it can accept and display non-ASCII domain names. ``nslookup``
192appropriately converts character encoding of a domain name before sending
193a request to a DNS server or displaying a reply from the server.
194To turn off IDN support, define the ``IDN_DISABLE``
195environment variable. IDN support is disabled if the variable is set
196when ``nslookup`` runs, or when the standard output is not a tty.
197
198Files
199~~~~~
200
201``/etc/resolv.conf``
202
203See Also
204~~~~~~~~
205
206:manpage:`dig(1)`, :manpage:`host(1)`, :manpage:`named(8)`.
207