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