host(1)

NAME
host - query nameserver about hosts and domains

SYNOPSIS
host [-v] [-a] [-t querytype] [options]  name  [server]
host [-v] [-a] [-t querytype] [options]  -l domain  [server]
host [-v] [options]  -H [-D] [-E] [-G] domain
host [-v] [options]  -C domain
host [-v] [options]  -A host

DESCRIPTION
host looks for information about Internet hosts or domains. It gets this information from a set of interconnected servers that are spread across the world. By default, it simply converts between host names and Internet addresses. However, with the -t, -a and -v options, it can be used to find all of the information about hosts or domains that is maintained by the domain nameserver system.

The arguments can be either host names (domain names) or numeric Internet addresses.

A numeric Internet address consists of four decimal numbers separated by dots, e.g. 192.16.199.1
The default action is to look up the associated host name.

A host name or domain name consists of names separated by dots, e.g. nikhefh.nikhef.nl
The default action is to look up all of its Internet addresses.

For single names without a trailing dot, the local domain is automatically tacked on the end. Thus a user in domain "nikhef.nl" can say "host nikhapo", and it will actually look up "nikhapo.nikhef.nl". In all other cases, the name is tried unchanged. Single names with trailing dot are considered top-level domain specifications.

Note that the usual convention for any name that does not end with a trailing dot is to try first with the local domain appended. This convention is not used by this program.

The actual suffix to tack on the end is usually obtained by looking at the results of a "hostname" call, and using everything starting after the first dot, if defined. This can be overridden by specifying the local domain in the file /etc/resolv.conf. (See below for a description of how to customize the host name lookup.)

ARGUMENTS
The first argument is normally the host name (domain name) for which you want to look up the requested information. If the first argument is an Internet address, an "inverse query" is done to look up its associated host name.

If the -l option is given, the first argument is a domain (zone) name for which a complete listing is given. The program enters a special domain listing mode which has several variants (see below).

The second argument is optional. It allows you to specify a particular server to query. If you don't specify this argument, default servers are used, as defined by /etc/resolv.conf.

OPTIONS
There are a number of options that can be used before the specified argument. Some of these options are meaningful only to the people who have to maintain the domain database. The first options are the regularly used ones.

-v  causes printout to be in a "verbose" format. This is the official domain master file format, which is documented in the man page for named. Without this option, output still follows this format in general terms, but TTL and class fields are not shown. In addition, the verbose option prints extra information about the various actions that are taken. Note that -vv is "very verbose".

-t querytype
    allows you to specify a particular type of information to be looked up. Supported types are listed below. The wildcard may be written as either any or *. Types may be given in upper or lower case. The default is type A in host lookups, and A, NS, and PTR in domain listings.

-a  is equivalent to -t any. Note that this gives you "anything available" and not "all defined data" if a non-authoritative server is queried.

SPECIAL MODES
The following options put the program in a special mode.

-l domain
    causes a listing of a complete domain.

    E.g. the command
        host -l nikhef.nl
    will give a listing of all hosts in the "nikhef.nl" domain. The -t option is used to filter what information is presented, as you would expect. The default is address information from A records, supplemented with data from PTR and NS records.

    The command
        host -v -a -l nikhef.nl
    will give a complete download of the zone data for "nikhef.nl", in the official master file format.

-H  can be specified instead of the -l option. It will print the count of the unique hostnames encountered within the domain. It will not count pseudo names like "localhost", nor addresses associated with domain names itself. Also not counted are the so called "glue records" that are necessary to define nameservers for the domain and its subdomains.

    By default, this option will not print any resource records.

    Combined with the -S option, it will give a complete statistics survey of the domain.

    The host count may be affected by duplicate hosts (see below). To compute the most realistic value, subtract the duplicate host count from the host count.

-G  implies -H, but lists the names of gateway hosts. These are the hosts that have more than one address. Gateway hosts are not checked for duplicate addresses.

-E  implies -H, but lists the names of extrazone hosts. An extrazone host in domain "foo.bar" is of the form "host.xxx.foo.bar" where "xxx.foo.bar" is not defined as a separate subdomain with an NS record. This may be intentional, but also may be an error.

-D  implies -H, but lists the names of duplicate hosts. These are hosts with only one address, which is known to have been defined also for another host with a different name, possibly even in a different domain. This may be intentional, but also may be an error.

-C  can be specified instead of the -l option. It causes the SOA records for the specified domain to be compared as found at each of the authoritative nameservers for the domain. Discrepancies, such as different serial numbers, are reported. Nameserver recursion is turned off, and it will be checked whether the answers are really authoritative.

-A  enters a special address check mode.

    If the first argument is a host name, its addresses will be retrieved, and for each of the addresses it will be checked whether they map back to the given host.

    If the first argument is a dotted quad Internet address, its name will be retrieved, and it will be checked whether the given address is listed among the known addresses belonging to that host.

SPECIAL OPTIONS
The following options apply only to the special domain listing modes.

-L level
    Recursively generate domain listings up to this level deep.

