| 1 |
.\" Copyright 1997, Martin Schulze <[email protected]> |
| 2 |
.\" Copyright, the authors of the Linux man-pages project |
| 3 |
.\" |
| 4 |
.\" SPDX-License-Identifier: GPL-2.0-or-later |
| 5 |
.\" |
| 6 |
.TH host.conf 5 2026-02-08 "Linux man-pages 6.18" |
| 7 |
.SH NAME |
| 8 |
host.conf \- resolver configuration file |
| 9 |
.SH DESCRIPTION |
| 10 |
The file |
| 11 |
.I /etc/host.conf |
| 12 |
contains configuration information specific to the resolver library. |
| 13 |
It should contain one configuration keyword per line, followed by |
| 14 |
appropriate configuration information. |
| 15 |
The following keywords are recognized: |
| 16 |
.TP |
| 17 |
.I trim |
| 18 |
This keyword may be listed more than once. |
| 19 |
Each time it should be |
| 20 |
followed by a list of domains, separated by colons (\[aq]:\[aq]), semicolons |
| 21 |
(\[aq];\[aq]) or commas (\[aq],\[aq]), with the leading dot. |
| 22 |
When set, the |
| 23 |
resolver library will automatically trim the given domain name from the |
| 24 |
end of any hostname resolved via DNS. |
| 25 |
This is intended for use with |
| 26 |
local hosts and domains. |
| 27 |
(Related note: |
| 28 |
.I trim |
| 29 |
will not affect hostnames gathered via NIS or the |
| 30 |
.BR hosts (5) |
| 31 |
file. |
| 32 |
Care should be taken to |
| 33 |
ensure that the first hostname for each entry in the hosts file is |
| 34 |
fully qualified or unqualified, as appropriate for the local |
| 35 |
installation.) |
| 36 |
.TP |
| 37 |
.I multi |
| 38 |
Valid values are |
| 39 |
.IR on " and " off . |
| 40 |
If set to |
| 41 |
.IR on , |
| 42 |
the resolver library will return all valid addresses for a host that |
| 43 |
appears in the |
| 44 |
.I /etc/hosts |
| 45 |
file, |
| 46 |
instead of only the first. |
| 47 |
This is |
| 48 |
.I off |
| 49 |
by default, as it may cause a substantial performance loss at sites |
| 50 |
with large hosts files. |
| 51 |
.TP |
| 52 |
.I reorder |
| 53 |
Valid values are |
| 54 |
.IR on " and " off . |
| 55 |
If set to |
| 56 |
.IR on , |
| 57 |
the resolver library |
| 58 |
will attempt to reorder host addresses so that local addresses |
| 59 |
(i.e., on the same subnet) are listed first when a |
| 60 |
.BR gethostbyname (3) |
| 61 |
is performed. |
| 62 |
Reordering is done for all lookup methods. |
| 63 |
The default value is |
| 64 |
.IR off . |
| 65 |
.SH ENVIRONMENT |
| 66 |
The following environment variables can be used to allow users to |
| 67 |
override the behavior which is configured in |
| 68 |
.IR /etc/host.conf : |
| 69 |
.TP |
| 70 |
.B RESOLV_HOST_CONF |
| 71 |
If set, this variable points to a file that should be read instead of |
| 72 |
.IR /etc/host.conf . |
| 73 |
.TP |
| 74 |
.B RESOLV_MULTI |
| 75 |
Overrides the |
| 76 |
.I multi |
| 77 |
command. |
| 78 |
.TP |
| 79 |
.B RESOLV_REORDER |
| 80 |
Overrides the |
| 81 |
.I reorder |
| 82 |
command. |
| 83 |
.TP |
| 84 |
.B RESOLV_ADD_TRIM_DOMAINS |
| 85 |
A list of domains, |
| 86 |
separated by |
| 87 |
colons (\[aq]:\[aq]), semicolons (\[aq];\[aq]), or commas (\[aq],\[aq]), |
| 88 |
with the leading dot, |
| 89 |
which will be added to the list of domains that should be trimmed. |
| 90 |
.TP |
| 91 |
.B RESOLV_OVERRIDE_TRIM_DOMAINS |
| 92 |
A list of domains, |
| 93 |
separated by |
| 94 |
colons (\[aq]:\[aq]), semicolons (\[aq];\[aq]), or commas (\[aq],\[aq]), |
| 95 |
with the leading dot, |
| 96 |
which will replace the list of domains that should be trimmed. |
| 97 |
Overrides the |
| 98 |
.I trim |
| 99 |
command. |
| 100 |
.SH FILES |
| 101 |
.TP |
| 102 |
.I /etc/host.conf |
| 103 |
Resolver configuration file |
| 104 |
.TP |
| 105 |
.I /etc/resolv.conf |
| 106 |
Resolver configuration file |
| 107 |
.TP |
| 108 |
.I /etc/hosts |
| 109 |
Local hosts database |
| 110 |
.SH NOTES |
| 111 |
The following differences exist compared to the original implementation. |
| 112 |
A new command |
| 113 |
.I spoof |
| 114 |
and a new environment variable |
| 115 |
.B RESOLV_SPOOF_CHECK |
| 116 |
can take arguments like |
| 117 |
.IR off ", " nowarn ", and " warn . |
| 118 |
Line comments can appear anywhere and not only at the beginning of a line. |
| 119 |
.SS Historical |
| 120 |
The |
| 121 |
.BR nsswitch.conf (5) |
| 122 |
file is the modern way of controlling the order of host lookups. |
| 123 |
.P |
| 124 |
In glibc 2.4 and earlier, the following keyword is recognized: |
| 125 |
.TP |
| 126 |
.I order |
| 127 |
This keyword specifies how host lookups are to be performed. |
| 128 |
It should be followed by one or more lookup methods, separated by commas. |
| 129 |
Valid methods are |
| 130 |
.IR bind ", " hosts ", and " nis . |
| 131 |
.TP |
| 132 |
.B RESOLV_SERV_ORDER |
| 133 |
Overrides the |
| 134 |
.I order |
| 135 |
command. |
| 136 |
.P |
| 137 |
.\" commit 7d68cdaa4f748e87ee921f587ee2d483db624b3d |
| 138 |
Since glibc 2.0.7, and up through glibc 2.24, |
| 139 |
the following keywords and environment variable |
| 140 |
have been recognized but never implemented: |
| 141 |
.TP |
| 142 |
.I nospoof |
| 143 |
Valid values are |
| 144 |
.IR on " and " off . |
| 145 |
If set to |
| 146 |
.IR on , |
| 147 |
the resolver library will attempt to prevent hostname spoofing to |
| 148 |
enhance the security of |
| 149 |
.BR rlogin " and " rsh . |
| 150 |
It works as follows: after performing a host address lookup, |
| 151 |
the resolver library will perform a hostname lookup for that address. |
| 152 |
If the two hostnames |
| 153 |
do not match, the query fails. |
| 154 |
The default value is |
| 155 |
.IR off . |
| 156 |
.TP |
| 157 |
.I spoofalert |
| 158 |
Valid values are |
| 159 |
.IR on " and " off . |
| 160 |
If this option is set to |
| 161 |
.I on |
| 162 |
and the |
| 163 |
.I nospoof |
| 164 |
option is also set, |
| 165 |
the resolver library will log a warning of the error via the |
| 166 |
syslog facility. |
| 167 |
The default value is |
| 168 |
.IR off . |
| 169 |
.TP |
| 170 |
.I spoof |
| 171 |
Valid values are |
| 172 |
.IR off ", " nowarn ", and " warn . |
| 173 |
If this option is set to |
| 174 |
.IR off , |
| 175 |
spoofed addresses are permitted and no warnings will be emitted |
| 176 |
via the syslog facility. |
| 177 |
If this option is set to |
| 178 |
.IR warn , |
| 179 |
the resolver library will attempt to prevent hostname spoofing to |
| 180 |
enhance the security and log a warning of the error via the syslog |
| 181 |
facility. |
| 182 |
If this option is set to |
| 183 |
.IR nowarn , |
| 184 |
the resolver library will attempt to prevent hostname spoofing to |
| 185 |
enhance the security but not emit warnings via the syslog facility. |
| 186 |
Setting this option to anything else is equal to setting it to |
| 187 |
.IR nowarn . |
| 188 |
.TP |
| 189 |
.B RESOLV_SPOOF_CHECK |
| 190 |
Overrides the |
| 191 |
.IR nospoof ", " spoofalert ", and " spoof |
| 192 |
commands in the same way as the |
| 193 |
.I spoof |
| 194 |
command is parsed. |
| 195 |
Valid values are |
| 196 |
.IR off ", " nowarn ", and " warn . |
| 197 |
.SH SEE ALSO |
| 198 |
.BR gethostbyname (3), |
| 199 |
.BR hosts (5), |
| 200 |
.BR nsswitch.conf (5), |
| 201 |
.BR resolv.conf (5), |
| 202 |
.BR hostname (7), |
| 203 |
.BR named (8) |