1.\" Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
2.\"
3.\" Permission to use, copy, modify, and distribute this software for any
4.\" purpose with or without fee is hereby granted, provided that the above
5.\" copyright notice and this permission notice appear in all copies.
6.\"
7.\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
8.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9.\" MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR
10.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
13.\" OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14.\"
15.\" Copyright (c) 1986 The Regents of the University of California.
16.\" All rights reserved.
17.\"
18.\" Redistribution and use in source and binary forms are permitted
19.\" provided that the above copyright notice and this paragraph are
20.\" duplicated in all such forms and that any documentation,
21.\" advertising materials, and other materials related to such
22.\" distribution and use acknowledge that the software was developed
23.\" by the University of California, Berkeley.  The name of the
24.\" University may not be used to endorse or promote products derived
25.\" from this software without specific prior written permission.
26.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
27.\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
28.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29.\"
30.\"	@(#)resolver.5	5.9 (Berkeley) 12/14/89
31.\"	Id: resolver.man5,v 1.2 2009/01/21 00:12:34 each Exp
32.\"
33.Dd November 11, 1993
34.Dt RESOLVER 5
35.Os BSD 4
36.Sh NAME
37.Nm resolver
38.Nd resolver configuration file
39.Sh SYNOPSIS
40.Pa /etc/resolv.conf
41.Sh DESCRIPTION
42The
43.Nm resolver
44is a set of routines in the C library
45.Pq Xr resolve 3
46that provide access to the Internet Domain Name System.
47The
48.Nm resolver
49configuration file contains information that is read
50by the
51.Nm resolver
52routines the first time they are invoked by a process.
53The file is designed to be human readable and contains a list of
54keywords with values that provide various types of
55.Nm resolver
56information.
57.Pp
58On a normally configured system, this file should not be necessary.
59The only name server to be queried will be on the local machine,
60the domain name is determined from the host name,
61and the domain search path is constructed from the domain name.
62.Pp
63The different configuration directives are:
64.Bl -tag -width "nameser"
65.It Li nameserver
66Internet address (in dot notation) of a name server that the
67.Nm resolver
68should query.  Up to
69.Dv MAXNS
70(see
71.Pa <resolv.h> )
72name servers may be listed, one per keyword.
73If there are multiple servers, the
74.Nm resolver
75library queries them in the order listed.
76If no
77.Li nameserver
78entries are present, the default is to use the name server on the local machine.
79(The algorithm used is to try a name server, and if the query times out,
80try the next, until out of name servers,
81then repeat trying all the name servers
82until a maximum number of retries are made).
83.It Li domain
84Local domain name.
85Most queries for names within this domain can use short names
86relative to the local domain.
87If no
88.Li domain
89entry is present, the domain is determined from the local host name returned by
90.Xr gethostname  ;
91the domain part is taken to be everything after the first
92.Sq \&. .
93Finally, if the host name does not contain a domain part, the root
94domain is assumed.
95.It Li search
96Search list for host-name lookup.
97The search list is normally determined from the local domain name;
98by default, it contains only the local domain name.
99This may be changed by listing the desired domain search path
100following the
101.Li search
102keyword with spaces or tabs separating the names.
103Most
104.Nm resolver
105queries will be attempted using each component
106of the search path in turn until a match is found.
107Note that this process may be slow and will generate a lot of network
108traffic if the servers for the listed domains are not local,
109and that queries will time out if no server is available
110for one of the domains.
111.Pp
112The search list is currently limited to six domains
113with a total of 256 characters.
114.It Li sortlist
115Allows addresses returned by gethostbyname to be sorted.
116A
117.Li sortlist
118is specified by IP address netmask pairs. The netmask is
119optional and defaults to the natural netmask of the net. The IP address
120and optional network pairs are separated by slashes. Up to 10 pairs may
121be specified.  For example:
122.Bd -literal -offset indent
123sortlist 130.155.160.0/255.255.240.0 130.155.0.0
124.Ed
125.It Li options
126Allows certain internal
127.Nm resolver
128variables to be modified.
129The syntax is
130.D1 Li options Ar option ...
131where
132.Ar option
133is one of the following:
134.Bl -tag -width "ndots:n "
135.It Li debug
136sets
137.Dv RES_DEBUG
138in
139.Ft _res.options .
140.It Li ndots: Ns Ar n
141sets a threshold for the number of dots which
142must appear in a name given to
143.Fn res_query
144(see
145.Xr resolver 3 )
146before an
147.Em initial absolute query
148will be made.  The default for
149.Ar n
150is
151.Dq 1 ,
152meaning that if there are
153.Em any
154dots in a name, the name will be tried first as an absolute name before any
155.Em search list
156elements are appended to it.
157.It Li timeout: Ns Ar n
158sets the amount of time the resolver will wait for a response from a remote
159name server before retrying the query via a different name server.  Measured in
160seconds, the default is
161.Dv RES_TIMEOUT
162(see
163.Pa <resolv.h> ) .
164.It Li attempts: Ns Ar n
165sets the number of times the resolver will send a query to its name servers
166before giving up and returning an error to the calling application.  The
167default is
168.Dv RES_DFLRETRY
169(see
170.Pa <resolv.h> ) .
171.It Li rotate
172sets
173.Dv RES_ROTATE
174in
175.Ft _res.options ,
176which causes round robin selection of nameservers from among those listed.
177This has the effect of spreading the query load among all listed servers,
178rather than having all clients try the first listed server first every time.
179.It Li no-check-names
180sets
181.Dv RES_NOCHECKNAME
182in
183.Ft _res.options ,
184which disables the modern BIND checking of incoming host names and mail names
185for invalid characters such as underscore (_), non-ASCII, or control characters.
186.It Li inet6
187sets
188.Dv RES_USE_INET6
189in
190.Ft _res.options .
191This has the effect of trying a AAAA query before an A query inside the
192.Ft gethostbyname
193function, and of mapping IPv4 responses in IPv6 ``tunnelled form'' if no
194AAAA records are found but an A record set exists.
195.It Li no-tld-query
196sets
197.Dv RES_NOTLDQUERY
198in
199.Ft _res.options .
200This option causes
201.Fn res_nsearch
202to not attempt to resolve a unqualified name as if it were a top level
203domain (TLD).
204This option can cause problems if the site has "localhost" as a TLD rather
205than having localhost on one or more elements of the search list.
206This option has no effect if neither
207.Dv RES_DEFNAMES
208or
209.Dv RES_DNSRCH
210is set.
211.El
212.El
213.Pp
214The
215.Li domain
216and
217.Li search
218keywords are mutually exclusive.
219If more than one instance of these keywords is present,
220the last instance wins.
221.Pp
222The
223.Li search
224keyword of a system's
225.Pa resolv.conf
226file can be
227overridden on a per-process basis by setting the environment variable
228.Dq Ev LOCALDOMAIN
229to a space-separated list of search domains.
230.Pp
231The
232.Li options
233keyword of a system's
234.Pa resolv.conf
235file can be amended on a per-process basis by setting the environment variable
236.Dq Ev RES_OPTIONS to a space-separated list of
237.Nm resolver
238options as explained above under
239.Li options .
240.Pp
241The keyword and value must appear on a single line, and the keyword
242(e.g.,
243.Li nameserver )
244must start the line.  The value follows the keyword, separated by white space.
245.Sh FILES
246.Pa /etc/resolv.conf
247.Pa <resolv.h>
248.Sh SEE ALSO
249.Xr gethostbyname 3 ,
250.Xr hostname 7 ,
251.Xr resolver 3 ,
252.Xr resolver 5 .
253.Dq Name Server Operations Guide for Sy BIND
254