Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > N

nslookup(1)

BIND 9.3
HP-UX 11i Version 3: February 2007
» 

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index

NAME

nslookup — query name servers interactively

SYNOPSIS

Single Host Mode

nslookup [-swdebug] [-setoption]... host [server]

Interactive Mode

nslookup [-swdebug] [-setoption]... [- [server]]

DESCRIPTION

The nslookup program queries Internet domain name servers. It follows the configured name resolution algorithm of the host and queries NIS, DNS, and host tables.

In Single Host Mode (noninteractive), nslookup queries a name server for information about one host or domain. This mode occurs when you specify a host in the command.

In Interactive Mode, nslookup lets you make several requests in the same session. For example, you can query a name server for information about various hosts and domains or print a list of hosts in the domain. This mode occurs when you omit the host (and server) in the command or when you use the special - placeholder.

Options

-setoption

Set the setoption, as defined for the set command. See The set Command subsection in the INTERACTIVE COMMANDS section.

-swdebug

Turn on tracing during command initialization, causing the switch module to print out a trace of the scan and parse actions on the hosts database entry in the /etc/nsswitch.conf file (see nsswitch.conf(4)). It may be used to debug syntactic errors in the switch configuration file. See also the set option [no]trace.

Note: swdebug is not a set command option, so you cannot turn it off in interactive mode.

Operands

host

The host name or IP address of a host system. If host is present, the command is executed immediately (noninteractively). If it is omitted, nslookup enters interactive mode.

-

Set interactive mode. This placeholder is needed if you specify server for interactive mode.

server

The host name or IP address of a domain name server. If omitted, nslookup uses the policy described in the Default Lookup Policy subsection.

Initialization File

The setoptions and swdebug (see the Options subsection) can be specified in a .nslookuprc startup file in the user's home directory. Enter them one per line without the leading hyphen (-).

Default Lookup Policy

If a server has not been specified explicitly to override the switch policy, nslookup initializes each of the name services in the hosts database in the switch configuration file /etc/nsswitch.conf (see nsswitch.conf(4)), but uses the first name service for lookup. The initialization of the name services may cause a delay in obtaining the response if any of the name services is not responding. For example, consider when the hosts database is defined with the following name services:

hosts : files dns nis

If the name servers mentioned in /etc/resolv.conf (see resolver(4)) are unavailable, there will be a delay in trying to initialize the name servers. The handling of the query thereafter follows the switch policy, as would be expected.

nslookup contacts the name servers mentioned in /etc/resolv.conf sequentially but does not cycle through them like the resolver routines do (see resolver(3N)).

Note: nslookup should not be used as a command-line substitute for the resolver routines unless the differences in resolution behavior between nslookup and the resolver routines are understood and are acceptable for the scripting environment where nslookup will be employed.

The following hosts name services are recognized:

dns

Use the servers defined in the /etc/resolv.conf file.

files

Use the entries in the /etc/hosts file.

nis

Use the maps at the NIS server.

Note: NIS+ is not supported by nslookup. If the nisplus name service is included in the hosts database, it is ignored.

If there is no hosts database in the /etc/nsswitch.conf file or there is no /etc/nsswitch.conf file, nslookup uses this name service sequence: dns nis files.

To override the switch policy and query DNS servers directly, you can specify a name server by entering the server operand on the command line or by using the server or lserver command in interactive mode. Whenever an action is taken that causes the switch policy to be overridden, a warning message is displayed.

If the first successful hosts name service is nis or files, nslookup has a reduced interactive command set; the help command shows which commands are currently valid.

Use the reset command in interactive mode to restore the default policy.

INTERACTIVE COMMANDS

Commands can be interrupted at any time with the intr character, commonly Ctrl-C. To exit, type the eof character, commonly Ctrl-D, or use the exit command. (See stty(1).) To treat a built-in command as a host name, precede it with an escape character (\). When using NIS or the host table, only host names and Internet addresses are allowed as commands. An unrecognized command is interpreted as a host name.

