xref: /netbsd-src/external/mpl/bind/dist/bin/dig/host.rst (revision aef5eb5f59cdfe8314f1b5f78ac04eb144e44010)
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_host:
15
16host - DNS lookup utility
17-------------------------
18
19Synopsis
20~~~~~~~~
21
22:program:`host` [**-aACdlnrsTUwv**] [**-c** class] [**-N** ndots] [**-p** port] [**-R** number] [**-t** type] [**-W** wait] [**-m** flag] [ [**-4**] | [**-6**] ] [**-v**] [**-V**] {name} [server]
23
24Description
25~~~~~~~~~~~
26
27``host`` is a simple utility for performing DNS lookups. It is normally
28used to convert names to IP addresses and vice versa. When no arguments
29or options are given, ``host`` prints a short summary of its
30command-line arguments and options.
31
32``name`` is the domain name that is to be looked up. It can also be a
33dotted-decimal IPv4 address or a colon-delimited IPv6 address, in which
34case ``host`` by default performs a reverse lookup for that address.
35``server`` is an optional argument which is either the name or IP
36address of the name server that ``host`` should query instead of the
37server or servers listed in ``/etc/resolv.conf``.
38
39Options
40~~~~~~~
41
42``-4``
43   This option specifies that only IPv4 should be used for query transport. See also the ``-6`` option.
44
45``-6``
46   This option specifies that only IPv6 should be used for query transport. See also the ``-4`` option.
47
48``-a``
49   The ``-a`` ("all") option is normally equivalent to ``-v -t ANY``. It
50   also affects the behavior of the ``-l`` list zone option.
51
52``-A``
53   The ``-A`` ("almost all") option is equivalent to ``-a``, except that RRSIG,
54   NSEC, and NSEC3 records are omitted from the output.
55
56``-c class``
57   This option specifies the query class, which can be used to lookup HS (Hesiod) or CH (Chaosnet)
58   class resource records. The default class is IN (Internet).
59
60``-C``
61   This option indicates that ``named`` should check consistency, meaning that ``host`` queries the SOA records for zone
62   ``name`` from all the listed authoritative name servers for that
63   zone. The list of name servers is defined by the NS records that are
64   found for the zone.
65
66``-d``
67   This option prints debugging traces, and is equivalent to the ``-v`` verbose option.
68
69``-l``
70   This option tells ``named`` to list the zone, meaning the ``host`` command performs a zone transfer of zone
71   ``name`` and prints out the NS, PTR, and address records (A/AAAA).
72
73   Together, the ``-l -a`` options print all records in the zone.
74
75``-N ndots``
76   This option specifies the number of dots (``ndots``) that have to be in ``name`` for it to be
77   considered absolute. The default value is that defined using the
78   ``ndots`` statement in ``/etc/resolv.conf``, or 1 if no ``ndots`` statement
79   is present. Names with fewer dots are interpreted as relative names,
80   and are searched for in the domains listed in the ``search`` or
81   ``domain`` directive in ``/etc/resolv.conf``.
82
83``-p port``
84   This option specifies the port to query on the server. The default is 53.
85
86``-r``
87   This option specifies a non-recursive query; setting this option clears the RD (recursion
88   desired) bit in the query. This means that the name server
89   receiving the query does not attempt to resolve ``name``. The ``-r``
90   option enables ``host`` to mimic the behavior of a name server by
91   making non-recursive queries, and expecting to receive answers to
92   those queries that can be referrals to other name servers.
93
94``-R number``
95   This option specifies the number of retries for UDP queries. If ``number`` is negative or zero,
96   the number of retries is silently set to 1. The default value is 1, or
97   the value of the ``attempts`` option in ``/etc/resolv.conf``, if set.
98
99``-s``
100   This option tells ``named`` *not* to send the query to the next nameserver if any server responds
101   with a SERVFAIL response, which is the reverse of normal stub
102   resolver behavior.
103
104``-t type``
105   This option specifies the query type. The ``type`` argument can be any recognized query type:
106   CNAME, NS, SOA, TXT, DNSKEY, AXFR, etc.
107
108   When no query type is specified, ``host`` automatically selects an
109   appropriate query type. By default, it looks for A, AAAA, and MX
110   records. If the ``-C`` option is given, queries are made for SOA
111   records. If ``name`` is a dotted-decimal IPv4 address or
112   colon-delimited IPv6 address, ``host`` queries for PTR records.
113
114   If a query type of IXFR is chosen, the starting serial number can be
115   specified by appending an equals sign (=), followed by the starting serial
116   number, e.g., ``-t IXFR=12345678``.
117
118``-T``; ``-U``
119   This option specifies TCP or UDP. By default, ``host`` uses UDP when making queries; the
120   ``-T`` option makes it use a TCP connection when querying the name
121   server. TCP is automatically selected for queries that require
122   it, such as zone transfer (AXFR) requests. Type ``ANY`` queries default
123   to TCP, but can be forced to use UDP initially via ``-U``.
124
125``-m flag``
126   This option sets memory usage debugging: the flag can be ``record``, ``usage``, or
127   ``trace``. The ``-m`` option can be specified more than once to set
128   multiple flags.
129
130``-v``
131   This option sets verbose output, and is equivalent to the ``-d`` debug option. Verbose output
132   can also be enabled by setting the ``debug`` option in
133   ``/etc/resolv.conf``.
134
135``-V``
136   This option prints the version number and exits.
137
138``-w``
139   This option sets "wait forever": the query timeout is set to the maximum possible. See
140   also the ``-W`` option.
141
142``-W wait``
143   This options sets the length of the wait timeout, indicating that ``named`` should wait for up to ``wait`` seconds for a reply. If ``wait`` is
144   less than 1, the wait interval is set to 1 second.
145
146   By default, ``host`` waits for 5 seconds for UDP responses and 10
147   seconds for TCP connections. These defaults can be overridden by the
148   ``timeout`` option in ``/etc/resolv.conf``.
149
150   See also the ``-w`` option.
151
152IDN Support
153~~~~~~~~~~~
154
155If ``host`` has been built with IDN (internationalized domain name)
156support, it can accept and display non-ASCII domain names. ``host``
157appropriately converts character encoding of a domain name before sending
158a request to a DNS server or displaying a reply from the server.
159To turn off IDN support, define the ``IDN_DISABLE``
160environment variable. IDN support is disabled if the variable is set
161when ``host`` runs.
162
163Files
164~~~~~
165
166``/etc/resolv.conf``
167
168See Also
169~~~~~~~~
170
171:manpage:`dig(1)`, :manpage:`named(8)`.
172