Debian Codegraph @

upstream/debian-unstable/man5/resolv.conf.5

raw
1 .\" Copyright 1986, The Regents of the University of California.
2 .\" Copyright, the authors of the Linux man-pages project
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 .TH resolv.conf 5 2025-09-21 "Linux man-pages 6.18"
19 .UC 4
20 .SH NAME
21 resolv.conf \- resolver configuration file
22 .SH SYNOPSIS
23 .nf
24 .B /etc/resolv.conf
25 .fi
26 .SH DESCRIPTION
27 The
28 .I resolver
29 is a set of routines in the C library
30 that provide access to the Internet Domain Name System (DNS).
31 The resolver configuration file contains information that is read
32 by the resolver routines the first time they are invoked by a process.
33 The file is designed to be human readable and contains a list of
34 keywords with values that provide various types of resolver information.
35 The configuration file is considered a trusted source of DNS information;
36 see the
37 .B trust-ad
38 option below for details.
39 .P
40 If this file does not exist, only the name server on the local machine
41 will be queried, and the search list contains the local domain name
42 determined from the hostname.
43 .P
44 The different configuration options are:
45 .TP
46 .BR nameserver " Name server IP address"
47 Internet address of a name server that the resolver should query,
48 either an IPv4 address (in dot notation),
49 or an IPv6 address in colon (and possibly dot) notation as per RFC 2373.
50 Up to
51 .B MAXNS
52 (currently 3, see
53 .IR <resolv.h> )
54 name servers may be listed,
55 one per keyword.
56 If there are multiple servers,
57 the resolver library queries them in the order listed.
58 If no
59 .B nameserver
60 entries are present,
61 the default is to use the name server on the local machine.
62 (The algorithm used is to try a name server, and if the query times out,
63 try the next, until out of name servers,
64 then repeat trying all the name servers
65 until a maximum number of retries are made.)
66 .TP
67 .BR search " Search list for host-name lookup."
68 By default, the search list contains one entry, the local domain name.
69 It is determined from the local hostname returned by
70 .BR gethostname (2);
71 the local domain name is taken to be everything after the first
72 \[aq].\[aq].
73 Finally, if the hostname does not contain a \[aq].\[aq], the
74 root domain is assumed as the local domain name.
75 .IP
76 This may be changed by listing the desired domain search path
77 following the
78 .I search
79 keyword with spaces or tabs separating
80 the names.
81 Resolver queries having fewer than
82 .I ndots
83 dots (default is 1) in them will be attempted using each component
84 of the search path in turn until a match is found.
85 For environments with multiple subdomains please read
86 .BI "options ndots:" n
87 below to avoid man-in-the-middle attacks and unnecessary
88 traffic for the root-dns-servers.
89 .\" When having a resolv.conv with a line
90 .\" search subdomain.domain.tld domain.tld
91 .\" and doing a hostlookup, for example by
92 .\" ping host.anothersubdomain
93 .\" it sends dns-requests for
94 .\" host.anothersubdomain.
95 .\" host.anothersubdomain.subdomain.domain.tld.
96 .\" host.anothersubdomain.domain.tld.
97 .\" thus not only causing unnecessary traffic for the root-dns-servers
98 .\" but broadcasting information to the outside and making man-in-the-middle
99 .\" attacks possible.
100 Note that this process may be slow and will generate a lot of network
101 traffic if the servers for the listed domains are not local,
102 and that queries will time out if no server is available
103 for one of the domains.
104 .IP
105 If there are multiple
106 .B search
107 directives, only the search list from the last instance is used.
108 .IP
109 In glibc 2.25 and earlier, the search list is limited to six domains
110 with a total of 256 characters.
111 Since glibc 2.26,
112 .\" glibc commit 3f853f22c87f0b671c0366eb290919719fa56c0e
113 the search list is unlimited.
114 .IP
115 The
116 .B domain
117 directive is an obsolete name for the
118 .B search
119 directive that handles one search list entry only.
120 .TP
121 .B sortlist
122 This option allows addresses returned by
123 .BR gethostbyname (3)
124 to be sorted.
125 A sortlist is specified by IP-address-netmask pairs.
126 The netmask is
127 optional and defaults to the natural netmask of the net.
128 The IP address
129 and optional network pairs are separated by slashes.
130 Up to 10 pairs may
131 be specified.
132 Here is an example:
133 .IP
134 .in +4n
135 sortlist 130.155.160.0/255.255.240.0 130.155.0.0
136 .in
137 .TP
138 .B options
139 Options allows certain internal resolver variables to be modified.
140 The syntax is
141 .RS
142 .IP
143 .BI options \~option\~...
144 .P
145 where
146 .I option
147 is one of the following:
148 .TP
149 .B debug
150 .\" Since glibc 2.2?
151 Sets
152 .B RES_DEBUG
153 in
154 .I _res.options
155 (effective only if glibc was built with debug support;
156 see
157 .BR resolver (3)).
158 .TP
159 .BI ndots: n
160 .\" Since glibc 2.2
161 Sets a threshold for the number of dots which
162 must appear in a name given to
163 .BR res_query (3)
164 (see
165 .BR resolver (3))
166 before an
167 .I initial absolute query
168 will be made.
169 The default for
170 .I n
171 is 1, meaning that if there are any dots in a name, the name
172 will be tried first as an absolute name before any
173 .I search list
174 elements are appended to it.
175 The value for this option is silently capped to 15.
176 .TP
177 .BI timeout: n
178 .\" Since glibc 2.2
179 Sets the amount of time the resolver will wait for a
180 response from a remote name server before retrying the
181 query via a different name server.
182 This may
183 .B not
184 be the total time taken by any resolver API call and there is no
185 guarantee that a single resolver API call maps to a single timeout.
186 Measured in seconds,
187 the default is
188 .B RES_TIMEOUT
189 (currently 5, see
190 .IR <resolv.h> ).
191 The value for this option is silently capped to 30.
192 .TP
193 .BI attempts: n
194 Sets the number of times the resolver will send a
195 query to its name servers before giving up and returning
196 an error to the calling application.
197 The default is
198 .B RES_DFLRETRY
199 (currently 2, see
200 .IR <resolv.h> ).
201 The value for this option is silently capped to 5.
202 .TP
203 .B rotate
204 .\" Since glibc 2.2
205 Sets
206 .B RES_ROTATE
207 in
208 .IR _res.options ,
209 which causes round-robin selection of name servers from among those listed.
210 This has the effect of spreading the query load among all listed servers,
211 rather than having all clients try the first listed server first every time.
212 .TP
213 .B no\-aaaa (since glibc 2.36)
214 .\" f282cdbe7f436c75864e5640a409a10485e9abb2
215 Sets
216 .B RES_NOAAAA
217 in
218 .IR _res.options ,
219 which suppresses AAAA queries made by the stub resolver,
220 including AAAA lookups triggered by NSS-based interfaces such as
221 .BR getaddrinfo (3).
222 Only DNS lookups are affected: IPv6 data in
223 .BR hosts (5)
224 is still used,
225 .BR getaddrinfo (3)
226 with
227 .B AI_PASSIVE
228 will still produce IPv6 addresses,
229 and configured IPv6 name servers are still used.
230 To produce correct Name Error (NXDOMAIN) results,
231 AAAA queries are translated to A queries.
232 This option is intended preliminary for diagnostic purposes,
233 to rule out that AAAA DNS queries have adverse impact.
234 It is incompatible with EDNS0 usage and DNSSEC validation by applications.
235 .TP
236 .B no\-check\-names
237 .\" since glibc 2.2
238 Sets
239 .B RES_NOCHECKNAME
240 in
241 .IR _res.options ,
242 which disables the modern BIND checking of incoming hostnames and
243 mail names for invalid characters such as underscore (_), non-ASCII,
244 or control characters.
245 .TP
246 .B inet6
247 .\" Since glibc 2.2
248 Sets
249 .B RES_USE_INET6
250 in
251 .IR _res.options .
252 This has the effect of trying an AAAA query before an A query inside the
253 .BR gethostbyname (3)
254 function, and of mapping IPv4 responses in IPv6 "tunneled form"
255 if no AAAA records are found but an A record set exists.
256 Since glibc 2.25,
257 .\" b76e065991ec01299225d9da90a627ebe6c1ac97
258 this option is deprecated;
259 applications should use
260 .BR getaddrinfo (3),
261 rather than
262 .BR gethostbyname (3).
263 .PP
264 Some programs behave strangely when this option is turned on.
265 .TP
266 .BR ip6\-bytestring " (since glibc 2.3.4 to glibc 2.24)"
267 Sets
268 .B RES_USEBSTRING
269 in
270 .IR _res.options .
271 This causes reverse IPv6 lookups to be made using the bit-label format
272 described in RFC\ 2673;
273 if this option is not set (which is the default), then nibble format is used.
274 This option was removed in glibc 2.25,
275 since it relied on a backward-incompatible
276 DNS extension that was never deployed on the Internet.
277 .TP
278 .BR ip6\-dotint / no\-ip6\-dotint " (glibc 2.3.4 to glibc 2.24)"
279 Clear/set
280 .B RES_NOIP6DOTINT
281 in
282 .IR _res.options .
283 When this option is clear
284 .RB ( ip6\-dotint ),
285 reverse IPv6 lookups are made in the (deprecated)
286 .I ip6.int
287 zone;
288 when this option is set
289 .RB ( no\-ip6\-dotint ),
290 reverse IPv6 lookups are made in the
291 .I ip6.arpa
292 zone by default.
293 These options are available up to glibc 2.24, where
294 .B no\-ip6\-dotint
295 is the default.
296 Since
297 .B ip6\-dotint
298 support long ago ceased to be available on the Internet,
299 these options were removed in glibc 2.25.
300 .TP
301 .BR edns0 " (since glibc 2.6)"
302 Sets
303 .B RES_USE_EDNS0
304 in
305 .IR _res.options .
306 This enables support for the DNS extensions described in RFC\ 2671.
307 .TP
308 .BR single\-request " (since glibc 2.10)"
309 Sets
310 .B RES_SNGLKUP
311 in
312 .IR _res.options .
313 By default, glibc performs IPv4 and IPv6 lookups in parallel since
314 glibc 2.9.
315 Some appliance DNS servers
316 cannot handle these queries properly and make the requests time out.
317 This option disables the behavior and makes glibc perform the IPv6
318 and IPv4 requests sequentially (at the cost of some slowdown of the
319 resolving process).
320 .TP
321 .BR single\-request\-reopen " (since glibc 2.9)"
322 Sets
323 .B RES_SNGLKUPREOP
324 in
325 .IR _res.options .
326 The resolver uses the same socket for the A and AAAA requests.
327 Some hardware mistakenly sends back only one reply.
328 When that happens the client system will sit and wait for the second reply.
329 Turning this option on changes this behavior
330 so that if two requests from the same port are not handled correctly it will
331 close the socket and open a new one before sending the second request.
332 .TP
333 .BR no\-tld\-query " (since glibc 2.14)"
334 Sets
335 .B RES_NOTLDQUERY
336 in
337 .IR _res.options .
338 This option causes
339 .BR res_nsearch ()
340 to not attempt to resolve an unqualified name
341 as if it were a top level domain (TLD).
342 This option can cause problems if the site has ``localhost'' as a TLD
343 rather than having localhost on one or more elements of the search list.
344 This option has no effect if neither RES_DEFNAMES or RES_DNSRCH is set.
345 .TP
346 .BR use\-vc " (since glibc 2.14)"
347 Sets
348 .B RES_USEVC
349 in
350 .IR _res.options .
351 This option forces the use of TCP for DNS resolutions.
352 .\" aef16cc8a4c670036d45590877d411a97f01e0cd
353 .TP
354 .BR no\-reload " (since glibc 2.26)"
355 Sets
356 .B RES_NORELOAD
357 in
358 .IR _res.options .
359 This option disables automatic reloading of a changed configuration file.
360 .TP
361 .BR trust\-ad " (since glibc 2.31)"
362 .\" 446997ff1433d33452b81dfa9e626b8dccf101a4
363 Sets
364 .B RES_TRUSTAD
365 in
366 .IR _res.options .
367 This option controls the AD bit behavior of the stub resolver.
368 If a validating resolver sets the AD bit in a response,
369 it indicates that the data in the response was verified according
370 to the DNSSEC protocol.
371 In order to rely on the AD bit, the local system has to
372 trust both the DNSSEC-validating resolver and the network path to it,
373 which is why an explicit opt-in is required.
374 If the
375 .B trust\-ad
376 option is active, the stub resolver sets the AD bit in outgoing DNS
377 queries (to enable AD bit support), and preserves the AD bit in responses.
378 Without this option, the AD bit is not set in queries,
379 and it is always removed from responses before they are returned to the
380 application.
381 This means that applications can trust the AD bit in responses if the
382 .B trust\-ad
383 option has been set correctly.
384 .IP
385 In glibc 2.30 and earlier,
386 the AD is not set automatically in queries,
387 and is passed through unchanged to applications in responses.
388 .RE
389 .P
390 The
391 .I search
392 keyword of a system's
393 .I resolv.conf
394 file can be
395 overridden on a per-process basis by setting the environment variable
396 .B LOCALDOMAIN
397 to a space-separated list of search domains.
398 .P
399 The
400 .I options
401 keyword of a system's
402 .I resolv.conf
403 file can be
404 amended on a per-process basis by setting the environment variable
405 .B RES_OPTIONS
406 to a space-separated list of resolver options
407 as explained above under
408 .BR options .
409 .P
410 The keyword and value must appear on a single line, and the keyword
411 (e.g.,
412 .BR nameserver )
413 must start the line.
414 The value follows the keyword, separated by white space.
415 .P
416 Lines that contain a semicolon (;) or hash character (#)
417 in the first column are treated as comments.
418 .SH FILES
419 .IR /etc/resolv.conf ,
420 .I <resolv.h>
421 .SH SEE ALSO
422 .BR gethostbyname (3),
423 .BR resolver (3),
424 .BR host.conf (5),
425 .BR hosts (5),
426 .BR nsswitch.conf (5),
427 .BR hostname (7),
428 .BR named (8)
429 .P
430 Name Server Operations Guide for BIND