1.\" $OpenBSD: resolv.conf.5,v 1.15 2001/06/11 10:06:04 itojun 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 40.Sh NAME 41.Nm resolv.conf 42.Nd resolver configuration file 43.Sh DESCRIPTION 44The 45.Nm 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 63IPv4 address (in dot notation) 64or IPv6 address (in hex-and-colon notation) 65of a name server that the resolver should query. 66Scoped IPv6 address notation is accepted as well 67(see 68.Xr inet6 4 69for details). 70Up to 71.Dv MAXNS 72(currently 3) name servers may be listed, one per keyword. 73If there are multiple servers, the resolver library queries them in the 74order listed. 75If no 76.Sy nameserver 77entries are present, the default is to use the name server on the local machine. 78(The algorithm used is to try a name server, and if the query times out, 79try the next, until out of name servers, then repeat trying all name servers 80until a maximum number of retries are performed.) 81.It Sy domain 82Local domain name. 83Most queries for names within this domain can use short names 84relative to the local domain. 85If no 86.Sy domain 87entry is present, the domain is determined 88from the local host name returned by 89.Xr gethostname 3 ; 90the domain part is taken to be everything after the first 91.Dq \&. . 92Finally, if the host name does not contain a domain part, the root 93domain is assumed. 94.It Sy lookup 95This keyword is used by the library routines 96.Xr gethostbyname 3 97and 98.Xr gethostbyaddr 3 . 99It specifies which databases should be searched, and the order to do so. 100The legal space-separated values are: 101.Pp 102.Bl -tag -width bind -compact 103.It Sy bind 104Use the Domain Name server by querying 105.Xr named 8 . 106.It Sy file 107Search for entries in 108.Pa /etc/hosts . 109.It Sy yp 110Talk to the YP system if 111.Xr ypbind 8 112is running. 113.El 114.Pp 115If the 116.Sy lookup 117keyword is not used in the system's 118.Pa resolv.conf 119file then the assumed order is 120.Sy bind file . 121Furthermore, if the system's 122.Pa resolv.conf 123file does not exist, then the only database used is 124.Sy file . 125.Pp 126.It Sy search 127Search list for hostname lookup. 128The search list is normally determined from the local domain name; 129by default, it begins with the local domain name, then successive 130parent domains that have at least two components in their names. 131This may be changed by listing the desired domain search path following the 132.Sy search 133keyword with spaces or tabs separating the names. 134Most resolver queries will be attempted using each component 135of the search path in turn until a match is found. 136Note that this process may be slow and will generate a lot of network 137traffic if the servers for the listed domains are not local, 138and that queries will time out if no server is available 139for one of the domains. 140.Pp 141The search list is currently limited to six domains 142with a total of 1024 characters. 143.It Sy sortlist 144Allows addresses returned by 145.Xr gethostbyname 3 146to be sorted. 147A 148.Sy sortlist 149is specified by IP address netmask pairs. 150The netmask is optional and defaults to the natural netmask of the net. 151The IP address and optional network pairs are separated by slashes. 152Up to 10 pairs may be specified, i.e.: 153.Pp 154.Sy sortlist 130.155.160.0/255.255.240.0 130.155.0.0 155.It Sy options 156Allows certain internal resolver variables to be modified. 157The syntax is: 158.Pp 159.Sy options option ... 160.Pp 161where option is one of the following: 162.Bl -tag -width ndots:n 163.It Sy debug 164Sets RES_DEBUG in _res.options. 165.It Sy edns0 166attach OPT pseudo-RR for ENDS0 extension specified in RFC2671, 167to inform DNS server of our receive buffer size. 168The option will allow DNS servers to take advantage of non-default receive 169buffer size, and to send larger replies. 170DNS query packets with EDNS0 extension is not compatible with 171non-EDNS0 DNS servers. 172The option must be used only when all the DNS servers listed in 173.Sy nameserver 174lines are able to handle EDNS0 extension. 175.It Sy inet6 176enable support for IPv6-only applications, by setting RES_USE_INET6 in 177_res.options (see 178.Xr resolver 3 ). 179The option is meaningful with certain kernel configuration only and 180use of this options is discourated. 181.It Sy inet6 182Enables support for IPv6-only applications, by setting RES_USE_INET6 in 183_res.options (see 184.Xr resolver 3 ) . 185Use of this option is discouraged, and meaningless on 186.Ox . 187.It Sy ndots:n 188Sets a threshold for the number of dots which 189must appear in a name given to res_query (see 190.Xr resolver 3 ) 191before an initial absolute query will be made. 192The default for 193.Ar n 194is 1, meaning that if there are any dots in a name, the name will be tried 195first as an absolute name before any search list elements are appended to it. 196.El 197.El 198.Pp 199The 200.Sy domain 201and 202.Sy search 203keywords are mutually exclusive. 204If more than one instance of these keywords is present, the last instance 205will override. 206.Pp 207The 208.Sy search 209keyword of a system's 210.Pa resolv.conf 211file can be overridden on a per-process basis by setting the 212environment variable 213.Ev LOCALDOMAIN 214to a space-separated list of search domains. 215.Pp 216The 217.Sy options 218keyword of a system's 219.Pa resolv.conf 220file can be amended on a per-process basis by setting the 221environment variable 222.Ev RES_OPTIONS 223to a space-separated list of resolver options as explained above. 224.Pp 225The keyword and value must appear on a single line, and the keyword (e.g., 226.Sy nameserver ) 227must start the line. 228The value follows the keyword, separated by whitespace. 229.Sh FILES 230.Bl -tag -width /etc/resolv.conf -compact 231.It Pa /etc/resolv.conf 232.El 233.Sh SEE ALSO 234.Xr gethostbyname 3 , 235.Xr resolver 3 , 236.Xr hosts 5 , 237.Xr hostname 7 , 238.Xr named 8 239.Rs 240.%T "Name Server Operations Guide for BIND" 241.Re 242.Sh HISTORY 243The 244.Nm 245file format appeared in 246.Bx 4.3 . 247.Sh BUGS 248Due to resolver internal issues, 249.Xr getaddrinfo 3 250may not behave as 251.Sy lookup 252suggests. 253Consequently, userland programs that use 254.Xr getaddrinfo 3 255may behave differently from what 256.Sy lookup 257says. 258