1.\" $OpenBSD: resolv.conf.5,v 1.44 2013/07/14 19:44:39 jmc 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. Neither the name of the University nor the names of its contributors 16.\" may be used to endorse or promote products derived from this software 17.\" without specific prior written permission. 18.\" 19.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 23.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29.\" SUCH DAMAGE. 30.\" 31.\" @(#)resolver.5 5.12 (Berkeley) 5/10/91 32.\" 33.Dd $Mdocdate: July 14 2013 $ 34.Dt RESOLV.CONF 5 35.Os 36.Sh NAME 37.Nm resolv.conf , resolv.conf.tail 38.Nd resolver configuration files 39.Sh DESCRIPTION 40The 41.Nm 42file specifies how the 43.Xr resolver 3 44routines in the C library 45(which provide access to the Internet Domain Name System) should operate. 46The resolver configuration file contains information that is read 47by the resolver routines the first time they are invoked by a process. 48If the 49.Nm resolv.conf 50file does not exist, only the local host file 51.Pa /etc/hosts 52will be consulted, 53i.e. the Domain Name System will not be used to resolve hosts. 54.Pp 55The file is designed to be human readable and contains a list of 56keywords with values that provide various types of resolver information. 57A resolv.conf file is not required for some setups, so this file is optional. 58It can be created manually, and is also created as part of the 59.Ox 60install process 61if use of the DHCP protocol is specified for any interface 62or if any DNS nameservers are configured. 63.Pp 64If 65.Xr dhclient 8 66is used to configure the network it 67will normally overwrite the 68.Nm resolv.conf 69file with updated information such as nameserver addresses, 70losing any previous values the file contained. 71In order to force options to be passed to the 72.Xr resolver 3 73routines, the file 74.Nm resolv.conf.tail 75may be created manually. 76This file will be appended to the generated 77.Nm resolv.conf 78file by dhclient, 79ensuring options remain. 80If no updated information is available to dhclient, 81and 82.Nm resolv.conf.tail 83is not present, then 84.Nm resolv.conf 85will not be modified by dhclient. 86.Pp 87On a machine whose network connection does not change frequently (such as a desktop 88machine on a local-area network), the 89.Nm resolv.conf.tail 90file should not be necessary. 91However the 92.Nm resolv.conf.tail 93file may be useful on notebooks, to search multiple domains, 94to refer to hard-coded information in local files, or otherwise 95override the defaults. 96.Pp 97A keyword and its values must appear on a single line, and the keyword (e.g.\& 98.Cm nameserver ) 99must start the line. 100The value follows the keyword, separated by whitespace. 101A hash mark 102.Pq # 103or semicolon 104.Pq \&; 105in the file indicates the beginning of a comment; 106subsequent characters up to the end of the line are not interpreted by 107the routines that read the file. 108.Pp 109The configuration options (which may be placed in either file) are: 110.Bl -tag -width nameserver 111.It Cm nameserver 112IPv4 address (in dot notation) 113or IPv6 address (in hex-and-colon notation) 114of a name server that the resolver should query. 115Scoped IPv6 address notation is accepted as well 116(see 117.Xr inet6 4 118for details). 119A non-standard port may also be specified, 120with the host address enclosed in square brackets. 121For example: 122.Bd -literal -offset indent 123nameserver [10.0.0.1]:5353 124nameserver [::1]:5353 125.Ed 126.Pp 127Up to 128.Dv MAXNS 129(currently 3) name servers may be listed, one per line. 130If there are multiple servers, the resolver library queries them in the 131order listed. 132If no 133.Cm nameserver 134entries are present, the default is to use the name server on the local machine. 135(The algorithm used is to try a name server, and if the query times out, 136try the next, until out of name servers, then repeat trying all name servers 137until a maximum number of retries are performed.) 138.It Cm domain 139Local domain name. 140Most queries for names within this domain can use short names 141relative to the local domain. 142If no 143.Cm domain 144entry is present, the domain is determined 145from the local host name returned by 146.Xr gethostname 3 \(en 147the domain part is taken to be everything after the first dot. 148Finally, if the host name does not contain a domain part, the root 149domain is assumed. 150.It Cm lookup 151This keyword is used by the library routines 152.Xr gethostbyname 3 153and 154.Xr gethostbyaddr 3 . 155It specifies which databases should be searched, and the order to do so. 156The legal space-separated values are: 157.Pp 158.Bl -tag -width bind -offset indent -compact 159.It Cm bind 160Query a domain name server. 161.It Cm file 162Search for entries in 163.Pa /etc/hosts . 164.It Cm yp 165Talk to the YP system if 166.Xr ypbind 8 167is running. 168.El 169.Pp 170If the 171.Cm lookup 172keyword is not used in the system's 173.Pa resolv.conf 174file then the assumed order is 175.Cm bind file . 176Furthermore, if the system's 177.Pa resolv.conf 178file does not exist, then the only database used is 179.Cm file . 180.It Cm search 181Search list for hostname lookup. 182The search list is normally determined from the local domain name; 183by default, it begins with the local domain name, then successive 184parent domains that have at least two components in their names. 185This may be changed by listing the desired domain search path following the 186.Cm search 187keyword with spaces or tabs separating the names. 188Most resolver queries will be attempted using each component 189of the search path in turn until a match is found. 190Note that this process may be slow and will generate a lot of network 191traffic if the servers for the listed domains are not local, 192and that queries will time out if no server is available 193for one of the domains. 194.Pp 195The search list is currently limited to six domains 196with a total of 1024 characters. 197Only one 198.Cm search 199line should appear; if more than one is present, the last one found 200overwrites any values found in earlier lines. 201So if such a line appears in the 202.Nm resolv.conf.tail 203file, it should include all the domains that need to be searched. 204.It Cm sortlist 205Allows addresses returned by 206.Xr gethostbyname 3 207to be sorted. 208A 209.Cm sortlist 210is specified by IP address netmask pairs. 211The netmask is optional and defaults to the natural netmask of the net. 212The IP address and optional network pairs are separated by slashes. 213Up to 10 pairs may be specified. 214For example: 215.Pp 216.Dl sortlist 130.155.160.0/255.255.240.0 130.155.0.0 217.It Cm family 218Specify which type of Internet protocol family to prefer, 219if a host is reachable using different address families. 220By default IPv4 addresses are queried first, 221and then IPv6 addresses. 222The syntax is: 223.Bd -ragged -offset indent 224.Cm family Ar family Op Ar family 225.Ed 226.Pp 227A maximum of two families can be specified, where 228.Ar family 229can be any of: 230.Pp 231.Bl -tag -width "inet4XXX" -offset indent -compact 232.It inet4 233IPv4 queries. 234.It inet6 235IPv6 queries. 236.El 237.Pp 238If only one family is specified, 239only that family is tried. 240.It Cm options 241Allows certain internal resolver variables to be modified. 242The syntax is: 243.Bd -ragged -offset indent 244.Cm options Ar option ... 245.Ed 246.Pp 247Where 248.Ar option 249is one of the following: 250.Bl -tag -width insecure1 251.It Cm debug 252Print debugging messages, 253if libc is compiled with 254.Dv DEBUG . 255By default on 256.Ox 257this option does nothing. 258.It Cm edns0 259Attach an OPT pseudo-RR for the EDNS0 extension, 260as specified in RFC 2671. 261This informs DNS servers of a client's receive buffer size, 262allowing them to take advantage of a non-default receive buffer size, 263and thus send larger replies. 264DNS query packets with the EDNS0 extension are not compatible with 265non-EDNS0 DNS servers, 266so the option must be used only when all the servers listed in 267.Cm nameserver 268lines are able to handle the extension. 269.Pp 270To verify whether a server supports EDNS, 271query it using the 272.Xr dig 1 273query option 274.Li +edns=0 : 275the reply indicates compliance (EDNS version 0) 276and whether a UDP packet larger than 512 bytes can be used. 277Note that EDNS0 can cause the server to send packets 278large enough to require fragmentation. 279Other factors such as packet filters may impede these, 280particularly if there is a reduced MTU, 281as is often the case with 282.Xr pppoe 4 283or with tunnels. 284.It Cm inet6 285Enables support for IPv6-only applications, by setting RES_USE_INET6 in 286_res.options (see 287.Xr resolver 3 ) . 288Use of this option is discouraged, and meaningless on 289.Ox . 290.It Cm insecure1 291Do not require IP source address on the reply packet to be equal to the 292server's address. 293.It Cm insecure2 294Do not check if the query section of the reply packet is equal 295to that of the query packet. 296For testing purposes only. 297.It Cm ndots : Ns Ar n 298Sets a threshold for the number of dots which 299must appear in a name given to 300.Xr res_query 3 301before an initial absolute query will be made. 302The default for 303.Ar n 304is 1, meaning that if there are any dots in a name, the name will be tried 305first as an absolute name before any search list elements are appended to it. 306.It Cm tcp 307Forces the use of TCP for queries. 308Normal behaviour is to query via UDP but fall back to TCP on failure. 309.El 310.El 311.Pp 312The 313.Cm domain 314and 315.Cm search 316keywords are mutually exclusive. 317If more than one instance of these keywords is present, the last instance 318will override. 319.Sh ENVIRONMENT 320.Bl -tag -width "RES_OPTIONSXXX" 321.It Ev LOCALDOMAIN 322A space-separated list of search domains, 323overriding the 324.Cm search 325keyword of a system's 326.Nm resolv.conf 327or 328.Nm resolv.conf.tail 329file. 330.It Ev RES_OPTIONS 331A space-separated list of resolver options, 332overriding the 333.Cm options 334keyword of a system's 335.Nm resolv.conf 336or 337.Nm resolv.conf.tail 338file. 339.El 340.Sh FILES 341.Bl -tag -width "/etc/resolv.conf.tailXX" -compact 342.It Pa /etc/resolv.conf 343.It Pa /etc/resolv.conf.tail 344.El 345.Sh SEE ALSO 346.Xr gethostbyname 3 , 347.Xr resolver 3 , 348.Xr hosts 5 , 349.Xr hostname 7 , 350.Xr dhclient 8 , 351.Xr named 8 352.Sh HISTORY 353The 354.Nm 355file format appeared in 356.Bx 4.3 . 357