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; the domain name is determined from the hostname and
23 the domain search path is constructed from the domain name.
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 domain Local domain name.
41 Most queries for names within this domain can use short names
42 relative to the local domain. If set to '.', the root domain is
43 considered. If no domain entry is present, the domain is deter‐
44 mined from the local hostname returned by gethostname(2); the
45 domain part is taken to be everything after the first '.'.
46 Finally, if the hostname does not contain a domain part, the
47 root domain is assumed.
48
49 search Search list for host-name lookup.
50 The search list is normally determined from the local domain
51 name; by default, it contains only the local domain name. This
52 may be changed by listing the desired domain search path follow‐
53 ing the search keyword with spaces or tabs separating the names.
54 Resolver queries having fewer than ndots dots (default is 1) in
55 them will be attempted using each component of the search path
56 in turn until a match is found. For environments with multiple
57 subdomains please read options ndots:n below to avoid man-in-
58 the-middle attacks and unnecessary traffic for the root-dns-
59 servers. Note that this process may be slow and will generate a
60 lot of network traffic if the servers for the listed domains are
61 not local, and that queries will time out if no server is avail‐
62 able for one of the domains.
63
64 The search list is currently limited to six domains with a total
65 of 256 characters.
66
67 sortlist
68 This option allows addresses returned by gethostbyname(3) to be
69 sorted. A sortlist is specified by IP-address-netmask pairs.
70 The netmask is optional and defaults to the natural netmask of
71 the net. The IP address and optional network pairs are sepa‐
72 rated by slashes. Up to 10 pairs may be specified. Here is an
73 example:
74
75 sortlist 130.155.160.0/255.255.240.0 130.155.0.0
76
77 options
78 Options allows certain internal resolver variables to be modi‐
79 fied. The syntax is
80
81 options option ...
82
83 where option is one of the following:
84
85 debug Sets RES_DEBUG in _res.options (effective only if glibc
86 was built with debug support; see resolver(3)).
87
88 ndots:n
89 Sets a threshold for the number of dots which must appear
90 in a name given to res_query(3) (see resolver(3)) before
91 an initial absolute query will be made. The default for
92 n is 1, meaning that if there are any dots in a name, the
93 name will be tried first as an absolute name before any
94 search list elements are appended to it. The value for
95 this option is silently capped to 15.
96
97 timeout:n
98 Sets the amount of time the resolver will wait for a
99 response from a remote name server before retrying the
100 query via a different name server. This may not be the
101 total time taken by any resolver API call and there is no
102 guarantee that a single resolver API call maps to a sin‐
103 gle timeout. Measured in seconds, the default is
104 RES_TIMEOUT (currently 5, see <resolv.h>). The value for
105 this option is silently capped to 30.
106
107 attempts:n
108 Sets the number of times the resolver will send a query
109 to its name servers before giving up and returning an
110 error to the calling application. The default is
111 RES_DFLRETRY (currently 2, see <resolv.h>). The value
112 for this option is silently capped to 5.
113
114 rotate Sets RES_ROTATE in _res.options, which causes round-robin
115 selection of name servers from among those listed. This
116 has the effect of spreading the query load among all
117 listed servers, rather than having all clients try the
118 first listed server first every time.
119
120 no-check-names
121 Sets RES_NOCHECKNAME in _res.options, which disables the
122 modern BIND checking of incoming hostnames and mail names
123 for invalid characters such as underscore (_), non-ASCII,
124 or control characters.
125
126 inet6 Sets RES_USE_INET6 in _res.options. This has the effect
127 of trying an AAAA query before an A query inside the
128 gethostbyname(3) function, and of mapping IPv4 responses
129 in IPv6 "tunneled form" if no AAAA records are found but
130 an A record set exists. Since glibc 2.25, this option is
131 deprecated; applications should use getaddrinfo(3),
132 rather than gethostbyname(3).
133
134 ip6-bytestring (since glibc 2.3.4)
135 Sets RES_USEBSTRING in _res.options. This causes reverse
136 IPv6 lookups to be made using the bit-label format
137 described in RFC 2673; if this option is not set (which
138 is the default), then nibble format is used. This option
139 was removed in glibc 2.25, since it relied on a backward-
140 incompatible DNS extension that was never deployed on the
141 Internet.
142
143 ip6-dotint/no-ip6-dotint (glibc 2.3.4 to 2.24)
144 Clear/set RES_NOIP6DOTINT in _res.options. When this
145 option is clear (ip6-dotint), reverse IPv6 lookups are
146 made in the (deprecated) ip6.int zone; when this option
147 is set (no-ip6-dotint), reverse IPv6 lookups are made in
148 the ip6.arpa zone by default. These options are avail‐
149 able in glibc versions up to 2.24, where no-ip6-dotint is
150 the default. Since ip6-dotint support long ago ceased to
151 be available on the Internet, these options were removed
152 in glibc 2.25.
153
154 edns0 (since glibc 2.6)
155 Sets RES_USE_EDNSO in _res.options. This enables support
156 for the DNS extensions described in RFC 2671.
157
158 single-request (since glibc 2.10)
159 Sets RES_SNGLKUP in _res.options. By default, glibc per‐
160 forms IPv4 and IPv6 lookups in parallel since version
161 2.9. Some appliance DNS servers cannot handle these
162 queries properly and make the requests time out. This
163 option disables the behavior and makes glibc perform the
164 IPv6 and IPv4 requests sequentially (at the cost of some
165 slowdown of the resolving process).
166
167 single-request-reopen (since glibc 2.9)
168 Sets RES_SNGLKUPREOP in _res.options. The resolver uses
169 the same socket for the A and AAAA requests. Some hard‐
170 ware mistakenly sends back only one reply. When that
171 happens the client system will sit and wait for the sec‐
172 ond reply. Turning this option on changes this behavior
173 so that if two requests from the same port are not han‐
174 dled correctly it will close the socket and open a new
175 one before sending the second request.
176
177 no-tld-query (since glibc 2.14)
178 Sets RES_NOTLDQUERY in _res.options. This option causes
179 res_nsearch() to not attempt to resolve an unqualified
180 name as if it were a top level domain (TLD). This option
181 can cause problems if the site has ``localhost'' as a TLD
182 rather than having localhost on one or more elements of
183 the search list. This option has no effect if neither
184 RES_DEFNAMES or RES_DNSRCH is set.
185
186 use-vc (since glibc 2.14)
187 Sets RES_USEVC in _res.options. This option forces the
188 use of TCP for DNS resolutions.
189
190 The domain and search keywords are mutually exclusive. If more than
191 one instance of these keywords is present, the last instance wins.
192
193 The search keyword of a system's resolv.conf file can be overridden on
194 a per-process basis by setting the environment variable LOCALDOMAIN to
195 a space-separated list of search domains.
196
197 The options keyword of a system's resolv.conf file can be amended on a
198 per-process basis by setting the environment variable RES_OPTIONS to a
199 space-separated list of resolver options as explained above under
200 options.
201
202 The keyword and value must appear on a single line, and the keyword
203 (e.g., nameserver) must start the line. The value follows the keyword,
204 separated by white space.
205
206 Lines that contain a semicolon (;) or hash character (#) in the first
207 column are treated as comments.
208
210 /etc/resolv.conf, <resolv.h>
211
213 gethostbyname(3), resolver(3), host.conf(5), hosts(5), nss‐
214 witch.conf(5), hostname(7), named(8)
215
216 Name Server Operations Guide for BIND
217
219 This page is part of release 4.16 of the Linux man-pages project. A
220 description of the project, information about reporting bugs, and the
221 latest version of this page, can be found at
222 https://www.kernel.org/doc/man-pages/.
223
224
225
2264th Berkeley Distribution 2017-09-15 RESOLV.CONF(5)