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