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