xref: /netbsd-src/external/mpl/bind/dist/bin/tools/mdig.rst (revision 3f351f34c6d827cf017cdcff3543f6ec0c88b420)
1.. Copyright (C) Internet Systems Consortium, Inc. ("ISC")
2..
3.. SPDX-License-Identifier: MPL-2.0
4..
5.. This Source Code Form is subject to the terms of the Mozilla Public
6.. License, v. 2.0.  If a copy of the MPL was not distributed with this
7.. file, you can obtain one at https://mozilla.org/MPL/2.0/.
8..
9.. See the COPYRIGHT file distributed with this work for additional
10.. information regarding copyright ownership.
11
12.. highlight: console
13
14.. _man_mdig:
15
16mdig - DNS pipelined lookup utility
17-----------------------------------
18
19Synopsis
20~~~~~~~~
21
22:program:`mdig` {@server} [**-f** filename] [**-h**] [**-v**] [ [**-4**] | [**-6**] ] [**-m**] [**-b** address] [**-p** port#] [**-c** class] [**-t** type] [**-i**] [**-x** addr] [plusopt...]
23
24:program:`mdig` {**-h**}
25
26:program:`mdig` [@server] {global-opt...} { {local-opt...} {query} ...}
27
28Description
29~~~~~~~~~~~
30
31``mdig`` is a multiple/pipelined query version of ``dig``: instead of
32waiting for a response after sending each query, it begins by sending
33all queries. Responses are displayed in the order in which they are
34received, not in the order the corresponding queries were sent.
35
36``mdig`` options are a subset of the ``dig`` options, and are divided
37into "anywhere options," which can occur anywhere, "global options," which
38must occur before the query name (or they are ignored with a warning),
39and "local options," which apply to the next query on the command line.
40
41The ``@server`` option is a mandatory global option. It is the name or IP
42address of the name server to query. (Unlike ``dig``, this value is not
43retrieved from ``/etc/resolv.conf``.) It can be an IPv4 address in
44dotted-decimal notation, an IPv6 address in colon-delimited notation, or
45a hostname. When the supplied ``server`` argument is a hostname,
46``mdig`` resolves that name before querying the name server.
47
48``mdig`` provides a number of query options which affect the way in
49which lookups are made and the results displayed. Some of these set or
50reset flag bits in the query header, some determine which sections of
51the answer get printed, and others determine the timeout and retry
52strategies.
53
54Each query option is identified by a keyword preceded by a plus sign
55(``+``). Some keywords set or reset an option. These may be preceded by
56the string ``no`` to negate the meaning of that keyword. Other keywords
57assign values to options like the timeout interval. They have the form
58``+keyword=value``.
59
60Anywhere Options
61~~~~~~~~~~~~~~~~
62
63``-f``
64   This option makes ``mdig`` operate in batch mode by reading a list
65   of lookup requests to process from the file ``filename``. The file
66   contains a number of queries, one per line. Each entry in the file
67   should be organized in the same way they would be presented as queries
68   to ``mdig`` using the command-line interface.
69
70``-h``
71   This option causes ``mdig`` to print detailed help information, with the full list
72   of options, and exit.
73
74``-v``
75   This option causes ``mdig`` to print the version number and exit.
76
77Global Options
78~~~~~~~~~~~~~~
79
80``-4``
81   This option forces ``mdig`` to only use IPv4 query transport.
82
83``-6``
84   This option forces ``mdig`` to only use IPv6 query transport.
85
86``-b address``
87   This option sets the source IP address of the query to
88   ``address``. This must be a valid address on one of the host's network
89   interfaces or "0.0.0.0" or "::". An optional port may be specified by
90   appending "#<port>"
91
92``-m``
93   This option enables memory usage debugging.
94
95``-p port#``
96   This option is used when a non-standard port number is to be
97   queried. ``port#`` is the port number that ``mdig`` sends its
98   queries to, instead of the standard DNS port number 53. This option is
99   used to test a name server that has been configured to listen for
100   queries on a non-standard port number.
101
102The global query options are:
103
104``+[no]additional``
105   This option displays [or does not display] the additional section of a reply. The
106   default is to display it.
107
108``+[no]all``
109   This option sets or clears all display flags.
110
111``+[no]answer``
112   This option displays [or does not display] the answer section of a reply. The default
113   is to display it.
114
115``+[no]authority``
116   This option displays [or does not display] the authority section of a reply. The
117   default is to display it.
118
119``+[no]besteffort``
120   This option attempts to display [or does not display] the contents of messages which are malformed. The
121   default is to not display malformed answers.
122
123``+burst``
124   This option delays queries until the start of the next second.
125
126``+[no]cl``
127   This option displays [or does not display] the CLASS when printing the record.
128
129``+[no]comments``
130   This option toggles the display of comment lines in the output. The default is to
131   print comments.
132
133``+[no]continue``
134   This option toggles continuation on errors (e.g. timeouts).
135
136``+[no]crypto``
137   This option toggles the display of cryptographic fields in DNSSEC records. The
138   contents of these fields are unnecessary to debug most DNSSEC
139   validation failures and removing them makes it easier to see the
140   common failures. The default is to display the fields. When omitted,
141   they are replaced by the string "[omitted]"; in the DNSKEY case, the
142   key ID is displayed as the replacement, e.g., ``[ key id = value ]``.
143
144``+dscp[=value]``
145   This option sets the DSCP code point to be used when sending the query. Valid DSCP
146   code points are in the range [0...63]. By default no code point is
147   explicitly set.
148
149``+[no]multiline``
150   This option toggles printing of records, like the SOA records, in a verbose multi-line format
151   with human-readable comments. The default is to print each record on
152   a single line, to facilitate machine parsing of the ``mdig`` output.
153
154``+[no]question``
155   This option prints [or does not print] the question section of a query when an answer
156   is returned. The default is to print the question section as a
157   comment.
158
159``+[no]rrcomments``
160   This option toggles the display of per-record comments in the output (for example,
161   human-readable key information about DNSKEY records). The default is
162   not to print record comments unless multiline mode is active.
163
164``+[no]short``
165   This option provides [or does not provide] a terse answer. The default is to print the answer in a
166   verbose form.
167
168``+split=W``
169   This option splits long hex- or base64-formatted fields in resource records into
170   chunks of ``W`` characters (where ``W`` is rounded up to the nearest
171   multiple of 4). ``+nosplit`` or ``+split=0`` causes fields not to be
172   split. The default is 56 characters, or 44 characters when
173   multiline mode is active.
174
175``+[no]tcp``
176   This option uses [or does not use] TCP when querying name servers. The default behavior
177   is to use UDP.
178
179``+[no]ttlid``
180   This option displays [or does not display] the TTL when printing the record.
181
182``+[no]ttlunits``
183   This option displays [or does not display] the TTL in friendly human-readable time
184   units of "s", "m", "h", "d", and "w", representing seconds, minutes,
185   hours, days, and weeks. This implies +ttlid.
186
187``+[no]vc``
188   This option uses [or does not use] TCP when querying name servers. This alternate
189   syntax to ``+[no]tcp`` is provided for backwards compatibility. The
190   ``vc`` stands for "virtual circuit".
191
192Local Options
193~~~~~~~~~~~~~
194
195``-c class``
196   This option sets the query class to ``class``. It can be any valid
197   query class which is supported in BIND 9. The default query class is
198   "IN".
199
200``-t type``
201   This option sets the query type to ``type``. It can be any valid
202   query type which is supported in BIND 9. The default query type is "A",
203   unless the ``-x`` option is supplied to indicate a reverse lookup with
204   the "PTR" query type.
205
206``-x addr``
207   Reverse lookups - mapping addresses to names - are simplified by
208   this option. ``addr`` is an IPv4 address in dotted-decimal
209   notation, or a colon-delimited IPv6 address. ``mdig`` automatically
210   performs a lookup for a query name like ``11.12.13.10.in-addr.arpa`` and
211   sets the query type and class to PTR and IN respectively. By default,
212   IPv6 addresses are looked up using nibble format under the IP6.ARPA
213   domain.
214
215The local query options are:
216
217``+[no]aaflag``
218   This is a synonym for ``+[no]aaonly``.
219
220``+[no]aaonly``
221   This sets the ``aa`` flag in the query.
222
223``+[no]adflag``
224   This sets [or does not set] the AD (authentic data) bit in the query. This
225   requests the server to return whether all of the answer and authority
226   sections have all been validated as secure, according to the security
227   policy of the server. AD=1 indicates that all records have been
228   validated as secure and the answer is not from a OPT-OUT range. AD=0
229   indicates that some part of the answer was insecure or not validated.
230   This bit is set by default.
231
232``+bufsize=B``
233   This sets the UDP message buffer size advertised using EDNS0 to ``B``
234   bytes. The maximum and minimum sizes of this buffer are 65535 and 0
235   respectively. Values outside this range are rounded up or down
236   appropriately. Values other than zero cause a EDNS query to be
237   sent.
238
239``+[no]cdflag``
240   This sets [or does not set] the CD (checking disabled) bit in the query. This
241   requests the server to not perform DNSSEC validation of responses.
242
243``+[no]cookie=####``
244   This sends [or does not send] a COOKIE EDNS option, with an optional value. Replaying a COOKIE
245   from a previous response allows the server to identify a previous
246   client. The default is ``+nocookie``.
247
248``+[no]dnssec``
249   This requests that DNSSEC records be sent by setting the DNSSEC OK (DO) bit in
250   the OPT record in the additional section of the query.
251
252``+[no]edns[=#]``
253   This specifies [or does not specify] the EDNS version to query with. Valid values are 0 to 255.
254   Setting the EDNS version causes an EDNS query to be sent.
255   ``+noedns`` clears the remembered EDNS version. EDNS is set to 0 by
256   default.
257
258``+[no]ednsflags[=#]``
259   This sets the must-be-zero EDNS flag bits (Z bits) to the specified value.
260   Decimal, hex, and octal encodings are accepted. Setting a named flag
261   (e.g. DO) is silently ignored. By default, no Z bits are set.
262
263``+[no]ednsopt[=code[:value]]``
264   This specifies [or does not specify] an EDNS option with code point ``code`` and an optional payload
265   of ``value`` as a hexadecimal string. ``+noednsopt`` clears the EDNS
266   options to be sent.
267
268``+[no]expire``
269   This toggles sending of an EDNS Expire option.
270
271``+[no]nsid``
272   This toggles inclusion of an EDNS name server ID request when sending a query.
273
274``+[no]recurse``
275   This toggles the setting of the RD (recursion desired) bit in the query.
276   This bit is set by default, which means ``mdig`` normally sends
277   recursive queries.
278
279``+retry=T``
280   This sets the number of times to retry UDP queries to server to ``T``
281   instead of the default, 2. Unlike ``+tries``, this does not include
282   the initial query.
283
284``+[no]subnet=addr[/prefix-length]``
285   This sends [or does not send] an EDNS Client Subnet option with the specified IP
286   address or network prefix.
287
288``mdig +subnet=0.0.0.0/0``, or simply ``mdig +subnet=0``
289   This sends an EDNS client-subnet option with an empty address and a source
290   prefix-length of zero, which signals a resolver that the client's
291   address information must *not* be used when resolving this query.
292
293``+timeout=T``
294   This sets the timeout for a query to ``T`` seconds. The default timeout is
295   5 seconds for UDP transport and 10 for TCP. An attempt to set ``T``
296   to less than 1 results in a query timeout of 1 second being
297   applied.
298
299``+tries=T``
300   This sets the number of times to try UDP queries to server to ``T``
301   instead of the default, 3. If ``T`` is less than or equal to zero,
302   the number of tries is silently rounded up to 1.
303
304``+udptimeout=T``
305   This sets the timeout between UDP query retries to ``T``.
306
307``+[no]unknownformat``
308   This prints [or does not print] all RDATA in unknown RR-type presentation format (see :rfc:`3597`).
309   The default is to print RDATA for known types in the type's
310   presentation format.
311
312``+[no]yaml``
313   This toggles printing of the responses in a detailed YAML format.
314
315``+[no]zflag``
316   This sets [or does not set] the last unassigned DNS header flag in a DNS query.
317   This flag is off by default.
318
319See Also
320~~~~~~~~
321
322:manpage:`dig(1)`, :rfc:`1035`.
323