General Commands

host [server]

Look up information for host using the current default server or using server if specified. If host is an Internet address and the query type is A or PTR, the name of the host is returned. If host is a name and does not have a trailing period, one or more domains are appended to the name. This behavior depends on the state of the set options domain, srchlist, defname, and search; see The set Command. Answers from a name server's cache are labeled non-authoritative.

?

See the help command.

exit

Exit the program.

finger [name] [> filename]

finger [name] [>> filename]

Connects with the finger server on the current host. name is a user name or user ID on the host; it is optional. The current host is defined when a previous lookup for a host was successful and returned address information. The output can create/overwrite (>) or append to (>>) filename.

help

?

Print a brief summary of commands that are valid in the current context.

ls [option] domain [> filename]

ls [option] domain [>> filename]

List information available for domain. The default output contains host names and their Internet addresses. option can be one of the following:

-a

List aliases of hosts in the domain (synonym for -t CNAME).

-d

List all records for the domain (synonym for -t ANY).

-h

List CPU and operating system information for the domain (synonym for -t HINFO).

-s

List well-known services of hosts in the domain (synonym for -t WKS).

-t querytype

List all records of the specified type. See querytype in The set Command.

The output can create/overwrite (>) or append to (>>) filename. When output is directed to a file, a # character is printed to standard output for every 50 records received from the server.

lserver domain

See the server command.

policy

Print out the policy read from the hosts database in the switch configuration file (see nsswitch.conf(4)). The number of name services specified in the file are shown, as well as the order and criteria on how the name services are to be used. The four statuses of the criteria are represented by four characters in square brackets. The order of the status characters is:

SUCCESS NOTFOUND UNAVAIL TRYAGAIN

The letters used in the four status positions are:

R Return. C Continue; try next name service, if any.

If no criteria are specified between two sources, then the default actions assigned to the statuses are [RCCC].

reset

Return to using the configured name service switch policy and reset to the original name servers.

root

Change the default server to the server for the root of the domain name space. The root command is a synonym for lserver root-host, where root-host is the root server specified with the set root command. The default root server is ns.nic.ddn.mil.

server domain

lserver domain

Change the default server to domain. lserver uses the initial server to look up information about domain while server uses the current default server. When server is used while the current name service being pointed to is either NIS or /etc/hosts, then the switch policy will be overridden until a reset is issued.

set [no]keyword[=value]

Change state information that affects lookups. See The set Command.

view filename

Sort and list the contents of filename, using more (see more(1)). This is useful for viewing files written by the finger and ls commands.

The set Command

The set command changes state information that affects the lookups. The options can also be entered as setoption values on the command line. For example, -all.

Syntax

set [no]keyword

The prefix no negates the request. The no action is described in brackets ([...]).

set keyword[=value]

The keyword option is set to value.

Other characters in brackets ([...]) are optional, allowing for keyword abbreviations. Spaces are not permitted.

Options

all

Print the current values of the various set options, along with information about the current default server and host.

cl[ass]=value

Change the query class to one of:

IN

The Internet class.

CHAOS

The Chaosnet class.

HESIOD

The MIT Athena Hesiod class.

ANY

Wildcard (any of the above).

The class specifies the protocol group of the information. The default is class=IN.

[no]d2

Turn on [turn off] exhaustive debugging mode. Essentially all fields of every packet are printed. The default is nod2.

[no]deb[ug]

Turn on [turn off] debugging mode. More information is printed about the packet sent to the server and the resulting answer. The default is nodebug.

[no]def[name]

Append [do not append] the default domain name to a single-component lookup request (that is, one that does not contain a period character). The default is defname.

do[main]=name

