Debian Codegraph @

upstream/mageia-cauldron/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.17"
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 .TP
264 .BR ip6\-bytestring " (since glibc 2.3.4 to glibc 2.24)"
265 Sets
266 .B RES_USEBSTRING
267 in
268 .IR _res.options .
269 This causes reverse IPv6 lookups to be made using the bit-label format
270 described in RFC\ 2673;
271 if this option is not set (which is the default), then nibble format is used.
272 This option was removed in glibc 2.25,
273 since it relied on a backward-incompatible
274 DNS extension that was never deployed on the Internet.
275 .TP
276 .BR ip6\-dotint / no\-ip6\-dotint " (glibc 2.3.4 to glibc 2.24)"
277 Clear/set
278 .B RES_NOIP6DOTINT
279 in
280 .IR _res.options .
281 When this option is clear
282 .RB ( ip6\-dotint ),
283 reverse IPv6 lookups are made in the (deprecated)
284 .I ip6.int
285 zone;
286 when this option is set
287 .RB ( no\-ip6\-dotint ),
288 reverse IPv6 lookups are made in the
289 .I ip6.arpa
290 zone by default.
291 These options are available up to glibc 2.24, where
292 .B no\-ip6\-dotint
293 is the default.
294 Since
295 .B ip6\-dotint
296 support long ago ceased to be available on the Internet,
297 these options were removed in glibc 2.25.
298 .TP
299 .BR edns0 " (since glibc 2.6)"
300 Sets
301 .B RES_USE_EDNS0
302 in
303 .IR _res.options .
304 This enables support for the DNS extensions described in RFC\ 2671.
305 .TP
306 .BR single\-request " (since glibc 2.10)"
307 Sets
308 .B RES_SNGLKUP
309 in
310 .IR _res.options .
311 By default, glibc performs IPv4 and IPv6 lookups in parallel since
312 glibc 2.9.
313 Some appliance DNS servers
314 cannot handle these queries properly and make the requests time out.
315 This option disables the behavior and makes glibc perform the IPv6
316 and IPv4 requests sequentially (at the cost of some slowdown of the
317 resolving process).
318 .TP
319 .BR single\-request\-reopen " (since glibc 2.9)"
320 Sets
321 .B RES_SNGLKUPREOP
322 in
323 .IR _res.options .
324 The resolver uses the same socket for the A and AAAA requests.
325 Some hardware mistakenly sends back only one reply.
326 When that happens the client system will sit and wait for the second reply.
327 Turning this option on changes this behavior
328 so that if two requests from the same port are not handled correctly it will
329 close the socket and open a new one before sending the second request.
330 .TP
331 .BR no\-tld\-query " (since glibc 2.14)"
332 Sets
333 .B RES_NOTLDQUERY
334 in
335 .IR _res.options .
336 This option causes
337 .BR res_nsearch ()
338 to not attempt to resolve an unqualified name
339 as if it were a top level domain (TLD).
340 This option can cause problems if the site has ``localhost'' as a TLD
341 rather than having localhost on one or more elements of the search list.
342 This option has no effect if neither RES_DEFNAMES or RES_DNSRCH is set.
343 .TP
344 .BR use\-vc " (since glibc 2.14)"
345 Sets
346 .B RES_USEVC
347 in
348 .IR _res.options .
349 This option forces the use of TCP for DNS resolutions.
350 .\" aef16cc8a4c670036d45590877d411a97f01e0cd
351 .TP
352 .BR no\-reload " (since glibc 2.26)"
353 Sets
354 .B RES_NORELOAD
355 in
356 .IR _res.options .
357 This option disables automatic reloading of a changed configuration file.
358 .TP
359 .BR trust\-ad " (since glibc 2.31)"
360 .\" 446997ff1433d33452b81dfa9e626b8dccf101a4
361 Sets
362 .B RES_TRUSTAD
363 in
364 .IR _res.options .
365 This option controls the AD bit behavior of the stub resolver.
366 If a validating resolver sets the AD bit in a response,
367 it indicates that the data in the response was verified according
368 to the DNSSEC protocol.
369 In order to rely on the AD bit, the local system has to
370 trust both the DNSSEC-validating resolver and the network path to it,
371 which is why an explicit opt-in is required.
372 If the
373 .B trust\-ad
374 option is active, the stub resolver sets the AD bit in outgoing DNS
375 queries (to enable AD bit support), and preserves the AD bit in responses.
376 Without this option, the AD bit is not set in queries,
377 and it is always removed from responses before they are returned to the
378 application.
379 This means that applications can trust the AD bit in responses if the
380 .B trust\-ad
381 option has been set correctly.
382 .IP
383 In glibc 2.30 and earlier,
384 the AD is not set automatically in queries,
385 and is passed through unchanged to applications in responses.
386 .RE
387 .P
388 The
389 .I search
390 keyword of a system's
391 .I resolv.conf
392 file can be
393 overridden on a per-process basis by setting the environment variable
394 .B LOCALDOMAIN
395 to a space-separated list of search domains.
396 .P
397 The
398 .I options
399 keyword of a system's
400 .I resolv.conf
401 file can be
402 amended on a per-process basis by setting the environment variable
403 .B RES_OPTIONS
404 to a space-separated list of resolver options
405 as explained above under
406 .BR options .
407 .P
408 The keyword and value must appear on a single line, and the keyword
409 (e.g.,
410 .BR nameserver )
411 must start the line.
412 The value follows the keyword, separated by white space.
413 .P
414 Lines that contain a semicolon (;) or hash character (#)
415 in the first column are treated as comments.
416 .SH FILES
417 .IR /etc/resolv.conf ,
418 .I <resolv.h>
419 .SH SEE ALSO
420 .BR gethostbyname (3),
421 .BR resolver (3),
422 .BR host.conf (5),
423 .BR hosts (5),
424 .BR nsswitch.conf (5),
425 .BR hostname (7),
426 .BR named (8)
427 .P
428 Name Server Operations Guide for BIND