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