1RESOLVER(5) BSD File Formats Manual RESOLVER(5)
2
4 resolver — DNS client
5
7 /etc/resolv.conf
8
10 The resolver is the DNS client used on most Linux and BSD systems. It
11 comes with glibc. Its configuration file /etc/resolv.conf (note the
12 spelling) determines the DNS servers to use, and various other options -
13 see below.
14
15 Almost all machines have a DNS server set up in this file - if it doesn't
16 exist, the system will assume there's a DNS server running on the local
17 machine, and work out the search path from the machines domain name.
18
19 The config file is read the first time the DNS client is invoked by a
20 process.
21
22 The different configuration options are:
23
24 nameserver IP address of a DNS server to use. Multiple name servers may
25 be listed, each on their own line. The resolver will use them
26 in order listed - if the first server times out answering the
27 query, the next server will be tried, and so on. If the
28 resolver runs out out of name servers, the first server will
29 be queried again, until a maximum number of retries are made.
30
31 The maximum number of DNS servers to use is set by MAXNS (see
32 <resolv.h> )
33
34 search Domain(s) to use for DNS lookups when no domain is specified.
35 List each domain following the search keyword with spaces or
36 tabs between them. Each possible domain will be checked in
37 order until a match is found. Note that this process may be
38 slow (queries will time out if no server is available for a
39 domain) and will generate a lot of network traffic if the
40 servers for the listed domains aren't local.
41
42 The search list is currently limited to six domains with a
43 total of 256 characters. If search isn't specified, the
44 search list will be determined from the local domain name
45 (whatever comes after the first dot). If the host name
46 doesn't contain a domain, the root domain is used.
47
48 By default, it search contains only the local domain name.
49
50 domain Local domain name. You can use this instead of the search
51 option to specify a single domain to check if a hostname
52 isn't specified. Most people just use search instead (that
53 option lets you use multiple servers, domain doesn't). You
54 can't use domain and search at the same time - they're mutu‐
55 ally exclusive.
56
57 If domain isn't specified, the domain will be determined from
58 the local domain name (whatever comes after the first dot).
59 If the host name doesn't contain a domain, the root domain is
60 used.
61
62 sortlist Sorts addresses returned by the gethostbyname system call. A
63 sortlist is specified by IP address netmask pairs. The net‐
64 mask is optional and defaults to the natural netmask of the
65 net. The IP address and optional network pairs are separated
66 by slashes. Up to 10 pairs may be specified. For example:
67
68 sortlist 130.155.160.0/255.255.240.0 130.155.0.0
69
70 options Allows certain internal resolver variables to be modified.
71 The syntax is
72 options option ...
73 where option is one of the following:
74
75 debug sets RES_DEBUG in _res.options.
76
77 ndots:n sets a threshold for the number of dots which must
78 appear in a name given to res_query() (see
79 resolver(3)) before an initial absolute query will
80 be made. The default for n is “1”, meaning that if
81 there are any dots in a name, the name will be
82 tried first as an absolute name before any search
83 list elements are appended to it.
84
85 timeout:n
86 sets the amount of time the resolver will wait for
87 a response from a remote name server before retry‐
88 ing the query via a different name server. Mea‐
89 sured in seconds, the default is RES_TIMEOUT (see
90 <resolv.h> ).
91
92 attempts:n
93 sets the number of times the resolver will send a
94 query to its name servers before giving up and
95 returning an error to the calling application. The
96 default is RES_DFLRETRY (see <resolv.h> ).
97
98 rotate sets RES_ROTATE in _res.options, which causes round
99 robin selection of nameservers from among those
100 listed. This has the effect of spreading the query
101 load among all listed servers, rather than having
102 all clients try the first listed server first every
103 time.
104
105 no-check-names
106 sets RES_NOCHECKNAME in _res.options, which dis‐
107 ables the modern BIND checking of incoming host
108 names and mail names for invalid characters such as
109 underscore (_), non-ASCII, or control characters.
110
111 inet6 sets RES_USE_INET6 in _res.options. This has the
112 effect of trying a AAAA query before an A query
113 inside the gethostbyname function, and of mapping
114 IPv4 responses in IPv6 ``tunnelled form'' if no
115 AAAA records are found but an A record set exists.
116
117 ip6-dotint / no-ip6-dotint
118 sets / clears the RES_NOIP6DOTINT bit in
119 _res.options, which when set (ip6-dotint) will
120 enable reverse IPv6 lookups to be made in the (dep‐
121 recated) ip6.int zone; when clear (no-ip6-dotint),
122 reverse IPv6 lookups are made in the ip6.arpa zone
123 by default.
124
125 ip6-bytestring
126 sets RES_USEBSTRING in _res.options. This causes
127 reverse IPv6 lookups to be made using the bit-label
128 format of RFC 2673; if not set, then nibble format
129 is used.
130
131 The domain and search keywords are mutually exclusive. If more than one
132 instance of these keywords is present, the last instance wins.
133
134 The search keyword of a system's resolv.conf file can be overridden on a
135 per-process basis by setting the environment variable “LOCALDOMAIN” to a
136 space-separated list of search domains.
137
138 The options keyword of a system's resolv.conf file can be amended on a
139 per-process basis by setting the environment variable “RES_OPTIONS to a
140 space-separated list of” resolver options as explained above under
141 options.
142
143 The keyword and value must appear on a single line, and the keyword
144 (e.g., nameserver) must start the line. The value follows the keyword,
145 separated by white space.
146
148 /etc/resolv.conf <resolv.h>
149
151 gethostbyname(3), hostname(7), named(8), resolver(3), resolver(5). “Name
152 Server Operations Guide for BIND”
153
1544th Berkeley Distribution June 23, 2004 4th Berkeley Distribution