xref: /openbsd/share/man/man5/resolv.conf.5 (revision f2dfb0a4)
1.\"	$OpenBSD: resolv.conf.5,v 1.5 1998/05/11 23:08:24 deraadt 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. All advertising materials mentioning features or use of this software
16.\"    must display the following acknowledgement:
17.\"	This product includes software developed by the University of
18.\"	California, Berkeley and its contributors.
19.\" 4. Neither the name of the University nor the names of its contributors
20.\"    may be used to endorse or promote products derived from this software
21.\"    without specific prior written permission.
22.\"
23.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33.\" SUCH DAMAGE.
34.\"
35.\"     @(#)resolver.5	5.12 (Berkeley) 5/10/91
36.\"
37.Dd May 10, 1991
38.Dt RESOLV.CONF 5
39.Os BSD 4
40.Sh NAME
41.Nm resolv.conf
42.Nd resolver configuration file
43.Sh DESCRIPTION
44The
45.Nm resolv.conf
46file specifies how the
47.Xr resolver 3
48routines in the C library
49(which provide access to the Internet Domain Name System) should operate.
50The resolver configuration file contains information that is read
51by the resolver routines the first time they are invoked by a process.
52The file is designed to be human readable and contains a list of
53keywords with values that provide various types of resolver information.
54.Pp
55On a normally configured system this file should not be necessary.
56The only name server to be queried will be on the local machine,
57the domain name is determined from the host name,
58and the domain search path is constructed from the domain name.
59.Pp
60The different configuration options are:
61.Bl -tag -width nameserver
62.It Sy nameserver
63Internet address (in dot notation) of a name server
64that the resolver should query.
65Up to
66.Dv MAXNS
67(currently 3) name servers may be listed,
68one per keyword.
69If there are multiple servers,
70the resolver library queries them in the order listed.
71If no
72.Sy nameserver
73entries are present,
74the default is to use the name server on the local machine.
75(The algorithm used is to try a name server, and if the query times out,
76try the next, until out of name servers,
77then repeat trying all the name servers
78until a maximum number of retries are made).
79.It Sy domain
80Local domain name.
81Most queries for names within this domain can use short names
82relative to the local domain.
83If no
84.Sy domain
85entry is present, the domain is determined
86from the local host name returned by
87.Xr gethostname 3 ;
88the domain part is taken to be everything after the first `.'.
89Finally, if the host name does not contain a domain part, the root
90domain is assumed.
91.It Sy lookup
92This keyword is used by the library routines
93.Xr gethostbyname 3
94and
95.Xr gethostbyaddr 3 .
96It specifies which databases should be searched,
97and the order to do so.
98The legal space-separated values are
99.Bl -tag -width bind
100.It Sy bind
101use the Domain Name server by querying the
102.Xr named 8
103.It Sy file
104search for entries in
105.Nm /etc/hosts
106.It Sy yp
107talk to the YP system if
108.Xr ypbind 8
109is running
110.El
111.Pp
112If the
113.Sy lookup
114keyword is not used in the system's
115.Pa resolv.conf
116file then the assumed order is
117.Sy bind file .
118Furthermore, if the system's
119.Pa resolv.conf
120file does not exist, then the only database used is
121.Sy file .
122.Pp
123.It Sy search
124Search list for host-name lookup.
125The search list is normally determined from the local domain name;
126by default, it begins with the local domain name, then successive
127parent domains that have at least two components in their names.
128This may be changed by listing the desired domain search path
129following the
130.Sy search
131keyword with spaces or tabs separating
132the names.
133Most resolver queries will be attempted using each component
134of the search path in turn until a match is found.
135Note that this process may be slow and will generate a lot of network
136traffic if the servers for the listed domains are not local,
137and that queries will time out if no server is available
138for one of the domains.
139.Pp
140The search list is currently limited to six domains
141with a total of 1024 characters.
142.It Sy sortlist
143Sortlist allows addresses returned by gethostbyname to
144be sorted.
145A sortlist is specified by IP address netmask pairs.
146The netmask is optional and defaults to the natural
147netmask of the net.
148The IP address and optional network pairs are seperated by
149slashes.
150Up to 10 pairs may be specified, ie.
151.Pp
152.Sy sortlist 130.155.160.0/255.255.240.0 130.155.0.0
153.It Sy options
154Options allows certain internal resolver variables to be modified.
155The syntax is:
156.Pp
157.Sy options option ...
158.Pp
159where option is one of the following:
160.Bl -tag -width ndots:n
161.It Sy debug
162sets RES_DEBUG in _res.options.
163.It Sy inet6
164enable support for IPv6 addresses, by setting RES_USE_INET6 in
165_res.options (see
166.Xr resolver 3 ).
167.It Sy ndots:n
168sets a threshold for the number of dots which
169must appear in a name given to res_query (see
170.Xr resolver 3 )
171before an initial absolute query will be made.
172The default for n is 1, meaning that if there are any
173dots in a name, the name will be tried first as an absolute
174name before any search list elements are appended to it.
175.El
176.El
177.Pp
178The
179.Sy domain
180and
181.Sy search
182keywords are mutually exclusive.
183If more than one instance of these keywords is present,
184the last instance will override.
185.Pp
186The
187.Sy search
188keyword of a system's
189.Pa resolv.conf
190file can be overridden on a per-process basis by setting the
191environment variable
192.Ev LOCALDOMAIN
193to a space-separated list of search domains.
194.Pp
195The
196.Sy options
197keyword of a system's
198.Pa resolv.conf
199file can be amended on a per-process basis by setting the
200environment variable
201.Ev RES_OPTIONS
202to a space-separated list of resolver options as explained above.
203.Pp
204The keyword and value must appear on a single line, and the keyword
205(e.g.
206.Sy nameserver )
207must start the line.  The value follows
208the keyword, separated by white space.
209.Sh FILES
210.Bl -tag -width /etc/resolv.conf -compact
211.It Pa /etc/resolv.conf
212The file
213.Nm resolv.conf
214resides in
215.Pa /etc .
216.El
217.Sh SEE ALSO
218.Xr gethostbyname 3 ,
219.Xr resolver 3 ,
220.Xr hostname 7 ,
221.Xr hosts 5 ,
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