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