<?xml version="1.0" encoding="UTF-8"?>
<!-- **************************************************************************
.... For copyright and licensing terms, see the file named COPYING.
.... **************************************************************************
.-->
<?xml-stylesheet href="docbook-xml.css" type="text/css"?>

<refentry id="dnsq">

<refmeta xmlns:xi="http://www.w3.org/2001/XInclude">
<refentrytitle>dnsq</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class="manual">user commands</refmiscinfo>
<refmiscinfo class="source">djbwares</refmiscinfo>
<xi:include href="version.xml" />
</refmeta>

<refnamediv>
<refname>dnsq</refname>
<refpurpose>query a content DNS server using the DNS protocol</refpurpose>
</refnamediv>

<refsynopsisdiv>
<cmdsynopsis>
<command>dnsq</command>
<arg choice='req'><replaceable>t</replaceable></arg>
<arg choice='req'><replaceable>fqdn</replaceable></arg>
<arg choice='req'><replaceable>s</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>

<refsection>
<title>Description</title>

<para>
<command>dnsq</command> looks up resource records of type <replaceable>t</replaceable> for <replaceable>fqdn</replaceable> by making a Domain Name System request to a server at <replaceable>s</replaceable>.
It prints the results in a human-readable format, more compact than the <citerefentry><refentrytitle>dig</refentrytitle><manvolnum>1</manvolnum></citerefentry> output format.
</para>

<para>
<replaceable>s</replaceable> is expected to indicate one or more content DNS servers, and the request is marked as non-recursive.
<replaceable>t</replaceable> may be a name or a number.
Currently recognized names are:
<code>any</code>,
<code>a</code>,
<code>ns</code>,
<code>mx</code>,
<code>ptr</code>,
<code>txt</code>,
<code>cname</code>,
<code>soa</code>,
<code>loc</code>,
<code>hinfo</code>,
<code>rp</code>,
<code>sig</code>,
<code>key</code>,
<code>aaaa</code>,
<code>axfr</code>,
<code>srv</code>, and
<code>opt</code>.
</para>

<para>
<command>dnsq</command> feeds <replaceable>s</replaceable> through name qualification and then looks it up, to find those content DNS servers, using the locally configured DNS proxy server.
See <citerefentry><refentrytitle>djbdns-client</refentrytitle><manvolnum>5</manvolnum></citerefentry> for how this server is found, for how name qualification operates, and for certain <replaceable>s</replaceable> values and standard domain names that short-circuit DNS lookups to the proxy DNS server(s) and possibly name qualification as well.
</para>

<para>
<command>dnsq</command> makes all DNS lookups using the specified content DNS server(s), and performs no name qualification on what is taken to already be a "fully-qualified" domain name (trailing dot or no) <replaceable>fqdn</replaceable>.
It does not treat any values of <replaceable>fqdn</replaceable> specially.
</para>

<caution>
<command>dnsq</command> is a diagnostic tool, and thus permits using improper values of <replaceable>t</replaceable> and any value of <replaceable>fqdn</replaceable>.
It also does not have a special multiple response "zone transfer" mode.
</caution>

<note>
<command>dnsq</command> <arg choice='plain'>axfr</arg>, <command>dnsq</command> <arg choice='plain'>any</arg>, and <command>dnsq</command> <arg choice='plain'>opt</arg> simulate things that valid DNS clients will not actually do.
See RFC 8482 for the particular case of <arg choice='plain'>any</arg> passing into desuetude, and RFC 6891 for why <arg choice='plain'>opt</arg> is never a valid client query type.
</note>

<note>
If you want to perform (or diagnose) a "zone transfer" you should use <citerefentry><refentrytitle>axfr-get</refentrytitle><manvolnum>1</manvolnum></citerefentry>, not <command>dnsq</command> <arg choice='plain'>axfr</arg>.
</note>

<note>
Some standard or widely abused values of <replaceable>fqdn</replaceable> are handled internally by DNS client libraries and proxy DNS servers, and in normal operations will never reach a content DNS server.
</note>

</refsection>

<refsection>
<title>See also</title>
<variablelist>
<varlistentry>
<term><citerefentry><refentrytitle>dnsqr</refentrytitle><manvolnum>1</manvolnum></citerefentry></term>
<listitem><para>a similar tool that makes requests to proxy DNS servers</para></listitem>
</varlistentry>
<varlistentry>
<term><citerefentry><refentrytitle>tinydns-get</refentrytitle><manvolnum>1</manvolnum></citerefentry></term>
<listitem><para>a tool that makes direct queries against a content DNS server's database</para></listitem>
</varlistentry>
</variablelist>
</refsection>

<refsection>
<title>History</title>
<para>
<command>dnsq</command> was originally part of <personname><firstname>Daniel</firstname> <othername>J.</othername> <surname>Bernstein</surname></personname>'s djbdns toolset in 1999.
</para>
</refsection>

<refsection>
<title>Author</title>
<para>
Original code and documentation by <personname><firstname>Daniel</firstname> <othername>J.</othername> <surname>Bernstein</surname></personname>.
Documentation modernizations by <personname><firstname>Jonathan</firstname> <surname>de Boyne Pollard</surname></personname>.
</para>
</refsection>

</refentry>
