1192886Sedwin.. Copyright (C) Internet Systems Consortium, Inc. ("ISC")
2192886Sedwin..
364499Swollman.. SPDX-License-Identifier: MPL-2.0
4273719Sedwin..
52742Swollman.. This Source Code Form is subject to the terms of the Mozilla Public
6273719Sedwin.. License, v. 2.0.  If a copy of the MPL was not distributed with this
7273719Sedwin.. file, you can obtain one at https://mozilla.org/MPL/2.0/.
82742Swollman..
9274563Sedwin.. See the COPYRIGHT file distributed with this work for additional
10274563Sedwin.. information regarding copyright ownership.
11274563Sedwin
12158421Swollman.. highlight: console
13158421Swollman
14274563Sedwin.. iscman:: nslookup
152742Swollman.. program:: nslookup
1686222Swollman.. _man_nslookup:
1720094Swollman
1820094Swollmannslookup - query Internet name servers interactively
1920094Swollman----------------------------------------------------
20274563Sedwin
21274563SedwinSynopsis
2220094Swollman~~~~~~~~
23274563Sedwin
24274563Sedwin:program:`nslookup` [-option] [name | -] [server]
25274563Sedwin
2620094SwollmanDescription
2719878Swollman~~~~~~~~~~~
2819878Swollman
2919878Swollman:program:`nslookup` is a program to query Internet domain name servers.
3019878Swollman:program:`nslookup` has two modes: interactive and non-interactive. Interactive
3119878Swollmanmode allows the user to query name servers for information about various
3219878Swollmanhosts and domains or to print a list of hosts in a domain.
33270817SpluknetNon-interactive mode prints just the name and requested
3419878Swollmaninformation for a host or domain.
3558787Sru
3658787SruArguments
3758787Sru~~~~~~~~~
38270817Spluknet
3958787SruInteractive mode is entered in the following cases:
4058787Sru
41270817Splukneta. when no arguments are given (the default name server is used);
42270817Spluknet
43270817Spluknetb. when the first argument is a hyphen (-) and the second argument is
4458787Sru   the host name or Internet address of a name server.
4558787Sru
4658787SruNon-interactive mode is used when the name or Internet address of the
4758787Sruhost to be looked up is given as the first argument. The optional second
4858787Sruargument specifies the host name or address of a name server.
4958787Sru
50270817SpluknetOptions can also be specified on the command line if they precede the
5158787Sruarguments and are prefixed with a hyphen. For example, to change the
5258787Srudefault query type to host information, with an initial timeout of 10
532742Swollmanseconds, type:
542742Swollman
552742Swollman::
562742Swollman
572742Swollman   nslookup -query=hinfo  -timeout=10
582742Swollman
592742SwollmanThe ``-version`` option causes :program:`nslookup` to print the version number
6019878Swollmanand immediately exit.
612742Swollman
622742SwollmanInteractive Commands
632742Swollman~~~~~~~~~~~~~~~~~~~~
64270817Spluknet
652742Swollman``host [server]``
662742Swollman   This command looks up information for :iscman:`host` using the current default server or
67149514Swollman   using ``server``, if specified. If :iscman:`host` is an Internet address and the
6821217Swollman   query type is A or PTR, the name of the host is returned. If :iscman:`host` is
699908Swollman   a name and does not have a trailing period (``.``), the search list is used
709908Swollman   to qualify the name.
712742Swollman
7219878Swollman   To look up a host not in the current domain, append a period to the
7319878Swollman   name.
7419878Swollman
7519878Swollman``server domain`` | ``lserver domain``
7619878Swollman   These commands change the default server to ``domain``; ``lserver`` uses the initial
7719878Swollman   server to look up information about ``domain``, while ``server`` uses the
7819878Swollman   current default server. If an authoritative answer cannot be found,
7919878Swollman   the names of servers that might have the answer are returned.
8019878Swollman
8119878Swollman``root``
8219878Swollman   This command is not implemented.
8319878Swollman
8419878Swollman``finger``
8519878Swollman   This command is not implemented.
8619878Swollman
8719878Swollman``ls``
8893799Swollman   This command is not implemented.
8958787Sru
9058787Sru``view``
9119878Swollman   This command is not implemented.
9219878Swollman
9319878Swollman``help``
949908Swollman   This command is not implemented.
95149514Swollman
969908Swollman``?``
979908Swollman   This command is not implemented.
98270817Spluknet
9921217Swollman``exit``
10019878Swollman   This command exits the program.
10119878Swollman
1029908Swollman``set keyword[=value]``
103149514Swollman   This command is used to change state information that affects the
1049908Swollman   lookups. Valid keywords are:
1059908Swollman
1069908Swollman   ``all``
1079908Swollman      This keyword prints the current values of the frequently used options to
10858787Sru      ``set``. Information about the current default server and host is
10958787Sru      also printed.
11058787Sru
11164499Swollman   ``class=value``
11264499Swollman      This keyword changes the query class to one of:
113175034Sedwin
114175034Sedwin      ``IN``
115175034Sedwin         the Internet class
116175034Sedwin
117175034Sedwin      ``CH``
11858787Sru         the Chaos class
11958787Sru
120270817Spluknet      ``HS``
12158787Sru         the Hesiod class
12258787Sru
12358787Sru      ``ANY``
124270817Spluknet         wildcard
12564499Swollman
126270817Spluknet      The class specifies the protocol group of the information. The default
12764499Swollman      is ``IN``; the abbreviation for this keyword is ``cl``.
12864499Swollman
12986222Swollman   ``nodebug``
13086222Swollman      This keyword turns on or off the display of the full response packet, and any
13186222Swollman      intermediate response packets, when searching. The default for this keyword is
13286222Swollman      ``nodebug``; the abbreviation for this keyword is ``[no]deb``.
13386222Swollman
13486222Swollman   ``nod2``
13586222Swollman      This keyword turns debugging mode on or off. This displays more about what
13686222Swollman      nslookup is doing. The default is ``nod2``.
13786222Swollman
13886222Swollman   ``domain=name``
13986222Swollman      This keyword sets the search list to ``name``.
14086222Swollman
14186222Swollman   ``nosearch``
14286222Swollman      If the lookup request contains at least one period, but does not end
14386222Swollman      with a trailing period, this keyword appends the domain names in the domain
14486222Swollman      search list to the request until an answer is received. The default is ``search``.
14586222Swollman
14686222Swollman   ``port=value``
14786222Swollman      This keyword changes the default TCP/UDP name server port to ``value`` from
14886222Swollman      its default, port 53. The abbreviation for this keyword is ``po``.
14986222Swollman
15086222Swollman   ``querytype=value`` | ``type=value``
15186222Swollman      This keyword changes the type of the information query to ``value``. The
152175034Sedwin      defaults are A and then AAAA; the abbreviations for these keywords are
153175034Sedwin      ``q`` and ``ty``.
154175034Sedwin
155175034Sedwin      Please note that it is only possible to specify one query type. Only the default
156175034Sedwin      behavior looks up both when an alternative is not specified.
157175034Sedwin
158175034Sedwin   ``norecurse``
159270817Spluknet      This keyword tells the name server to query other servers if it does not have
160175034Sedwin      the information. The default is ``recurse``; the abbreviation for this
161270817Spluknet      keyword is ``[no]rec``.
162175034Sedwin
163175034Sedwin   ``ndots=number``
164175034Sedwin      This keyword sets the number of dots (label separators) in a domain that
165175034Sedwin      disables searching. Absolute names always stop searching.
166175034Sedwin
167175034Sedwin   ``retry=number``
168175034Sedwin      This keyword sets the number of retries to ``number``.
169175034Sedwin
170183066Sedwin   ``timeout=number``
171183066Sedwin      This keyword changes the initial timeout interval to wait for a reply to
172183066Sedwin      ``number``, in seconds.
173183066Sedwin
174183066Sedwin   ``novc``
175183066Sedwin      This keyword indicates that a virtual circuit should always be used when sending requests to the server.
176183066Sedwin      ``novc`` is the default.
177183066Sedwin
178183864Sedwin   ``nofail``
179183864Sedwin      This keyword tries the next nameserver if a nameserver responds with SERVFAIL or
180183864Sedwin      a referral (nofail), or terminates the query (fail) on such a response. The
181183864Sedwin      default is ``nofail``.
182183864Sedwin
183183864SedwinReturn Values
184183864Sedwin~~~~~~~~~~~~~
185183864Sedwin
186183864Sedwin:program:`nslookup` returns with an exit status of 1 if any query failed, and 0
187183864Sedwinotherwise.
188183864Sedwin
189183864SedwinIDN Support
190184406Sedwin~~~~~~~~~~~
191273719Sedwin
192273719SedwinIf :program:`nslookup` has been built with IDN (internationalized domain name)
193184406Sedwinsupport, it can accept and display non-ASCII domain names. :program:`nslookup`
194184406Sedwinappropriately converts character encoding of a domain name before sending
195270817Splukneta request to a DNS server or displaying a reply from the server.
196270817SpluknetTo turn off IDN support, define the ``IDN_DISABLE``
197270817Spluknetenvironment variable. IDN support is disabled if the variable is set
198270817Spluknetwhen :program:`nslookup` runs, or when the standard output is not a tty.
199184406Sedwin
200184406SedwinFiles
201273719Sedwin~~~~~
202273719Sedwin
203273719Sedwin``/etc/resolv.conf``
204184406Sedwin
205184406SedwinSee Also
206198515Sedwin~~~~~~~~
207198515Sedwin
208198515Sedwin:iscman:`dig(1) <dig>`, :iscman:`host(1) <host>`, :iscman:`named(8) <named>`.
209273719Sedwin