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-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 glibc 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 glibc 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 up
151 to glibc 2.24, where no-ip6-dotint is the default. Since
152 ip6-dotint support long ago ceased to be available on the
153 Internet, these options were removed in glibc 2.25.
154
155 edns0 (since glibc 2.6)
156 Sets RES_USE_EDNS0 in _res.options. This enables support
157 for the DNS extensions described in RFC 2671.
158
159 single-request (since glibc 2.10)
160 Sets RES_SNGLKUP in _res.options. By default, glibc per‐
161 forms IPv4 and IPv6 lookups in parallel since glibc 2.9.
162 Some appliance DNS servers cannot handle these queries
163 properly and make the requests time out. This option
164 disables the behavior and makes glibc perform the IPv6
165 and IPv4 requests sequentially (at the cost of some slow‐
166 down of the resolving process).
167
168 single-request-reopen (since glibc 2.9)
169 Sets RES_SNGLKUPREOP in _res.options. The resolver uses
170 the same socket for the A and AAAA requests. Some hard‐
171 ware mistakenly sends back only one reply. When that
172 happens the client system will sit and wait for the sec‐
173 ond reply. Turning this option on changes this behavior
174 so that if two requests from the same port are not han‐
175 dled correctly it will close the socket and open a new
176 one before sending the second request.
177
178 no-tld-query (since glibc 2.14)
179 Sets RES_NOTLDQUERY in _res.options. This option causes
180 res_nsearch() to not attempt to resolve an unqualified
181 name as if it were a top level domain (TLD). This option
182 can cause problems if the site has ``localhost'' as a TLD
183 rather than having localhost on one or more elements of
184 the search list. This option has no effect if neither
185 RES_DEFNAMES or RES_DNSRCH is set.
186
187 use-vc (since glibc 2.14)
188 Sets RES_USEVC in _res.options. This option forces the
189 use of TCP for DNS resolutions.
190
191 no-reload (since glibc 2.26)
192 Sets RES_NORELOAD in _res.options. This option disables
193 automatic reloading of a changed configuration file.
194
195 trust-ad (since glibc 2.31)
196 Sets RES_TRUSTAD in _res.options. This option controls
197 the AD bit behavior of the stub resolver. If a validat‐
198 ing resolver sets the AD bit in a response, it indicates
199 that the data in the response was verified according to
200 the DNSSEC protocol. In order to rely on the AD bit, the
201 local system has to trust both the DNSSEC-validating re‐
202 solver and the network path to it, which is why an ex‐
203 plicit opt-in is required. If the trust-ad option is ac‐
204 tive, the stub resolver sets the AD bit in outgoing DNS
205 queries (to enable AD bit support), and preserves the AD
206 bit in responses. Without this option, the AD bit is not
207 set in queries, and it is always removed from responses
208 before they are returned to the application. This means
209 that applications can trust the AD bit in responses if
210 the trust-ad option has been set correctly.
211
212 In glibc 2.30 and earlier, the AD is not set automati‐
213 cally in queries, and is passed through unchanged to ap‐
214 plications in responses.
215
216 The search keyword of a system's resolv.conf file can be overridden on
217 a per-process basis by setting the environment variable LOCALDOMAIN to
218 a space-separated list of search domains.
219
220 The options keyword of a system's resolv.conf file can be amended on a
221 per-process basis by setting the environment variable RES_OPTIONS to a
222 space-separated list of resolver options as explained above under op‐
223 tions.
224
225 The keyword and value must appear on a single line, and the keyword
226 (e.g., nameserver) must start the line. The value follows the keyword,
227 separated by white space.
228
229 Lines that contain a semicolon (;) or hash character (#) in the first
230 column are treated as comments.
231
233 /etc/resolv.conf, <resolv.h>
234
236 gethostbyname(3), resolver(3), host.conf(5), hosts(5), nss‐
237 witch.conf(5), hostname(7), named(8)
238
239 Name Server Operations Guide for BIND
240
241
242
2434th Berkeley Distribution 2023-02-05 resolv.conf(5)