-S  prints statistics about resource records found during zone listings of domains.

-p  causes the primary nameserver of a domain to be contacted for zone transfers during domain listings. Normally, zone transfers are obtained from any one of the authoritative servers that responds. Note that a specific server given on the command line overrules this option.

COMMON OPTIONS
The following options can be used in both normal mode and domain listing mode.

-T  prints the time-to-live values during non-verbose output. By default the TTL is shown only in verbose mode. It also prints the preference value for MX records.

-d  turns on debugging. Network transactions are shown in detail. Note that -dd prints even more debugging output.

-e  excludes information about hosts that are not residing within in the given domain during zone listings, such as some glue records. For normal queries, it suppresses the printing of additional information and nameserver records.

-f filename
    writes resource record output to given file as well as to standard output.

-i  generates an inverse query for the in-addr.arpa domain in case a numeric address was specified for the host or domain. Useful primarily for domain listing mode, since for numeric host lookups such inverse query is done anyway.

-q  be quiet and suppress various warning messages. Serious error messages are not suppressed.

OTHER OPTIONS
The following options are used only in special circumstances.

-c class
    allows you to specify a particular class. Supported are IN, CHAOS, HS, and the wildcard any or *. The default class is IN.

-m  is equivalent to -t mailb. In addition, MR and MG records will be recursively expanded into MB records.

-r  causes nameserver recursion to be turned off in the request. This means that the nameserver will return only data it has currently cached in its own database. It will not ask other servers for more information. Note that nameserver recursion is always turned off when checking SOA records using the -C option.

-u  forces the use of virtual circuits instead of datagrams when issuing nameserver queries. This is slower, but potentially more reliable. Note that a virtual circuit is automatically chosen in case a query exceeds the maximum datagram packet size. A zone transfer is always done via a virtual circuit.

-w  causes the program to wait forever for a response. Normally it will time out after some 10 seconds per nameserver address tried.

-s seconds
    specifies a new nameserver timeout value. The program will wait for a nameserver reply in two attempts of this number of seconds. Normally it does 2 attempts of 5 seconds per nameserver address tried. The actual timeout algorithm is slightly more complicated, extending the timeout value dynamically depending on the number of tries and the number of nameserver addresses.

QUERYTYPES
The following querytypes are supported.

A   Host address (dotted quad)

NS  Authoritative nameserver (domain)

MD  Mail destination (domain)

MF  Mail forwarder (domain)

CNAME
    Canonical name for an alias (domain)

SOA Marks the start of a zone of authority (nameserver, mailbox, serial, refresh, retry, expiration, default)

MB  Mailbox domain name (domain)

MG  Mail group member (domain)

MR  Mail rename domain name (domain)

NULL
    Null resource record (no format or data)

WKS Well-known service description (address, protocol, list of services)

PTR Domain name pointer (domain)

HINFO
    Host information (CPU type, OS type)

MINFO
    Mailbox or mail list information (request domain, error domain)

MX  Mail exchanger (preference, domain)

TXT Descriptive text (string)

UINFO
    User information (string)

UID User identification (number)

GID Group identification (number)

UNSPEC
    Unspecified binary data (data)

ANY Matches any of the above information.

MAILB
    Matches any of types MB, MR, MG, or MINFO.

MAILA
    Matches any of types MD, or MF.

The following types have been defined recently in RFC1183, but are not yet in general use. They are recognized by this program.

RP  Responsible person (mb domain, txt domain)

AFSDB
    AFS database location (type, domain)

X25 X25 address (address string)

ISDN
    ISDN address (address string, optional subaddress string)

RT  Route through host (preference, domain)

CUSTOMIZING HOST NAME LOOKUP
In general, if the name supplied by the user does not have any dots in it, a default domain is appended to the end. This domain can be defined in /etc/resolv.conf, but is normally derived by taking the local hostname after its first dot.

The user can override this, and specify a different default domain, using the environment variable LOCALDOMAIN.

In addition, the user can supply his own single-word abbreviations for host names. They should be in a file consisting of one line per abbreviation. Each line contains an abbreviation, white space, and then the full host name. The name of this file must be specified by the environment variable HOSTALIASES.

SPECIAL CONSIDERATIONS
The complete set of resource information about a requested host is available from an authoritative nameserver only. Therefore, if you query another server with the "-a" option, only a subset of the data may be presented, since this option asks for any data that the latter server currently knows about, not all data that may possibly exist. Note that the "-v" option shows whether an answer is authoritative or not.

When listing a domain with the "-l" option, information will be fetched from authoritative nameservers for that domain. This is implemented by doing a complete zone transfer and then filtering out the information the you have asked for. Note that direct contact with such nameservers must be possible for this option to work. This option should be used only if it is absolutely necessary.

AUTHOR
This program is originally from Rutgers University.
Extensively rewritten by Eric Wassenaar, Nikhef-H, <e07@nikhef.nl>

SEE ALSO
named(8), resolver(4), resolver(3)