xref: /openbsd-src/share/man/man5/resolv.conf.5 (revision 8500990981f885cbe5e6a4958549cacc238b5ae6)
1.\"	$OpenBSD: resolv.conf.5,v 1.22 2003/08/08 09:51:54 jmc Exp $
2.\"	$NetBSD: resolv.conf.5,v 1.7 1996/03/06 18:22:16 scottr Exp $
3.\"
4.\" Copyright (c) 1986, 1991 The Regents of the University of California.
5.\" All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\" 3. Neither the name of the University nor the names of its contributors
16.\"    may be used to endorse or promote products derived from this software
17.\"    without specific prior written permission.
18.\"
19.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29.\" SUCH DAMAGE.
30.\"
31.\"     @(#)resolver.5	5.12 (Berkeley) 5/10/91
32.\"
33.Dd May 10, 1991
34.Dt RESOLV.CONF 5
35.Os
36.Sh NAME
37.Nm resolv.conf
38.Nd resolver configuration file
39.Sh DESCRIPTION
40The
41.Nm
42file specifies how the
43.Xr resolver 3
44routines in the C library
45(which provide access to the Internet Domain Name System) should operate.
46The resolver configuration file contains information that is read
47by the resolver routines the first time they are invoked by a process.
48The file is designed to be human readable and contains a list of
49keywords with values that provide various types of resolver information.
50.Pp
51On a normally configured system this file should not be necessary.
52The only name server to be queried will be on the local machine,
53the domain name is determined from the host name,
54and the domain search path is constructed from the domain name.
55.Pp
56The different configuration options are:
57.Bl -tag -width nameserver
58.It Sy nameserver
59IPv4 address (in dot notation)
60or IPv6 address (in hex-and-colon notation)
61of a name server that the resolver should query.
62Scoped IPv6 address notation is accepted as well
63(see
64.Xr inet6 4
65for details).
66Up to
67.Dv MAXNS
68(currently 3) name servers may be listed, one per keyword.
69If there are multiple servers, the resolver library queries them in the
70order listed.
71If no
72.Sy nameserver
73entries are present, the default is to use the name server on the local machine.
74(The algorithm used is to try a name server, and if the query times out,
75try the next, until out of name servers, then repeat trying all name servers
76until a maximum number of retries are performed.)
77.It Sy domain
78Local domain name.
79Most queries for names within this domain can use short names
80relative to the local domain.
81If no
82.Sy domain
83entry is present, the domain is determined
84from the local host name returned by
85.Xr gethostname 3 ;
86the domain part is taken to be everything after the first
87.Dq \&. .
88Finally, if the host name does not contain a domain part, the root
89domain is assumed.
90.It Sy lookup
91This keyword is used by the library routines
92.Xr gethostbyname 3
93and
94.Xr gethostbyaddr 3 .
95It specifies which databases should be searched, and the order to do so.
96The legal space-separated values are:
97.Pp
98.Bl -tag -width bind -compact
99.It Sy bind
100Use the Domain Name server by querying
101.Xr named 8 .
102.It Sy file
103Search for entries in
104.Pa /etc/hosts .
105.It Sy yp
106Talk to the YP system if
107.Xr ypbind 8
108is running.
109.El
110.Pp
111If the
112.Sy lookup
113keyword is not used in the system's
114.Pa resolv.conf
115file then the assumed order is
116.Sy bind file .
117Furthermore, if the system's
118.Pa resolv.conf
119file does not exist, then the only database used is
120.Sy file .
121.Pp
122.It Sy search
123Search list for hostname lookup.
124The search list is normally determined from the local domain name;
125by default, it begins with the local domain name, then successive
126parent domains that have at least two components in their names.
127This may be changed by listing the desired domain search path following the
128.Sy search
129keyword with spaces or tabs separating the names.
130Most resolver queries will be attempted using each component
131of the search path in turn until a match is found.
132Note that this process may be slow and will generate a lot of network
133traffic if the servers for the listed domains are not local,
134and that queries will time out if no server is available
135for one of the domains.
136.Pp
137The search list is currently limited to six domains
138with a total of 1024 characters.
139.It Sy sortlist
140Allows addresses returned by
141.Xr gethostbyname 3
142to be sorted.
143A
144.Sy sortlist
145is specified by IP address netmask pairs.
146The netmask is optional and defaults to the natural netmask of the net.
147The IP address and optional network pairs are separated by slashes.
148Up to 10 pairs may be specified, e.g.:
149.Pp
150.Sy sortlist 130.155.160.0/255.255.240.0 130.155.0.0
151.It Sy options
152Allows certain internal resolver variables to be modified.
153The syntax is:
154.Pp
155.Sy options option ...
156.Pp
157where option is one of the following:
158.Bl -tag -width insecure1
159.It Sy debug
160Sets RES_DEBUG in _res.options.
161.It Sy edns0
162attach OPT pseudo-RR for ENDS0 extension specified in RFC 2671,
163to inform DNS server of our receive buffer size.
164The option will allow DNS servers to take advantage of non-default receive
165buffer size, and to send larger replies.
166DNS query packets with EDNS0 extension are not compatible with
167non-EDNS0 DNS servers.
168The option must be used only when all the DNS servers listed in
169.Sy nameserver
170lines are able to handle EDNS0 extension.
171.It Sy inet6
172Enables support for IPv6-only applications, by setting RES_USE_INET6 in
173_res.options (see
174.Xr resolver 3 ) .
175Use of this option is discouraged, and meaningless on
176.Ox .
177.It Sy insecure1
178Do not require IP source address on the reply packet to be equal to the
179server's address.
180.It Sy insecure2
181Do not check if the query section of the reply packet is equal
182to that of the query packet.
183For testing purposes only.
184.It Sy ndots:n
185Sets a threshold for the number of dots which
186must appear in a name given to res_query (see
187.Xr resolver 3 )
188before an initial absolute query will be made.
189The default for
190.Ar n
191is 1, meaning that if there are any dots in a name, the name will be tried
192first as an absolute name before any search list elements are appended to it.
193.El
194.El
195.Pp
196The
197.Sy domain
198and
199.Sy search
200keywords are mutually exclusive.
201If more than one instance of these keywords is present, the last instance
202will override.
203.Pp
204The
205.Sy search
206keyword of a system's
207.Pa resolv.conf
208file can be overridden on a per-process basis by setting the
209environment variable
210.Ev LOCALDOMAIN
211to a space-separated list of search domains.
212.Pp
213The
214.Sy options
215keyword of a system's
216.Pa resolv.conf
217file can be amended on a per-process basis by setting the
218environment variable
219.Ev RES_OPTIONS
220to a space-separated list of resolver options as explained above.
221.Pp
222The keyword and value must appear on a single line, and the keyword (e.g.,
223.Sy nameserver )
224must start the line.
225The value follows the keyword, separated by whitespace.
226.Sh FILES
227.Bl -tag -width /etc/resolv.conf -compact
228.It Pa /etc/resolv.conf
229.El
230.Sh SEE ALSO
231.Xr gethostbyname 3 ,
232.Xr resolver 3 ,
233.Xr hosts 5 ,
234.Xr hostname 7 ,
235.Xr named 8
236.Rs
237.%T "Name Server Operations Guide for BIND"
238.Re
239.Sh HISTORY
240The
241.Nm
242file format appeared in
243.Bx 4.3 .
244.Sh BUGS
245Due to resolver internal issues,
246.Xr getaddrinfo 3
247may not behave as
248.Sy lookup
249suggests.
250Consequently, userland programs that use
251.Xr getaddrinfo 3
252may behave differently from what
253.Sy lookup
254says.
255