nstest(1M)
NAME
nstest - DNS test shell
SYNOPSIS
nstest [-d] [-i] [-r] [-v] [-p port] [ inet_addr [logfile]]
DESCRIPTION
nstest is an interactive DNS test program. Queries are
formed and sent by user command; any reply received is
printed on the standard output. inet_addr is the Internet
address of the DNS resolver to which nstest should send its
queries. If inet_addr is not included, nstest first tries
to contact a DNS server on the local host; if that fails,
it tries the servers listed in the /etc/resolv.conf file.
If a logfile is supplied, nstest uses it to log the queries
sent and replies received.
OPTIONS
-d Causes nstest to create a file named ns_packet.dump
(if it does not exist) and write into it a raw
(binary) copy of each packet sent. If ns_packet.dump
does exist, nstest will truncate it.
-i Sets the RES_IGNTC flag on the queries it makes. See
resolver(3RESOLV) for a description of the RES_IGNTC
flag.
-r Turns off the RES_RECURSE flag on the queries it
makes. See resolver(3RESOLV) for a description of the
RES_RECURSE flag.
-v Turns on the RES_USEVC and RES_STAYOPEN flags on the
res_send () calls made. See resolver(3RESOLV) for a
description of the RES_USEVC and RES_STAYOPEN flags.
-p Causes nstest to use the supplied port instead of the
default name server port.
USAGE
When nstest starts, it prints a prompt (">") and waits for
user input. DNS queries are formed by typing a key letter
followed by the appropriate argument. Each key letter
results in a call to res_mkquery () with op set to either
IQUERY or QUERY and type set to one of the type values
(defined in <arpa/nameser.h>). (Any other key letter than
those listed below causes nstest to print a summary of the
following table.)
Key Letter &
Argument Op Type
ahost QUERY T_A
Aaddr IQUERY T_A
Buser QUERY T_MG
buser QUERY T_MB
chost QUERY T_CNAME
fhost QUERY T_UINFO
Ggid IQUERY T_GID
ghost QUERY T_GID
hhost QUERY T_HINFO
ihost QUERY T_MINFO
Mhost QUERY T_MAILB
mhost QUERY T_MX
nhost QUERY T_NS
phost QUERY T_PTR
rhost QUERY T_MR
shost QUERY T_SOA
Thost QUERY T_TXT
Uuid IQUERY T_UID
uhost QUERY T_UID
whost QUERY T_WKS
xhost QUERY T_AXFR
After the query is successfully formed, res_send () is
called to send it and wait for a reply. nstest then prints
the following on the standard output:
o a summary of the request and reply packets, including
the HEADER structure (defined in <arpa/nameser.h>)
used in the request
o the question being asked of the name server
o an enumeration of the name server(s) being polled
o a summary of the HEADER structure received in the
reply
o the question the name server answered
o the answer itself
EXAMPLES
Example 1: Fetching the Address of a Host From the Sun Name
Server
The following command fetches the address of host
playground.sun.com from the Sun name server:
$ nstest 192.9.5.1
> aplayground.sun.com
The utility nstest returns the following:
res_mkquery(0, playground.sun.com, 1, 1)
res_send()
HEADER:
opcode = QUERY, id = 1, rcode = NOERROR
header flags: rd
qdcount = 1, ancount = 0, nscount = 0, arcount = 0
QUESTIONS:
playground.sun.com, type = A, class = IN
Querying server (# 1) address = 192.9.5.1
got answer:
HEADER:
opcode = QUERY, id = 1, rcode = NOERROR
header flags: qr aa rd ra
qdcount = 1, ancount = 1, nscount = 0, arcount = 0
QUESTIONS:
playground.sun.com, type = A, class = IN
ANSWERS:
playground.sun.com
type = A, class = IN, ttl = 1 day, dlen = 4
internet address = 192.9.5.5
Example 2: Looking Up a PTR record
The following command looks up a PTR record:
$ nstest 192.9.5.1
> p5.5.9.192.in-addr.arpa
The utility nstest would return the following:
res_mkquery(0, 5.5.9.192.in-addr.arpa, 1, 12)
res_send()
HEADER:
opcode = QUERY, id = 2, rcode = NOERROR
header flags: rd
qdcount = 1, ancount = 0, nscount = 0, arcount = 0
QUESTIONS:
5.5.9.192.in-addr.arpa, type = PTR, class = IN
Querying server (# 1) address = 192.9.5.1
got answer:
HEADER:
opcode = QUERY, id = 2, rcode = NOERROR
header flags: qr aa rd ra
qdcount = 1, ancount = 1, nscount = 0, arcount = 0
QUESTIONS:
5.5.9.192.in-addr.arpa, type = PTR, class = IN
ANSWERS:
5.5.9.192.in-addr.arpa
type = PTR, class = IN, ttl = 7 hours 47 mins 2 secs, dlen = 23
domain name = playground.sun.com
FILES
/usr/include/arpa/nameser.h
Include file for implementation of DNS protocol
/usr/include/resolv.h
Include file for the resolver daemon (in.named)
ATTRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
____________________________________________________________
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
|_____________________________|_____________________________|
| Availability | SUNWcsu |
|_____________________________|_____________________________|
SEE ALSO
nslookup(1M), resolver(3RESOLV), attributes(5)
Man(1) output converted with
man2html