1HOSTNAME(7)        FreeBSD Miscellaneous Information Manual        HOSTNAME(7)
2
3NNAAMMEE
4     hhoossttnnaammee -- host name resolution description
5
6DDEESSCCRRIIPPTTIIOONN
7     Hostnames are domains.  A domain is a hierarchical, dot-separated list of
8     subdomains.  For example, the machine ``monet'', in the ``Berkeley'' sub-
9     domain of the ``EDU'' subdomain of the Internet Domain Name System would
10     be represented as
11
12           monet.Berkeley.EDU
13
14     (with no trailing dot).
15
16     Hostnames are often used with network client and server programs, which
17     must generally translate the name to an address for use.  (This task is
18     usually performed by the library routine gethostbyname(3).)  The default
19     method for resolving hostnames by the Internet name resolver is to follow
20     RFC 1535's security recommendations.  Actions can be taken by the admin-
21     istrator to override these recommendations and to have the resolver
22     behave the same as earlier, non-RFC 1535 resolvers.
23
24     The default method (using RFC 1535 guidelines) follows:
25
26     If the name consists of a single component, i.e. contains no dot, and if
27     the environment variable ``HOSTALIASES'' is set to the name of a file,
28     that file is searched for a string matching the input hostname.  The file
29     should consist of lines made up of two strings separated by white-space,
30     the first of which is the hostname alias, and the second of which is the
31     complete hostname to be substituted for that alias.  If a case-insensi-
32     tive match is found between the hostname to be resolved and the first
33     field of a line in the file, the substituted name is looked up with no
34     further processing.
35
36     If there is at least one dot in the name, then the name is first tried
37     ``as-is''.  The number of dots to cause this action is configurable by
38     setting the threshold using the ``ndots'' option in _/_e_t_c_/_r_e_s_o_l_v_._c_o_n_f
39     (default:  1).  If the name ends with a dot, the trailing dot is removed,
40     and the remaining name is looked up (regardless of the setting of the
41     ndots option), without further processing.
42
43     If the input name does not end with a trailing dot, it is looked up by
44     searching through a list of domains until a match is found.  If neither
45     the search option in the _/_e_t_c_/_r_e_s_o_l_v_._c_o_n_f file or the ``LOCALDOMAIN''
46     environment variable is used, then the search list of domains contains
47     only the full domain specified by the domain option (in _/_e_t_c_/_r_e_s_o_l_v_._c_o_n_f)
48     or the domain used in the local hostname.  For example, if the ``domain''
49     option is set to CS.Berkeley.EDU, then only CS.Berkeley.EDU will be in
50     the search list, and this will be the only domain appended to the partial
51     hostname.  For example, if ``lithium'' is the name to be resolved, this
52     would make lithium.CS.Berkeley.EDU the only name to be tried using the
53     search list.
54
55     If the search option is used in _/_e_t_c_/_r_e_s_o_l_v_._c_o_n_f or the environment vari-
56     able ``LOCALDOMAIN'' is set by the user, then the search list will
57     include what is set by these methods.  For example, if the ``search''
58     option contained
59
60           CS.Berkeley.EDU CChem.Berkeley.EDU Berkeley.EDU
61
62     then the partial hostname (e.g., ``lithium'') will be tried with _e_a_c_h
63     domain name appended (in the same order specified); the resulting host-
64     names that would be tried are:
65
66           lithium.CS.Berkeley.EDU
67           lithium.CChem.Berkeley.EDU
68           lithium.Berkeley.EDU
69
70     The environment variable ``LOCALDOMAIN'' overrides the ``search'' and
71     ``domain'' options, and if both search and domain options are present in
72     the resolver configuration file, then only the _l_a_s_t one listed is used
73     (see resolver(5)).
74
75     If the name was not previously tried ``as-is'' (i.e., it fell below the
76     ``ndots'' threshold or did not contain a dot), then the name as origi-
77     nally provided is attempted.
78
79EENNVVIIRROONNMMEENNTT
80     LOCALDOMAIN         Affects domains appended to partial hostnames.
81
82     HOSTALIASES         Name of file containing (_h_o_s_t _a_l_i_a_s, _f_u_l_l _h_o_s_t_n_a_m_e)
83                         pairs.
84
85FFIILLEESS
86     /etc/resolv.conf    See resolve(5).
87
88SSEEEE AALLSSOO
89     gethostbyname(3), resolver(5), mailaddr(7),
90
914th Berkeley Distribution      February 16, 1994     4th Berkeley Distribution
92