nslookup(1M) — ADMINISTRATOR COMMANDS
NAME
nslookup − query DARPA Internet name servers interactively
SYNOPSIS
nslookup [ −opt ...]# interactive mode using default server nslookup [ −opt ...] − server # interactive mode using “server” nslookup [ −opt ...] host # just look up host using default server nslookup [ −opt ...] host server # just look up “host” using “server”
DESCRIPTION
The nslookup program can be used interactively to query ARPA Internet domain name servers. When nslookup is utilized “interactively”, the user can query name servers for information about specific hosts and domains; in the “non-interactive” mode, a user can only print a list of hosts within a domain.
INTERACTIVE MODE vs NON-INTERACTIVE MODE
The “interactive” mode will be entered for the following cases:
a)if no arguments are given (i.e., the default name server is to be used),
b)if the first argument is a hyphen (−) and the second argument is the host name or the Internet address of a name server.
The program enters the “non-interactive” mode when the first argument specifies the name or (Internet address) of the host to be looked up; the optional second argument then would specify the host name or address of a name server.
The options listed under the “set” command below can be specified in the .nslookuprc file in the user’s home directory if they are listed there in a one-per-line format. These options can also be specified on the command line if they precede the arguments and are prefixed with a hyphen. For example, to change the default query type to host information and the initial timeout to 10 seconds, the user would enter: nslookup −query=hinfo −timeout=10
NON-INTERACTIVE OPTIONS
host The default server will be used, depending upon the existence of the /etc/resolv.conf file.
host server
Look up host using the specified server.
OVERVIEW
The DARPA Internet “domain name-space” is tree-structured, with four top-level domains at present:
COM commercial establishments
EDU educational institutions
GOV government agencies
MIL MILNET hosts
When looking for a specific host, you need to know something about the host’s organization in order to determine the top-level domain it belongs to. For instance, if you want to find the Internet address of a machine at UCLA, do the following:
• Connect with the root server using the root command. The root server of the name space has knowledge of the top-level domains.
• Since UCLA is a university, its domain name is ucla.edu. Connect with a server for the ucla.edu domain with the command server ucla.edu. The response will print the names of hosts that act as servers for that domain.
• To request information about a particular host in the domain (for example, locus), just type the host name. To request a listing of hosts in the UCLA domain, use the ls command. The ls command will need a domain name (in this case, ucla.edu) as an argument.
If you are connected with a name server that handles more than one domain, all lookups for host names must be fully specified with its domain. For instance, the domain harvard.edu is served by seismo.css.gov, which also services the css.gov and cornell.edu domains. Therefore, a lookup request for the host aiken in the harvard.edu domain must be specified as aiken.harvard.edu. However, the
set domain=name
and
set defname
commands can be used to append a domain name to each request on an automatic basis.
After a successful lookup of a host, you may use the finger command to see who is on the system or to “finger” a specific person. You can get other information about the host by using
set querytype=value
command to change the type of information desired and to request another lookup. (finger requires the type to be A.)
INTERACTIVE COMMANDS
The following basic rules apply to an “interactive” command line:
a)The command line length must be less than 256 characters;
b)to end a command line, enter <^D> (EOF);
c)a built-in command can be used as a host name by preceding it with an escape character (“\”);
d)any unrecognized command will be interpreted as a host name. The following commands and command options are provided:
host [server]
Look up information for host using the current default server or using server, if specified. To look up a host name not in the current domain, append a period to this host name.
If host is an Internet address and if the “query type” is A or PTR, the host name will be returned. If host is a name and does not have a trailing period, the default domain name will be appended to this name.
NOTE: This behavior depends of the state of the set options domain, srchlist, defname, and search.
server domain
lserver domain
Change the default server to domain. The lserver command will use the initial server to look up information about domain while the server command will use the current default server. If an authoritative answer cannot be found, the names of servers that might have the answer are returned.
root
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 lserver ns.nic.ddn.mil.) The name of the root server can be changed with the set root command (see below).
finger [name]
Connect with the finger server on the current host, which a previous lookup for a host was successful and returned address information (see the set querytype=A command). The name argument is optional. As with the shell, output can be redirected to a named file using > and >>.
ls [option] domain [> filename]
ls [option] domain [>> filename]
List the information available for domain. The default output contains host names and their respective Internet addresses; as a option, this output can be created as (or appended to) filename. The following option types are available:
−t querytype
lists all records of the specified type (see querytype below)
−a lists aliases of hosts in the domain (a synonym for −t CNAME).
−h lists the CPU and Operating System information for the domain (a synonym for −t HINFO.)
−s lists the “well-known services” of the hosts in this domain (a synonym for −t WKS ).
When output is directed to a file, a hash mark (#) is printed for every 50 records received from the server.
view filename
Sort and list the output of the ls command with more(1).
help
? Print a brief summary of commands.
exit
Exits the program.
set keyword [=value] This command is used to change state information that affects the lookups. The valid keywords are:
all Prints the current values of the various options to set. Information about the current default server and host is also printed.
class=value
Change the query class to one of the following:
IN the Internet class.
CHAOS
the Chaos class.
HESIOD
the MIT Athena Hesiod class.
ANY wildcard (i.e., any of the above): The class specifies the protocol group of the information.
The default value is IN, abbreviation = cl.
[no]deb[ug]
Enable debugging mode. A lot more information is printed about the packet sent to the server and the resulting answer. The default is nodebug.
[no]def[name]
Append the default domain name to every lookup. The default is nodefname.
do[main]=filename
Change the default domain name to filename. The default domain name will be appended to all lookup requests if the defname option has been set. The default is the value in /etc/resolv.conf.
q[uerytype]=value
Change the type of information returned from a query to one of:
A The host’s Internet address (the default value).
CNAME
The canonical name for an alias.
HINFO The host CPU and its Operating System type.
MD The mail destination.
MX The mail exchanger.
MB The mailbox domain name.
MG The mail group member.
MINFO The mailbox or mail list information.
(Other types specified in the RFC 1035 document are valid, but are not very useful.)
[no]rec[urse]
Tell the name server to query other servers if it does not have the information. The default is recurse.
ret[ry]=count
Set the number of times to retry a request before giving up to count. When a reply to a request is not received within a certain amount of time (changed with set timeout), the request will be re-sent. The default value of count is 2.
ro[ot]=host
Change the name of the root server to host. This affects the root command. The default root server is ns.nic.ddn.mil.
t[imeout|]=interval
Change the timeout interval for a reply to interval seconds. The default interval is 10 seconds.
[no]v[c]
Always use a virtual circuit when sending requests to the server. The default is novc.
DIAGNOSTICS
If the lookup request was not successful, an error message will be printed. The possible errors are:
Time-out
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 information
Depending on the query type set with the set querytype command, no information about the host was available, but the host name is valid.
Non-existent domain
The host or domain name does not exist.
Connection refused
Network is unreachable
The connection to the name or finger server could not be made at the current time. This error commonly occurs with finger requests.
Server failure
The name server found an internal inconsistency in its database and could not return a valid answer.
Refused
The name server refused to service the request.
The following error should not occur: this indicates a bug in the program.
Format error
The name server found that the request packet was not in the proper format.
FILES
/etc/resolv.conf initial domain name and name server addresses.
SEE ALSO
named(1M), resolver(3N), resolv.conf(4).
RFC 1035, RFC 1183.
NOTES
The root server does not have information about ucla.edu, but knows the names and addresses of hosts that do. Once located by the root server, all future queries will be sent to the UCLA name server.
The host behavior depends of the state of the set options domain, srchlist, defname, and search.
— Internet Utilities