host - look up host names using domain server
host [-adlrvw] [-c class] [-t querytype] host [server]
The host(1) utility looks for information about Internet hosts. It gets this information from a set of widely distributed, interconnected servers. By default, it simply converts between host names and Internet addresses. With the -t or -a options, however, it can be used to find all of the information about this host that is maintained by the domain server.
The arguments can be either host names or host numbers. The program first attempts to interpret them as host numbers. If this fails, it will treat them as host names. A host number consists of first decimal numbers separated by dots, such as 172.31.255.253. A host name consists of names separated by dots, for example, topaz.anycollege.edu. Unless the name ends in a dot, the local domain is automatically added onto the end. Thus, an "Anycollege" user can say:"
host topaz
and it will actually look up "topaz.anycollege.edu". If this fails, the name is tried unchanged (in this case, "topaz"). This same convention is used for mail and other network utilities. The actual suffix to add onto the end is obtained by looking at the results of a hostname(1) call, and using everything starting at the first dot.
The first argument is the host name you want to look up. If this is a number, an inverse query is performed; the domain system looks in a separate set of databases used to convert numbers to names.
The second argument is optional. It allows you to specify a particular server to query. If you do not specify this argument, the default server (normally the local computer) is used.
If a name is specified, you might see output of three different kinds. Here is an example that shows all of them:
% host helios
helios.anycollege.edu is a nickname for ATHOS.ANYCOLLEGE.EDU
ATHOS.ANYCOLLEGE.EDU has address 172.16.5.46
ATHOS.ANYCOLLEGE.EDU has address 172.16.4.4
ATHOS.ANYCOLLEGE.EDU mail is handled by ARAMIS.ANYCOLLEGE.EDU
The user has typed the command host helios. The first line indicates that the name helios.anycollege.edu is actually a nickname. The official host name is ATHOS.ANYCOLLEGE.EDU. The next two lines show the address. If a system has more than one network interface, there will be a separate address for each. The last line indicates that ATHOS.ANYCOLLEGE.EDU does not receive its own mail. Mail for it is taken by ARAMIS.ANYCOLLEGE.EDU. There might be more than one such line because some systems have more than one other system that will handle mail for them. Technically, every system that can receive mail is supposed to have an entry of this kind. If the system receives its own mail, there should be an entry that mentions the system itself; for example:
ARAMIS.ANYCOLLEGE.EDU mail is handled by ARAMIS.ANYCOLLEGE.EDU
Many systems that receive their own mail do not bother to mention that fact, however. If a system has "a mail is handled by" entry, but no address, this indicates that it is not really part of the Internet, but a system that is on the network will forward mail to it. Systems on Usenet, Bitnet, and several of other networks have entries of this kind.
There are a number of options that can be used before the host name. Most of these options are meaningful only to those who must maintain the domain database.
host -l anycollege.edu
will give a listing of all hosts in the anycollege.edu domain. The -t option is used to filter what information is presented. The default is address information, which also include PTR and NS records. The command
host -l -v -t any anycollege.edu
will give a complete download of the zone data for anycollege.edu, in the official master file format. (However, the start of authority (SOA) record is listed twice, for arcane reasons.)
-l is implemented by doing a complete zone transfer and then filtering out the information the you have requested. This command should be used only if absolutely necessary.
Unexpected effects can result if you type a name that is not part of the local domain. It is important to remember that the local domain name is added onto the end of every name, unless it ends in a dot. Only if this fails is the name used unchanged.
The -l option tries only the first name server listed for the domain that you have requested. If this server is unavailable, you might need to specify a server manually. For example, to get a listing of anycollege.edu, you could try:
host -t ns anycollege.edu
to get a list of all the name servers for anycollege.edu, and then
try:
host -l anycollege.edu xxx
for all xxx on the list of name servers, until you find one
that works.
resolver(5)