Changes: Ready for 5.13
[man-pages.git] / man5 / resolv.conf.5
blobec5eb4f2208683318951a9b7380d26c372eb8f0f
1 .\" Copyright (c) 1986 The Regents of the University of California.
2 .\" All rights reserved.
3 .\"
4 .\" %%%LICENSE_START(PERMISSIVE_MISC)
5 .\" Redistribution and use in source and binary forms are permitted
6 .\" provided that the above copyright notice and this paragraph are
7 .\" duplicated in all such forms and that any documentation,
8 .\" advertising materials, and other materials related to such
9 .\" distribution and use acknowledge that the software was developed
10 .\" by the University of California, Berkeley.  The name of the
11 .\" University may not be used to endorse or promote products derived
12 .\" from this software without specific prior written permission.
13 .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14 .\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15 .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16 .\" %%%LICENSE_END
17 .\"
18 .\"     @(#)resolver.5  5.9 (Berkeley) 12/14/89
19 .\"     $Id: resolver.5,v 8.6 1999/05/21 00:01:02 vixie Exp $
20 .\"
21 .\" Added ndots remark by Bernhard R. Link - debian bug #182886
22 .\"
23 .TH RESOLV.CONF 5 2021-03-22 "" "Linux Programmer's Manual"
24 .UC 4
25 .SH NAME
26 resolv.conf \- resolver configuration file
27 .SH SYNOPSIS
28 .nf
29 .B /etc/resolv.conf
30 .fi
31 .SH DESCRIPTION
32 The
33 .I resolver
34 is a set of routines in the C library
35 that provide access to the Internet Domain Name System (DNS).
36 The resolver configuration file contains information that is read
37 by the resolver routines the first time they are invoked by a process.
38 The file is designed to be human readable and contains a list of
39 keywords with values that provide various types of resolver information.
40 The configuration file is considered a trusted source of DNS information;
41 see the
42 .B trust-ad
43 option below for details.
44 .PP
45 If this file does not exist, only the name server on the local machine
46 will be queried, and the search list contains the local domain name
47 determined from the hostname.
48 .PP
49 The different configuration options are:
50 .TP
51 \fBnameserver\fP Name server IP address
52 Internet address of a name server that the resolver should query,
53 either an IPv4 address (in dot notation),
54 or an IPv6 address in colon (and possibly dot) notation as per RFC 2373.
55 Up to
56 .B MAXNS
57 (currently 3, see \fI<resolv.h>\fP) name servers may be listed,
58 one per keyword.
59 If there are multiple servers,
60 the resolver library queries them in the order listed.
61 If no \fBnameserver\fP entries are present,
62 the default is to use the name server on the local machine.
63 (The algorithm used is to try a name server, and if the query times out,
64 try the next, until out of name servers,
65 then repeat trying all the name servers
66 until a maximum number of retries are made.)
67 .TP
68 \fBsearch\fP Search list for host-name lookup.
69 By default, the search list contains one entry, the local domain name.
70 It is determined from the local hostname returned by
71 .BR gethostname (2);
72 the local domain name is taken to be everything after the first
73 \(aq.\(aq.
74 Finally, if the hostname does not contain a \(aq.\(aq, the
75 root domain is assumed as the local domain name.
76 .IP
77 This may be changed by listing the desired domain search path
78 following the \fIsearch\fP keyword with spaces or tabs separating
79 the names.
80 Resolver queries having fewer than
81 .I ndots
82 dots (default is 1) in them will be attempted using each component
83 of the search path in turn until a match is found.
84 For environments with multiple subdomains please read
85 .BI "options ndots:" n
86 below to avoid man-in-the-middle attacks and unnecessary
87 traffic for the root-dns-servers.
88 .\" When having a resolv.conv with a line
89 .\"  search subdomain.domain.tld domain.tld
90 .\" and doing a hostlookup, for example by
91 .\"  ping host.anothersubdomain
92 .\" it sends dns-requests for
93 .\"  host.anothersubdomain.
94 .\"  host.anothersubdomain.subdomain.domain.tld.
95 .\"  host.anothersubdomain.domain.tld.
96 .\" thus not only causing unnecessary traffic for the root-dns-servers
97 .\" but broadcasting information to the outside and making man-in-the-middle
98 .\" attacks possible.
99 Note that this process may be slow and will generate a lot of network
100 traffic if the servers for the listed domains are not local,
101 and that queries will time out if no server is available
102 for one of the domains.
104 If there are multiple
105 .B search
106 directives, only the search list from the last instance is used.
108 In glibc 2.25 and earlier, the search list is limited to six domains
109 with a total of 256 characters.
110 Since glibc 2.26,
111 .\" glibc commit 3f853f22c87f0b671c0366eb290919719fa56c0e
112 the search list is unlimited.
115 .B domain
116 directive is an obsolete name for the
117 .B search
118 directive that handles one search list entry only.
120 \fBsortlist\fP
121 This option allows addresses returned by
122 .BR gethostbyname (3)
123 to be sorted.
124 A sortlist is specified by IP-address-netmask pairs.
125 The netmask is
126 optional and defaults to the natural netmask of the net.
127 The IP address
128 and optional network pairs are separated by slashes.
129 Up to 10 pairs may
130 be specified.
131 Here is an example:
133 .in +4n
134 sortlist 130.155.160.0/255.255.240.0 130.155.0.0
137 \fBoptions\fP
138 Options allows certain internal resolver variables to be modified.
139 The syntax is
142 \fBoptions\fP \fIoption\fP \fI...\fP
144 where \fIoption\fP is one of the following:
146 \fBdebug\fP
147 .\" Since glibc 2.2?
148 Sets
149 .BR RES_DEBUG
151 .IR _res.options
152 (effective only if glibc was built with debug support; see
153 .BR resolver (3)).
155 .BI ndots: n
156 .\" Since glibc 2.2
157 Sets a threshold for the number of dots which
158 must appear in a name given to
159 .BR res_query (3)
160 (see
161 .BR resolver (3))
162 before an \fIinitial absolute query\fP will be made.
163 The default for
164 \fIn\fP is 1, meaning that if there are any dots in a name, the name
165 will be tried first as an absolute name before any \fIsearch list\fP
166 elements are appended to it.
167 The value for this option is silently capped to 15.
169 .BI timeout: n
170 .\" Since glibc 2.2
171 Sets the amount of time the resolver will wait for a
172 response from a remote name server before retrying the
173 query via a different name server.
174 This may
175 .BR not
176 be the total time taken by any resolver API call and there is no
177 guarantee that a single resolver API call maps to a single timeout.
178 Measured in seconds,
179 the default is
180 .BR RES_TIMEOUT
181 (currently 5, see \fI<resolv.h>\fP).
182 The value for this option is silently capped to 30.
184 .BI attempts: n
185 Sets the number of times the resolver will send a
186 query to its name servers before giving up and returning
187 an error to the calling application.
188 The default is
189 .BR RES_DFLRETRY
190 (currently 2, see \fI<resolv.h>\fP).
191 The value for this option is silently capped to 5.
193 .B rotate
194 .\" Since glibc 2.2
195 Sets
196 .BR RES_ROTATE
198 .IR _res.options ,
199 which causes round-robin selection of name servers from among those listed.
200 This has the effect of spreading the query load among all listed servers,
201 rather than having all clients try the first listed server first every time.
203 .B no\-check\-names
204 .\" since glibc 2.2
205 Sets
206 .BR RES_NOCHECKNAME
208 .IR _res.options ,
209 which disables the modern BIND checking of incoming hostnames and
210 mail names for invalid characters such as underscore (_), non-ASCII,
211 or control characters.
213 .B inet6
214 .\" Since glibc 2.2
215 Sets
216 .BR RES_USE_INET6
218 .IR _res.options .
219 This has the effect of trying an AAAA query before an A query inside the
220 .BR gethostbyname (3)
221 function, and of mapping IPv4 responses in IPv6 "tunneled form"
222 if no AAAA records are found but an A record set exists.
223 Since glibc 2.25,
224 .\" b76e065991ec01299225d9da90a627ebe6c1ac97
225 this option is deprecated; applications should use
226 .BR getaddrinfo (3),
227 rather than
228 .BR gethostbyname (3).
230 .BR ip6\-bytestring " (since glibc 2.3.4 to 2.24)"
231 Sets
232 .BR RES_USEBSTRING
234 .IR _res.options .
235 This causes reverse IPv6 lookups to be made using the bit-label format
236 described in RFC\ 2673;
237 if this option is not set (which is the default), then nibble format is used.
238 This option was removed in glibc 2.25,
239 since it relied on a backward-incompatible
240 DNS extension that was never deployed on the Internet.
242 .BR ip6\-dotint / no\-ip6\-dotint " (glibc 2.3.4 to 2.24)"
243 Clear/set
244 .BR RES_NOIP6DOTINT
246 .IR _res.options .
247 When this option is clear
248 .RB ( ip6\-dotint ),
249 reverse IPv6 lookups are made in the (deprecated)
250 .I ip6.int
251 zone;
252 when this option is set
253 .RB ( no\-ip6\-dotint ),
254 reverse IPv6 lookups are made in the
255 .I ip6.arpa
256 zone by default.
257 These options are available in glibc versions up to 2.24, where
258 .BR no\-ip6\-dotint
259 is the default.
260 Since
261 .BR ip6\-dotint
262 support long ago ceased to be available on the Internet,
263 these options were removed in glibc 2.25.
265 .BR edns0 " (since glibc 2.6)"
266 Sets
267 .BR RES_USE_EDNS0
269 .IR _res.options .
270 This enables support for the DNS extensions described in RFC\ 2671.
272 .BR single\-request " (since glibc 2.10)"
273 Sets
274 .BR RES_SNGLKUP
276 .IR _res.options .
277 By default, glibc performs IPv4 and IPv6 lookups in parallel since
278 version 2.9.
279 Some appliance DNS servers
280 cannot handle these queries properly and make the requests time out.
281 This option disables the behavior and makes glibc perform the IPv6
282 and IPv4 requests sequentially (at the cost of some slowdown of the
283 resolving process).
285 .BR single\-request\-reopen " (since glibc 2.9)"
286 Sets
287 .BR RES_SNGLKUPREOP
289 .IR _res.options .
290 The resolver uses the same socket for the A and AAAA requests.
291 Some hardware mistakenly sends back only one reply.
292 When that happens the client system will sit and wait for the second reply.
293 Turning this option on changes this behavior
294 so that if two requests from the same port are not handled correctly it will
295 close the socket and open a new one before sending the second request.
297 .BR no\-tld\-query " (since glibc 2.14)"
298 Sets
299 .BR RES_NOTLDQUERY
301 .IR _res.options .
302 This option causes
303 .BR res_nsearch ()
304 to not attempt to resolve an unqualified name
305 as if it were a top level domain (TLD).
306 This option can cause problems if the site has ``localhost'' as a TLD
307 rather than having localhost on one or more elements of the search list.
308 This option has no effect if neither RES_DEFNAMES or RES_DNSRCH is set.
310 .BR use\-vc " (since glibc 2.14)"
311 Sets
312 .BR RES_USEVC
314 .IR _res.options .
315 This option forces the use of TCP for DNS resolutions.
316 .\" aef16cc8a4c670036d45590877d411a97f01e0cd
318 .BR no\-reload " (since glibc 2.26)"
319 Sets
320 .BR RES_NORELOAD
322 .IR _res.options .
323 This option disables automatic reloading of a changed configuration file.
325 .BR trust\-ad " (since glibc 2.31)"
326 .\" 446997ff1433d33452b81dfa9e626b8dccf101a4
327 Sets
328 .BR RES_TRUSTAD
330 .IR _res.options .
331 This option controls the AD bit behavior of the stub resolver.
332 If a validating resolver sets the AD bit in a response,
333 it indicates that the data in the response was verified according
334 to the DNSSEC protocol.
335 In order to rely on the AD bit, the local system has to
336 trust both the DNSSEC-validating resolver and the network path to it,
337 which is why an explicit opt-in is required.
338 If the
339 .B trust\-ad
340 option is active, the stub resolver sets the AD bit in outgoing DNS
341 queries (to enable AD bit support), and preserves the AD bit in responses.
342 Without this option, the AD bit is not set in queries,
343 and it is always removed from responses before they are returned to the
344 application.
345 This means that applications can trust the AD bit in responses if the
346 .B trust\-ad
347 option has been set correctly.
349 In glibc version 2.30 and earlier,
350 the AD is not set automatically in queries,
351 and is passed through unchanged to applications in responses.
354 The \fIsearch\fP keyword of a system's \fIresolv.conf\fP file can be
355 overridden on a per-process basis by setting the environment variable
356 .B LOCALDOMAIN
357 to a space-separated list of search domains.
359 The \fIoptions\fP keyword of a system's \fIresolv.conf\fP file can be
360 amended on a per-process basis by setting the environment variable
361 .B RES_OPTIONS
362 to a space-separated list of resolver options
363 as explained above under \fBoptions\fP.
365 The keyword and value must appear on a single line, and the keyword
366 (e.g., \fBnameserver\fP) must start the line.
367 The value follows the keyword, separated by white space.
369 Lines that contain a semicolon (;) or hash character (#)
370 in the first column are treated as comments.
371 .SH FILES
372 .IR /etc/resolv.conf ,
373 .I <resolv.h>
374 .SH SEE ALSO
375 .BR gethostbyname (3),
376 .BR resolver (3),
377 .BR host.conf (5),
378 .BR hosts (5),
379 .BR nsswitch.conf (5),
380 .BR hostname (7),
381 .BR named (8)
383 Name Server Operations Guide for BIND