nslookup |
information stored in DNS servers.
Modes
nslookup has two modes of operation:
- Interactive
In this mode, an nslookup shell is opened so that
any sequence of nslookup commands can be run one
at a time. Enter interactive mode by typing:nslookup
- Noninteractive
In this mode, only a single nslookup command is
run, after which you return to the command prompt. The syntax is:nslookup -command host DNSserver
- -command
One of the nslookup commands in the following
list. The hyphen is part of the syntax.- host
The IP address or hostname of the host whose DNS information you want
to obtain from the DNS server. If you use a hyphen, the prompt
changes to nslookup interactive mode.- DNSserver
The IP address or hostname of the DNS server you want to query. (If
omitted, the default DNS server for the local machine is used.)
Commands
- exit
Quits the interactive mode of nslookup.- finger [username]
Fingers the current computer for a list of currently logged-on users.
If you specify username, then the information for that user is
obtained.- ls [option] dnsdomain [[> | >>] filename]
Lists (or redirects to a file) different subsets of resource records
for the specified DNS domain depending on the option selected,
specifically:- -t querytype
Lists all records of the specified type (see Table 5-22)- -a
Lists aliases of hosts in the DNS domain (same result as using
-t CNAME)- -d
Lists all records for the DNS domain (same result as using
-t ANY)- -h
Lists operating-system information for the DNS domain (same result as
using -t HINFO)- -s
Lists well-known services of host in the DNS domain (same result as
using -t WKS)
- lserver dnsdomain
Sets the default server to the specified DNS domain using the initial
server.- root
Sets the default server to the DNS root server
ns.nic.ddn.mil (same result as using
lserver ns.nic.ddn.mil). Use
set root to change the default
root server.- server dnsdomain
Sets the default server to the specified DNS domain using the current
default server.- set all
Displays the configuration of nslookup (how it
performs lookups).- set class=value
Modifies the query class, which can be IN (Internet class), CHAOS
(Chaos class), HESIOD (MIT Athena Hesiod class), or ANY (any class).
The default is IN (the other classes are obsolete).- set [no]d2
Enables or disables exhaustive debugging mode, which is incredibly
verbose (default is no).- set [no]debug
Enables or disables debugging mode, which is very verbose (default is
no).- set [no]defname
Appends the default DNS domain name to each query (default is
yes).- set domain=dnsdomain
Switches the default DNS domain to the one specified. This name is
appended to all nslookup queries if
defname is specified.- set [no]ignore
Reports or ignores packet errors (default is
ignore).- set port=value
Modifies the default TCP/UDP port for the DNS name server port. (This
is port 53 by default.)- set querytype=value
Specifies the types of resource records to obtain from the DNS server
(see Table 5-22). The default is Address (A)
record.- set [no]recurse
Enables or disables recursion, i.e.,whether the DNS server should
query other DNS servers if it can't respond with the
requested information. (Default is yes.)- set retry=number
Specifies the number of retries that can be performed by
nslookup when querying a DNS server until it gives
up (default is four times).- set root=DNSserver
Specifies the root server (affects the root
command earlier in this list). The default is
ns.nic.ddn.mil.- set [no]search
Toggles whether each DNS domain name in the search list should be
appended to a request until a response is received (default is yes).- set srchlist DNSdomain1[/DNSdomain2/...]
Specifies the DNS domain name search list (up to six DNS servers can
be specified).- set timeout=seconds
Modifies the initial time in seconds that nslookup
waits for a response to its first request (default is five seconds).- set type=value
Specifies the type of records to be requested from a DNS server (see
Table 5-22).- set [no]vc
Specifies that a virtual circuit should be used when sending requests
to a DNS server (default is no).- view filename
Displays the output of any previous commands that have been
redirected to files.
Value | Description |
---|---|
A | Computer's IP address |
ANY | All types of data |
CNAME | Canonical name for an alias |
GID | Group identifier of a group name |
HINFO | Computer's CPU and operating-system type |
MB | Mailbox domain name |
MG | Mail group member |
MINFO | Mailbox or mail-list information |
MR | Mail rename domain name |
MX | Mail exchanger |
NS | DNS name server for the named zone |
PTR | Hostname (if the query is an IP address) or pointer to other info |
SOA | DNS domain's start-of-authority record |
TXT | Text information |
UID | User identifier |
UINFO | User information |
WKS | Well-known service description |
Examples
Start nslookup in interactive mode:
C:\>nslookup
Default Server: izzy.mtitworld.com
Address: 172.16.11.99
>
Switch default DNS server to BACH :
> server bach.mtitworld.com
Default Server: bach.mtitworld.com
Address: 172.16.11.100
Specify that only Address (A) records should be queried:
> set query=A
Resolve host BEETHOVEN in domain
mtitworld.com into its IP address:
> beethoven.mtitworld.com
Server: bach.mtitworld.com
Address: 172.16.11.100
Name: beethoven.mtitworld.com
Address: 172.16.11.101
Query default DNS server for all records in its database:
> ls mtitworld.com
[bach.mtitworld.com]
mtitworld.com. A 172.16.11.100
mtitworld.com. NS server=bach.mtitworld.com
gc._msdcs A 172.16.11.105
gc._msdcs A 172.16.11.103
gc._msdcs A 172.16.11.104
gc._msdcs A 172.16.11.100
bach A 172.16.11.100
beethoven A 172.16.11.101
chopin A 172.16.11.102
distrib A 172.16.11.103
franck.distrib A 172.16.11.103
handel A 172.16.11.70
chopin.vancouver A 172.16.11.102
Notes
- nslookup commands must be 255 or fewer characters.
- To look up a computer not in the current DNS domain, append a period
to the name. For example, type
beethoven.otherdomain.com. at the interactive
nslookup prompt. - Use exit or Ctrl-C to escape from an
nslookup session. - An unrecognized command is interpreted as a hostname.
- For more information on using nslookup, see
DNS on Windows Server 2003
(O'Reilly).
See Also
DNS