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 (e.g., DNSSEC AD-bit infor‐
19 mation will be returned unmodified from this source).
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
23 determined 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
30 address in colon (and possibly dot) notation as per RFC 2373.
31 Up to MAXNS (currently 3, see <resolv.h>) name servers may be
32 listed, one per keyword. If there are multiple servers, the
33 resolver 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
63 domains 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
101 response 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
112 error 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)
137 Sets RES_USEBSTRING in _res.options. This causes reverse
138 IPv6 lookups to be made using the bit-label format
139 described in RFC 2673; if this option is not set (which
140 is 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
147 option is clear (ip6-dotint), reverse IPv6 lookups are
148 made in the (deprecated) ip6.int zone; when this option
149 is set (no-ip6-dotint), reverse IPv6 lookups are made in
150 the ip6.arpa zone by default. These options are avail‐
151 able in glibc versions up to 2.24, where no-ip6-dotint is
152 the default. Since ip6-dotint support long ago ceased to
153 be available on the Internet, these options were removed
154 in glibc 2.25.
155
156 edns0 (since glibc 2.6)
157 Sets RES_USE_EDNSO 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 The search keyword of a system's resolv.conf file can be overridden on
197 a per-process basis by setting the environment variable LOCALDOMAIN to
198 a space-separated list of search domains.
199
200 The options keyword of a system's resolv.conf file can be amended on a
201 per-process basis by setting the environment variable RES_OPTIONS to a
202 space-separated list of resolver options as explained above under
203 options.
204
205 The keyword and value must appear on a single line, and the keyword
206 (e.g., nameserver) must start the line. The value follows the keyword,
207 separated by white space.
208
209 Lines that contain a semicolon (;) or hash character (#) in the first
210 column are treated as comments.
211
213 /etc/resolv.conf, <resolv.h>
214
216 gethostbyname(3), resolver(3), host.conf(5), hosts(5), nss‐
217 witch.conf(5), hostname(7), named(8)
218
219 Name Server Operations Guide for BIND
220
222 This page is part of release 5.07 of the Linux man-pages project. A
223 description of the project, information about reporting bugs, and the
224 latest version of this page, can be found at
225 https://www.kernel.org/doc/man-pages/.
226
227
228
2294th Berkeley Distribution 2019-10-10 RESOLV.CONF(5)