dnsquery

NAME

dnsquery - query domain name servers using resolver

SYNOPSIS

dnsquery [-dsv] [-c class] [-n nameserver]
		 [-p period] [-r retry] [-t type] host

DESCRIPTION

The dnsquery(1) program is a general interface to nameservers through BIND resolver library calls. The program supports queries to the nameserver with an opcode of QUERY. This program is intended to be a replacement or supplement to programs like nstest, nsquery and nslookup. All arguments except for host and nameserver are treated without case-sensitivity.

OPTIONS

-nnameserver
The nameserver to be used in the query. Nameservers can appear as either Internet addresses of the form w.x.y.z or can appear as domain names. (Default: as specified in /etc/resolv.conf.)
-ttype
The type of resource record of interest. Types include:
Aa
A address
NS
Nameserver
CNAME
Canonical name
PTR
Domain name pointer
SOA
Start of authority
WKS
Well-known service
HINFO
Host information
MINFO
Mailbox information
MX
Mail exchange
RP
Responsible person
MG
Mail group member
AFSDB
DCE or AFS server
ANY
Wildcard

Note that any case may be used. (Default: ANY.)

-cclass
The class of resource records of interest. Classes include:
IN
Internet
HS
Hesiod
CHAOS
Chaos
ANY
Wildcard

Note that any case may be used. (Default: IN.)

-rretry
The number of times to retry if the nameserver is not responding. (Default: 4.)
-pperiod
Period to wait before timing out. (Default: RES_TIMEOUT.)
-d
Turn on debugging. This sets the RES_DEBUG bit of the resolver's options field. (Default: no debugging.)
-s
Use a stream rather than a packet. This uses a Transmission Control Protocol (TCP) stream connection with the nameserver rather than a User Datagram Protocol (UDP) datagram. This sets the RES_USEVC bit of the resolver's options field. (Default: UDP datagram.)
-v
Synonym for the -s flag.
host
The name of the host (or domain) of interest.

FILES

/etc/resolv.conf
To get the default ns and search lists
<arpa/nameser.h>
List of usable RR types and classes
<resolv.h>
List of resolver flags

DIAGNOSTICS

If the resolver fails to answer the query and debugging has not been turned on, dnsquery(1) will simply print a message like:
Query failed (rc = 1): Unknown host

The value of the return code is supplied by h_errno.

BUGS

Queries of a class other than IN can have interesting results since ordinarily a nameserver only has a list of root nameservers for class IN resource records.

The dnsquery(1) utility uses a call to inet_addr(3) to determine whether the argument for the -n option is a valid Internet address. Unfortunately, inet_addr(3) seems to cause a segmentation fault with some (bad) IP addresses (such as 1.2.3.4.5

AUTHOR

Bryan Beecher

SEE ALSO

nslookup(1)

resolver(1)