xref: /netbsd-src/share/man/man5/resolv.conf.5 (revision 4d7e773266e3c3f48566c86c0ad52d51c6454fd1)
1.\"	$NetBSD: resolv.conf.5,v 1.9 1997/07/14 01:49:25 mikel 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 May 10, 1991
37.Dt RESOLV.CONF 5
38.Os BSD 4
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
62Internet address (in dot notation) of a name server
63that the resolver should query.
64Up to
65.Dv MAXNS
66(currently 3) name servers may be listed,
67one per keyword.
68If there are multiple servers,
69the resolver library queries them in the order listed.
70If no
71.Sy nameserver
72entries are present,
73the 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,
76then repeat trying all the name servers
77until a maximum number of retries are made).
78.It Sy domain
79Local domain name.
80Most queries for names within this domain can use short names
81relative to the local domain.
82If no
83.Sy domain
84entry is present, the domain is determined
85from the local host name returned by
86.Xr gethostname 3 ;
87the domain part is taken to be everything after the first `.'.
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,
96and the order to do so.
97The legal space-separated values are
98.Bl -tag -width bind
99.It Sy bind
100use the Domain Name server by querying the
101.Xr named 8
102.It Sy file
103search for entries in
104.Nm /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 host-name 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
128following the
129.Sy search
130keyword with spaces or tabs separating
131the names.
132Most resolver queries will be attempted using each component
133of the search path in turn until a match is found.
134Note that this process may be slow and will generate a lot of network
135traffic if the servers for the listed domains are not local,
136and that queries will time out if no server is available
137for one of the domains.
138.Pp
139The search list is currently limited to six domains
140with a total of 1024 characters.
141.It Sy sortlist
142Sortlist allows addresses returned by gethostbyname to
143be sorted.
144A sortlist is specified by IP address netmask pairs.
145The netmask is optional and defaults to the natural
146netmask of the net.
147The IP address and optional network pairs are seperated by
148slashes.
149Up to 10 pairs may be specified, ie.
150.Pp
151.Sy sortlist 130.155.160.0/255.255.240.0 130.155.0.0
152.It Sy options
153Options allows certain internal resolver variables to be modified.
154The syntax is:
155.Pp
156.Sy options option ...
157.Pp
158where option is one of the following:
159.Bl -tag -width ndots:n
160.It Sy debug
161enable debugging information, by setting RES_DEBUG in _res.options
162(see
163.Xr resolver 3 ).
164.It Sy inet6
165enable support for IPv6 addresses, by setting RES_USE_INET6 in
166_res.options (see
167.Xr resolver 3 ).
168.It Sy ndots:n
169sets a threshold for the number of dots which
170must appear in a name given to res_query (see
171.Xr resolver 3 )
172before an initial absolute query will be made.
173The default for n is 1, meaning that if there are any
174dots in a name, the name will be tried first as an absolute
175name before any search list elements are appended to it.
176.El
177.El
178.Pp
179The
180.Sy domain
181and
182.Sy search
183keywords are mutually exclusive.
184If more than one instance of these keywords is present,
185the last instance will override.
186.Pp
187The
188.Sy search
189keyword of a system's
190.Pa resolv.conf
191file can be overridden on a per-process basis by setting the
192environment variable
193.Ev LOCALDOMAIN
194to a space-separated list of search domains.
195.Pp
196The
197.Sy options
198keyword of a system's
199.Pa resolv.conf
200file can be amended on a per-process basis by setting the
201environment variable
202.Ev RES_OPTIONS
203to a space-separated list of resolver options as explained above.
204.Pp
205The keyword and value must appear on a single line, and the keyword
206(e.g.
207.Sy nameserver )
208must start the line.  The value follows
209the keyword, separated by white space.
210.Sh FILES
211.Bl -tag -width /etc/resolv.conf -compact
212.It Pa /etc/resolv.conf
213The file
214.Nm resolv.conf
215resides in
216.Pa /etc .
217.El
218.Sh SEE ALSO
219.Xr gethostbyname 3 ,
220.Xr resolver 3 ,
221.Xr hostname 7 ,
222.Xr named 8
223.Rs
224.%T "Name Server Operations Guide for BIND"
225.Re
226.Sh HISTORY
227The
228.Nm resolv.conf
229file format appeared in
230.Bx 4.3 .
231