1resolv.conf(5) File Formats 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-aaaa (since glibc 2.36)
123 Sets RES_NOAAAA in _res.options, which suppresses AAAA
124 queries made by the stub resolver, including AAAA lookups
125 triggered by NSS-based interfaces such as getaddrinfo(3).
126 Only DNS lookups are affected: IPv6 data in hosts(5) is
127 still used, getaddrinfo(3) with AI_PASSIVE will still
128 produce IPv6 addresses, and configured IPv6 name servers
129 are still used. To produce correct Name Error (NXDOMAIN)
130 results, AAAA queries are translated to A queries. This
131 option is intended preliminary for diagnostic purposes,
132 to rule out that AAAA DNS queries have adverse impact.
133 It is incompatible with EDNS0 usage and DNSSEC validation
134 by applications.
135
136 no-check-names
137 Sets RES_NOCHECKNAME in _res.options, which disables the
138 modern BIND checking of incoming hostnames and mail names
139 for invalid characters such as underscore (_), non-ASCII,
140 or control characters.
141
142 inet6 Sets RES_USE_INET6 in _res.options. This has the effect
143 of trying an AAAA query before an A query inside the
144 gethostbyname(3) function, and of mapping IPv4 responses
145 in IPv6 "tunneled form" if no AAAA records are found but
146 an A record set exists. Since glibc 2.25, this option is
147 deprecated; applications should use getaddrinfo(3),
148 rather than gethostbyname(3).
149
150 ip6-bytestring (since glibc 2.3.4 to glibc 2.24)
151 Sets RES_USEBSTRING in _res.options. This causes reverse
152 IPv6 lookups to be made using the bit-label format de‐
153 scribed in RFC 2673; if this option is not set (which is
154 the default), then nibble format is used. This option
155 was removed in glibc 2.25, since it relied on a backward-
156 incompatible DNS extension that was never deployed on the
157 Internet.
158
159 ip6-dotint/no-ip6-dotint (glibc 2.3.4 to glibc 2.24)
160 Clear/set RES_NOIP6DOTINT in _res.options. When this op‐
161 tion is clear (ip6-dotint), reverse IPv6 lookups are made
162 in the (deprecated) ip6.int zone; when this option is set
163 (no-ip6-dotint), reverse IPv6 lookups are made in the
164 ip6.arpa zone by default. These options are available up
165 to glibc 2.24, where no-ip6-dotint is the default. Since
166 ip6-dotint support long ago ceased to be available on the
167 Internet, these options were removed in glibc 2.25.
168
169 edns0 (since glibc 2.6)
170 Sets RES_USE_EDNS0 in _res.options. This enables support
171 for the DNS extensions described in RFC 2671.
172
173 single-request (since glibc 2.10)
174 Sets RES_SNGLKUP in _res.options. By default, glibc per‐
175 forms IPv4 and IPv6 lookups in parallel since glibc 2.9.
176 Some appliance DNS servers cannot handle these queries
177 properly and make the requests time out. This option
178 disables the behavior and makes glibc perform the IPv6
179 and IPv4 requests sequentially (at the cost of some slow‐
180 down of the resolving process).
181
182 single-request-reopen (since glibc 2.9)
183 Sets RES_SNGLKUPREOP in _res.options. The resolver uses
184 the same socket for the A and AAAA requests. Some hard‐
185 ware mistakenly sends back only one reply. When that
186 happens the client system will sit and wait for the sec‐
187 ond reply. Turning this option on changes this behavior
188 so that if two requests from the same port are not han‐
189 dled correctly it will close the socket and open a new
190 one before sending the second request.
191
192 no-tld-query (since glibc 2.14)
193 Sets RES_NOTLDQUERY in _res.options. This option causes
194 res_nsearch() to not attempt to resolve an unqualified
195 name as if it were a top level domain (TLD). This option
196 can cause problems if the site has ``localhost'' as a TLD
197 rather than having localhost on one or more elements of
198 the search list. This option has no effect if neither
199 RES_DEFNAMES or RES_DNSRCH is set.
200
201 use-vc (since glibc 2.14)
202 Sets RES_USEVC in _res.options. This option forces the
203 use of TCP for DNS resolutions.
204
205 no-reload (since glibc 2.26)
206 Sets RES_NORELOAD in _res.options. This option disables
207 automatic reloading of a changed configuration file.
208
209 trust-ad (since glibc 2.31)
210 Sets RES_TRUSTAD in _res.options. This option controls
211 the AD bit behavior of the stub resolver. If a validat‐
212 ing resolver sets the AD bit in a response, it indicates
213 that the data in the response was verified according to
214 the DNSSEC protocol. In order to rely on the AD bit, the
215 local system has to trust both the DNSSEC-validating re‐
216 solver and the network path to it, which is why an ex‐
217 plicit opt-in is required. If the trust-ad option is ac‐
218 tive, the stub resolver sets the AD bit in outgoing DNS
219 queries (to enable AD bit support), and preserves the AD
220 bit in responses. Without this option, the AD bit is not
221 set in queries, and it is always removed from responses
222 before they are returned to the application. This means
223 that applications can trust the AD bit in responses if
224 the trust-ad option has been set correctly.
225
226 In glibc 2.30 and earlier, the AD is not set automati‐
227 cally in queries, and is passed through unchanged to ap‐
228 plications in responses.
229
230 The search keyword of a system's resolv.conf file can be overridden on
231 a per-process basis by setting the environment variable LOCALDOMAIN to
232 a space-separated list of search domains.
233
234 The options keyword of a system's resolv.conf file can be amended on a
235 per-process basis by setting the environment variable RES_OPTIONS to a
236 space-separated list of resolver options as explained above under op‐
237 tions.
238
239 The keyword and value must appear on a single line, and the keyword
240 (e.g., nameserver) must start the line. The value follows the keyword,
241 separated by white space.
242
243 Lines that contain a semicolon (;) or hash character (#) in the first
244 column are treated as comments.
245
247 /etc/resolv.conf, <resolv.h>
248
250 gethostbyname(3), resolver(3), host.conf(5), hosts(5), nss‐
251 witch.conf(5), hostname(7), named(8)
252
253 Name Server Operations Guide for BIND
254
255
256
2574th Berkeley Distribution 2023-05-05 resolv.conf(5)