Change the default domain name to name. The default domain name is appended to a lookup request, depending on the state of the defname and search options. The domain search list contains the parents of the default domain if it has at least two components in its name. For example, if the default domain is CC.Berkeley.EDU, the search list is CC.Berkeley.EDU and Berkeley.EDU. Use the set srchlist command to specify a different list. Use the set all command to display the list. The default is the value from host name, /etc/resolv.conf, or the LOCALDOMAIN environment variable.

[no]ig[nore]

Ignore [do not ignore] truncation errors. The default is noignore.

po[rt]=value

Change the default TCP/UDP name server port to value. The default is port=53.

q[uerytype]=value

ty[pe]=value

Change the type of information returned from a query to one of:

A

Host's IPv4 address

AAAA

Host's IPv6 address

ANY

All types of data

CNAME

Canonical name for an alias

GID

Group ID

HINFO

Host 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

Name server for the named zone

PTR

Host name if the query is an Internet address, otherwise the pointer to other information.

SOA

Start of authority record

TXT

Text information

UID

User ID

UINFO

User information

WKS

Well-known service description

[no]rec[urse]

Tell the name server to query [not to query] other servers if it does not have the information. The default is recurse.

ret[ry]=number

Set the number of retries to number. When a reply to a request is not received within a certain amount of time (changed with the set timeout command ), the timeout period is doubled and the request is resent. The retry value controls how many times a request is resent before giving up. The default is retry=4.

ro[ot]=host

Change the name of the root server to host. This affects the root command. The default is root=ns.nic.ddn.mil.

[no]sea[rch]

If the lookup request contains at least one period but doesn't end with a trailing period, append [do not append] the domain names in the domain search list to the request until an answer is received. See hostname(5). The default is search.

srchl[ist]=name1[/name2]...

Change the default domain name to name1 and the domain search list to name1, name2, and so on. A maximum of 6 names separated by slashes (/) can be specified. For example,

set srchlist=lcs.MIT.EDU/ai.MIT.EDU/MIT.EDU

sets the domain to lcs.MIT.EDU and the search list to the three names. This command overrides the default domain name and search list of the set domain command. Use the set all command to display the list. The default is a value based on the host name, /etc/resolv.conf, or the LOCALDOMAIN environment variable.

[no]swtr[ace]

Display [do not display] information about the sources used for resolving a name or an address lookup. This flag traces the behavior generated by the switch policy. The default is noswtrace.

t[imeout]=number

Change the initial timeout interval for waiting for a reply to number seconds. Each retry doubles the timeout period. The default is timeout=5.

ty[pe]=value

See the querytype option.

[no]v[c]

Always use [do not 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 is printed. Possible error messages are:

Connection refused

The connection to the name server could not be made at the present time.

Format error

The name server found that the request packet was not in the proper format.

Network is unreachable

The connection to the name server could not be made at the present time.

No records

The server does not have resource records of the current query type for the host, although the host name is valid. The query type is specified with the set querytype command.

No response from server

No name server is running on the server machine.

Non-existent domain

The host or domain name does not exist.

Refused

The name server refused to service the request.

Server failure

The name server found an internal inconsistency in its database and could not return a valid answer.

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).

EXAMPLES

To change the default query type to host information and the initial timeout to 10 seconds, and enter interactive mode:

nslookup -query=hinfo -timeout=10

AUTHOR

nslookup was developed by the Internet Systems Consortium (ISC).

FILES

$HOME/.nslookuprc

User's initial options.

/etc/hosts

Host name data base.

/etc/nsswitch.conf

Configuration file for the name-service switch.

/etc/resolv.conf

Initial domain name and name server addresses.

SEE ALSO

more(1), stty(1), named(1M), resolver(3N), hosts(4), nsswitch.conf(4), resolver(4), hostname(5).

Requests for Comments (RFC): 1034, 1035, available online at http://www.rfc-editor.org/.

HP-UX IP Address and Client Management Administrator's Guide, available online at http://docs.hp.com.

BIND 9 Administrator Reference Manual, available from the Internet Systems Consortium at http://www.isc.org/sw/bind/arm93.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.