1HOSTNAME(7) BSD Miscellaneous Information Manual HOSTNAME(7)
2
4 hostname — host name resolution description
5
7 Hostnames are domains. A domain is a hierarchical, dot-separated list of
8 subdomains. For example, the machine “monet”, in the “Berkeley” subdo‐
9 main of the “EDU” subdomain of the Internet Domain Name System would be
10 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, that
28 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 set‐
38 ting the threshold using the “ndots” option in /etc/resolv.conf (default:
39 1). If the name ends with a dot, the trailing dot is removed, and the
40 remaining name is looked up (regardless of the setting of the ndots
41 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 /etc/resolv.conf file or the “LOCALDOMAIN” envi‐
46 ronment variable is used, then the search list of domains contains only
47 the full domain specified by the domain option (in /etc/resolv.conf) or
48 the domain used in the local hostname (see hostname(1) and resolver(5)).
49 For example, if the “domain” option is set to CS.Berkeley.EDU, then only
50 CS.Berkeley.EDU will be in the search list, and this will be the only
51 domain appended to the partial hostname. For example, if “lithium” is
52 the name to be resolved, this would make lithium.CS.Berkeley.EDU the only
53 name to be tried using the search list.
54
55 If the search option is used in /etc/resolv.conf or the environment vari‐
56 able “LOCALDOMAIN” is set by the user, then the search list will include
57 what is set by these methods. For example, if the “search” option con‐
58 tained
59
60 CS.Berkeley.EDU CChem.Berkeley.EDU Berkeley.EDU
61
62 then the partial hostname (e.g., “lithium”) will be tried with each
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 last 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 originally
77 provided is attempted.
78
80 LOCALDOMAIN Affects domains appended to partial hostnames.
81
82 HOSTALIASES Name of file containing (host alias, full hostname)
83 pairs.
84
86 /etc/resolv.conf See resolve(5).
87
89 gethostbyname(3), resolver(5), mailaddr(7), named(8).
90
914th Berkeley Distribution February 16, 1994 4th Berkeley Distribution