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