]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/man/man5/resolver.5
src.conf.5: regen
[FreeBSD/FreeBSD.git] / share / man / man5 / resolver.5
1 .\" Copyright (c) 1986, 1991, 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\" 3. Neither the name of the University nor the names of its contributors
13 .\"    may be used to endorse or promote products derived from this software
14 .\"    without specific prior written permission.
15 .\"
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 .\" SUCH DAMAGE.
27 .\"
28 .\"     @(#)resolver.5  8.1 (Berkeley) 6/5/93
29 .\" $FreeBSD$
30 .\"
31 .Dd November 23, 2022
32 .Dt RESOLVER 5
33 .Os
34 .Sh NAME
35 .Nm resolver
36 .Nd resolver configuration file
37 .Sh SYNOPSIS
38 .Nm resolv.conf
39 .Sh DESCRIPTION
40 The
41 .Xr resolver 3
42 is a set of routines in the C library
43 which provide access to the Internet Domain Name System.
44 The resolver configuration file contains information that is read
45 by the resolver routines the first time they are invoked by a process.
46 The file is designed to be human readable and contains a list of
47 keywords with values that provide various types of resolver information.
48 .Pp
49 On a normally configured system, setting this file manually should not
50 be necessary.
51 The only name server(s) to be queried will be on the local machine
52 or automatically configured using DHCP or a similar mechanism,
53 the domain name is determined from the host name,
54 and the domain search path is constructed from the domain name.
55 .Pp
56 The different configuration options are:
57 .Bl -tag -width nameserver
58 .It Sy nameserver
59 IPv4 or IPv6 address of a name server
60 that the resolver should query.
61 Up to
62 .Dv MAXNS
63 (currently 3) name servers may be listed,
64 one per keyword.
65 If there are multiple servers,
66 the resolver library queries them in the order listed.
67 If no
68 .Sy nameserver
69 entries are present,
70 the default is to use the name server on the local machine.
71 (The algorithm used is to try a name server, and if the query times out,
72 try the next, until out of name servers,
73 then repeat trying all the name servers
74 until a maximum number of retries are made).
75 .It Sy domain
76 Local domain name.
77 Most queries for names within this domain can use short names
78 relative to the local domain.
79 If no
80 .Sy domain
81 entry is present, the domain is determined
82 from the local host name returned by
83 .Xr gethostname 3 ;
84 the domain part is taken to be everything after the first
85 .Ql \&. .
86 Finally, if the host name does not contain a domain part, the root
87 domain is assumed.
88 .It Sy search
89 Search list for host-name lookup.
90 The search list is normally determined from the local domain name;
91 by default, it contains only the local domain name.
92 This may be changed by listing the desired domain search path
93 following the
94 .Sy search
95 keyword with spaces or tabs separating
96 the names.
97 Most resolver queries will be attempted using each component
98 of the search path in turn until a match is found.
99 Note that this process may be slow and will generate a lot of network
100 traffic if the servers for the listed domains are not local,
101 and that queries will time out if no server is available
102 for one of the domains.
103 .Pp
104 The search list is currently limited to six domains
105 with a total of 256 characters.
106 .It Sy sortlist
107 Sortlist allows addresses returned by gethostbyname to be sorted.
108 A sortlist is specified by IP address netmask pairs.
109 If the netmask is not specified,
110 it defaults to the historical Class A/B/C netmask of the net;
111 this usage is deprecated.
112 The IP address
113 and network pairs are separated by slashes.
114 Up to 10 pairs may
115 be specified.
116 E.g.,
117 .Pp
118 .Dl "sortlist 10.9.1.0/255.255.240.0 10.9.0.0/255.255.0.0"
119 .It Sy options
120 Options allows certain internal resolver variables to be modified.
121 The syntax is
122 .Pp
123 \fBoptions\fP \fIoption\fP \fI...\fP
124 .Pp
125 where
126 .Sy option
127 is one of the following:
128 .Bl -tag -width no_tld_query
129 .It Sy debug
130 sets
131 .Dv RES_DEBUG
132 in _res.options.
133 .It Sy usevc
134 sets
135 .Dv RES_USEVC
136 to use TCP instead of UDP for queries.
137 .It Sy ndots : Ns Ar n
138 sets a threshold for the number of dots which must appear in a name given to
139 .Fn res_query
140 (see
141 .Xr resolver 3 )
142 before an
143 .Em initial absolute query
144 will be made.
145 The default for
146 .Em n
147 is
148 .Dq 1 ,
149 meaning that if there are any dots in a name, the name
150 will be tried first as an absolute name before any
151 .Em search list
152 elements are appended to it.
153 .It Sy timeout : Ns Ar n
154 sets the initial amount of time the resolver will wait
155 for a response from a remote
156 name server before retrying the query via a different name server.
157 The resolver may wait longer during subsequent retries
158 of the current query since an exponential back-off is applied to
159 the timeout value.
160 Measured in seconds, the default is
161 .Dv RES_TIMEOUT ,
162 the allowed maximum is
163 .Dv RES_MAXRETRANS
164 (see
165 .In resolv.h ) .
166 .It Sy attempts : Ns Ar n
167 sets the number of times the resolver will send a query to each of
168 its name servers
169 before giving up and returning an error to the calling application.
170 The default is
171 .Dv RES_DFLRETRY ,
172 the allowed maximum is
173 .Dv RES_MAXRETRY
174 (see
175 .In resolv.h ) .
176 .It Sy no_tld_query
177 tells the resolver not to attempt to resolve a top level domain name, that
178 is, a name that contains no dots.
179 Use of this option does not prevent
180 the resolver from obeying the standard
181 .Sy domain
182 and
183 .Sy search
184 rules with the given name.
185 .It Sy reload-period : Ns Ar n
186 The resolver checks the modification time of
187 .Pa /etc/resolv.conf
188 every
189 .Ar n
190 seconds.
191 If
192 .Pa /etc/resolv.conf
193 has changed, it is automatically reloaded.
194 The default for
195 .Ar n
196 is two seconds.
197 Setting it to zero disables the file check.
198 .El
199 .Pp
200 Options may also be specified as a space or tab separated list using the
201 .Dv RES_OPTIONS
202 environment variable.
203 .El
204 .Pp
205 The
206 .Sy domain
207 and
208 .Sy search
209 keywords are mutually exclusive.
210 If more than one instance of these keywords is present,
211 the last instance will override.
212 .Pp
213 The keyword and value must appear on a single line, and the keyword
214 .Pq for example, Sy nameserver
215 must start the line.
216 The value follows the keyword, separated by white space.
217 .Sh FILES
218 .Bl -tag -width /etc/resolv.conf -compact
219 .It Pa /etc/resolv.conf
220 The file
221 .Nm resolv.conf
222 resides in
223 .Pa /etc .
224 .El
225 .Sh EXAMPLES
226 A basic resolv.conf file could be in the following form.
227 .Bd -literal -offset indent
228 # The domain directive is only necessary, if your local
229 # router advertises something like localdomain and you have
230 # set up your hostnames via an external domain.
231 domain localdomain.tld
232
233 # In case you a running a local dns server or caching name server
234 # like local-unbound(8) for example.
235 nameserver 127.0.0.1
236
237 # IP address of the local or ISP name service
238 nameserver 192.168.2.1
239
240 # Fallback nameservers, in this case these from Google.
241 nameserver 8.8.8.8
242 nameserver 4.4.4.4
243
244 # Attach an OPT pseudo-RR for the EDNS0 extension,
245 # as specified in RFC 2671.
246 options edns0
247 .Ed
248 .Sh SEE ALSO
249 .Xr gethostbyname 3 ,
250 .Xr resolver 3 ,
251 .Xr hostname 7 ,
252 .Xr resolvconf 8
253 .Sh HISTORY
254 The
255 .Nm resolv.conf
256 file format appeared in
257 .Bx 4.3 .