1RESOLV.CONF(5) Linux Programmer's Manual RESOLV.CONF(5)
2
3
4
6 resolv.conf - resolver configuration file
7
9 /etc/resolv.conf
10
12 The resolver is a set of routines in the C library that provide access
13 to the Internet Domain Name System (DNS). The resolver configuration
14 file contains information that is read by the resolver routines the
15 first time they are invoked by a process. The file is designed to be
16 human readable and contains a list of keywords with values that provide
17 various types of resolver information. The configuration file is con‐
18 sidered a trusted source of DNS information; see the trust-ad option
19 below for details.
20
21 If this file does not exist, only the name server on the local machine
22 will be queried, and the search list contains the local domain name de‐
23 termined from the hostname.
24
25 The different configuration options are:
26
27 nameserver Name server IP address
28 Internet address of a name server that the resolver should
29 query, either an IPv4 address (in dot notation), or an IPv6 ad‐
30 dress in colon (and possibly dot) notation as per RFC 2373. Up
31 to MAXNS (currently 3, see <resolv.h>) name servers may be
32 listed, one per keyword. If there are multiple servers, the re‐
33 solver library queries them in the order listed. If no name‐
34 server entries are present, the default is to use the name
35 server on the local machine. (The algorithm used is to try a
36 name server, and if the query times out, try the next, until out
37 of name servers, then repeat trying all the name servers until a
38 maximum number of retries are made.)
39
40 search Search list for host-name lookup.
41 By default, the search list contains one entry, the local domain
42 name. It is determined from the local hostname returned by
43 gethostname(2); the local domain name is taken to be everything
44 after the first '.'. Finally, if the hostname does not contain
45 a '.', the root domain is assumed as the local domain name.
46
47 This may be changed by listing the desired domain search path
48 following the search keyword with spaces or tabs separating the
49 names. Resolver queries having fewer than ndots dots (default
50 is 1) in them will be attempted using each component of the
51 search path in turn until a match is found. For environments
52 with multiple subdomains please read options ndots:n below to
53 avoid man-in-the-middle attacks and unnecessary traffic for the
54 root-dns-servers. Note that this process may be slow and will
55 generate a lot of network traffic if the servers for the listed
56 domains are not local, and that queries will time out if no
57 server is available for one of the domains.
58
59 If there are multiple search directives, only the search list
60 from the last instance is used.
61
62 In glibc 2.25 and earlier, the search list is limited to six do‐
63 mains with a total of 256 characters. Since glibc 2.26, the
64 search list is unlimited.
65
66 The domain directive is an obsolete name for the search direc‐
67 tive that handles one search list entry only.
68
69 sortlist
70 This option allows addresses returned by gethostbyname(3) to be
71 sorted. A sortlist is specified by IP-address-netmask pairs.
72 The netmask is optional and defaults to the natural netmask of
73 the net. The IP address and optional network pairs are sepa‐
74 rated by slashes. Up to 10 pairs may be specified. Here is an
75 example:
76
77 sortlist 130.155.160.0/255.255.240.0 130.155.0.0
78
79 options
80 Options allows certain internal resolver variables to be modi‐
81 fied. The syntax is
82
83 options option ...
84
85 where option is one of the following:
86
87 debug Sets RES_DEBUG in _res.options (effective only if glibc
88 was built with debug support; see resolver(3)).
89
90 ndots:n
91 Sets a threshold for the number of dots which must appear
92 in a name given to res_query(3) (see resolver(3)) before
93 an initial absolute query will be made. The default for
94 n is 1, meaning that if there are any dots in a name, the
95 name will be tried first as an absolute name before any
96 search list elements are appended to it. The value for
97 this option is silently capped to 15.
98
99 timeout:n
100 Sets the amount of time the resolver will wait for a re‐
101 sponse from a remote name server before retrying the
102 query via a different name server. This may not be the
103 total time taken by any resolver API call and there is no
104 guarantee that a single resolver API call maps to a sin‐
105 gle timeout. Measured in seconds, the default is
106 RES_TIMEOUT (currently 5, see <resolv.h>). The value for
107 this option is silently capped to 30.
108
109 attempts:n
110 Sets the number of times the resolver will send a query
111 to its name servers before giving up and returning an er‐
112 ror to the calling application. The default is
113 RES_DFLRETRY (currently 2, see <resolv.h>). The value
114 for this option is silently capped to 5.
115
116 rotate Sets RES_ROTATE in _res.options, which causes round-robin
117 selection of name servers from among those listed. This
118 has the effect of spreading the query load among all
119 listed servers, rather than having all clients try the
120 first listed server first every time.
121
122 no-check-names
123 Sets RES_NOCHECKNAME in _res.options, which disables the
124 modern BIND checking of incoming hostnames and mail names
125 for invalid characters such as underscore (_), non-ASCII,
126 or control characters.
127
128 inet6 Sets RES_USE_INET6 in _res.options. This has the effect
129 of trying an AAAA query before an A query inside the
130 gethostbyname(3) function, and of mapping IPv4 responses
131 in IPv6 "tunneled form" if no AAAA records are found but
132 an A record set exists. Since glibc 2.25, this option is
133 deprecated; applications should use getaddrinfo(3),
134 rather than gethostbyname(3).
135
136 ip6-bytestring (since glibc 2.3.4 to 2.24)
137 Sets RES_USEBSTRING in _res.options. This causes reverse
138 IPv6 lookups to be made using the bit-label format de‐
139 scribed in RFC 2673; if this option is not set (which is
140 the default), then nibble format is used. This option
141 was removed in glibc 2.25, since it relied on a backward-
142 incompatible DNS extension that was never deployed on the
143 Internet.
144
145 ip6-dotint/no-ip6-dotint (glibc 2.3.4 to 2.24)
146 Clear/set RES_NOIP6DOTINT in _res.options. When this op‐
147 tion is clear (ip6-dotint), reverse IPv6 lookups are made
148 in the (deprecated) ip6.int zone; when this option is set
149 (no-ip6-dotint), reverse IPv6 lookups are made in the
150 ip6.arpa zone by default. These options are available in
151 glibc versions up to 2.24, where no-ip6-dotint is the de‐
152 fault. Since ip6-dotint support long ago ceased to be
153 available on the Internet, these options were removed in
154 glibc 2.25.
155
156 edns0 (since glibc 2.6)
157 Sets RES_USE_EDNS0 in _res.options. This enables support
158 for the DNS extensions described in RFC 2671.
159
160 single-request (since glibc 2.10)
161 Sets RES_SNGLKUP in _res.options. By default, glibc per‐
162 forms IPv4 and IPv6 lookups in parallel since version
163 2.9. Some appliance DNS servers cannot handle these
164 queries properly and make the requests time out. This
165 option disables the behavior and makes glibc perform the
166 IPv6 and IPv4 requests sequentially (at the cost of some
167 slowdown of the resolving process).
168
169 single-request-reopen (since glibc 2.9)
170 Sets RES_SNGLKUPREOP in _res.options. The resolver uses
171 the same socket for the A and AAAA requests. Some hard‐
172 ware mistakenly sends back only one reply. When that
173 happens the client system will sit and wait for the sec‐
174 ond reply. Turning this option on changes this behavior
175 so that if two requests from the same port are not han‐
176 dled correctly it will close the socket and open a new
177 one before sending the second request.
178
179 no-tld-query (since glibc 2.14)
180 Sets RES_NOTLDQUERY in _res.options. This option causes
181 res_nsearch() to not attempt to resolve an unqualified
182 name as if it were a top level domain (TLD). This option
183 can cause problems if the site has ``localhost'' as a TLD
184 rather than having localhost on one or more elements of
185 the search list. This option has no effect if neither
186 RES_DEFNAMES or RES_DNSRCH is set.
187
188 use-vc (since glibc 2.14)
189 Sets RES_USEVC in _res.options. This option forces the
190 use of TCP for DNS resolutions.
191
192 no-reload (since glibc 2.26)
193 Sets RES_NORELOAD in _res.options. This option disables
194 automatic reloading of a changed configuration file.
195
196 trust-ad (since glibc 2.31)
197 Sets RES_TRUSTAD in _res.options. This option controls
198 the AD bit behavior of the stub resolver. If a validat‐
199 ing resolver sets the AD bit in a response, it indicates
200 that the data in the response was verified according to
201 the DNSSEC protocol. In order to rely on the AD bit, the
202 local system has to trust both the DNSSEC-validating re‐
203 solver and the network path to it, which is why an ex‐
204 plicit opt-in is required. If the trust-ad option is ac‐
205 tive, the stub resolver sets the AD bit in outgoing DNS
206 queries (to enable AD bit support), and preserves the AD
207 bit in responses. Without this option, the AD bit is not
208 set in queries, and it is always removed from responses
209 before they are returned to the application. This means
210 that applications can trust the AD bit in responses if
211 the trust-ad option has been set correctly.
212
213 In glibc version 2.30 and earlier, the AD is not set au‐
214 tomatically in queries, and is passed through unchanged
215 to applications in responses.
216
217 The search keyword of a system's resolv.conf file can be overridden on
218 a per-process basis by setting the environment variable LOCALDOMAIN to
219 a space-separated list of search domains.
220
221 The options keyword of a system's resolv.conf file can be amended on a
222 per-process basis by setting the environment variable RES_OPTIONS to a
223 space-separated list of resolver options as explained above under op‐
224 tions.
225
226 The keyword and value must appear on a single line, and the keyword
227 (e.g., nameserver) must start the line. The value follows the keyword,
228 separated by white space.
229
230 Lines that contain a semicolon (;) or hash character (#) in the first
231 column are treated as comments.
232
234 /etc/resolv.conf, <resolv.h>
235
237 gethostbyname(3), resolver(3), host.conf(5), hosts(5), nss‐
238 witch.conf(5), hostname(7), named(8)
239
240 Name Server Operations Guide for BIND
241
243 This page is part of release 5.12 of the Linux man-pages project. A
244 description of the project, information about reporting bugs, and the
245 latest version of this page, can be found at
246 https://www.kernel.org/doc/man-pages/.
247
248
249
2504th Berkeley Distribution 2021-03-22 RESOLV.CONF(5)