1.\" Copyright (c) 1986, 1991, 1993 2.\" The Regents of the University of California. 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. Neither the name of the University nor the names of its contributors 13.\" may be used to endorse or promote products derived from this software 14.\" without specific prior written permission. 15.\" 16.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26.\" SUCH DAMAGE. 27.\" 28.Dd March 15, 2026 29.Dt RESOLVER 5 30.Os 31.Sh NAME 32.Nm resolver 33.Nd resolver configuration file 34.Sh SYNOPSIS 35.Nm resolv.conf 36.Sh DESCRIPTION 37The 38.Xr resolver 3 39is a set of routines in the C library 40which provide access to the Internet Domain Name System. 41The resolver configuration file contains information that is read 42by the resolver routines the first time they are invoked by a process. 43The file is designed to be human readable and contains a list of 44keywords with values that provide various types of resolver information. 45.Pp 46On a normally configured system, setting this file manually should not 47be necessary. 48The only name server(s) to be queried will be on the local machine 49or automatically configured using DHCP or a similar mechanism, 50the domain name is determined from the host name, 51and the domain search path is constructed from the domain name. 52.Pp 53The different configuration options are: 54.Bl -tag -width nameserver 55.It Sy nameserver 56IPv4 or IPv6 address of a name server 57that the resolver should query. 58Up to 59.Dv MAXNS 60(currently 3) name servers may be listed, 61one per keyword. 62If there are multiple servers, 63the resolver library queries them in the order listed. 64If no 65.Sy nameserver 66entries are present, 67the default is to use the name server on the local machine. 68(The algorithm used is to try a name server, and if the query times out, 69try the next, until out of name servers, 70then repeat trying all the name servers 71until a maximum number of retries are made). 72.It Sy domain 73Local domain name. 74Most queries for names within this domain can use short names 75relative to the local domain. 76If no 77.Sy domain 78entry is present, the domain is determined 79from the local host name returned by 80.Xr gethostname 3 ; 81the domain part is taken to be everything after the first 82.Ql \&. . 83Finally, if the host name does not contain a domain part, the root 84domain is assumed. 85.It Sy search 86Search list for host-name lookup. 87The search list is normally determined from the local domain name; 88by default, it contains only the local domain name. 89This may be changed by listing the desired domain search path 90following the 91.Sy search 92keyword with spaces or tabs separating 93the names. 94Most resolver queries will be attempted using each component 95of the search path in turn until a match is found. 96Note that this process may be slow and will generate a lot of network 97traffic if the servers for the listed domains are not local, 98and that queries will time out if no server is available 99for one of the domains. 100.Pp 101The search list is currently limited to six domains 102with a total of 256 characters. 103.It Sy sortlist 104Sortlist allows addresses returned by gethostbyname to be sorted. 105A sortlist is specified by IP address netmask pairs. 106If the netmask is not specified, 107it defaults to the historical Class A/B/C netmask of the net; 108this usage is deprecated. 109The IP address 110and network pairs are separated by slashes. 111Up to 10 pairs may 112be specified. 113E.g., 114.Pp 115.Dl "sortlist 10.9.1.0/255.255.240.0 10.9.0.0/255.255.0.0" 116.It Sy options 117Options allows certain internal resolver variables to be modified. 118The syntax is 119.Pp 120\fBoptions\fP \fIoption\fP \fI...\fP 121.Pp 122where 123.Sy option 124is one of the following: 125.Bl -tag -width no_tld_query 126.It Sy debug 127sets 128.Dv RES_DEBUG 129in _res.options. 130.It Sy usevc 131sets 132.Dv RES_USEVC 133to use TCP instead of UDP for queries. 134.It Sy ndots : Ns Ar n 135sets a threshold for the number of dots which must appear in a name given to 136.Fn res_query 137(see 138.Xr resolver 3 ) 139before an 140.Em initial absolute query 141will be made. 142The default for 143.Em n 144is 145.Dq 1 , 146meaning that if there are any dots in a name, the name 147will be tried first as an absolute name before any 148.Em search list 149elements are appended to it. 150.It Sy timeout : Ns Ar n 151sets the initial amount of time the resolver will wait 152for a response from a remote 153name server before retrying the query via a different name server. 154The resolver may wait longer during subsequent retries 155of the current query since an exponential back-off is applied to 156the timeout value. 157Measured in seconds, the default is 158.Dv RES_TIMEOUT , 159the allowed maximum is 160.Dv RES_MAXRETRANS 161(see 162.In resolv.h ) . 163.It Sy attempts : Ns Ar n 164sets the number of times the resolver will send a query to each of 165its name servers 166before giving up and returning an error to the calling application. 167The default is 168.Dv RES_DFLRETRY , 169the allowed maximum is 170.Dv RES_MAXRETRY 171(see 172.In resolv.h ) . 173.It Sy edns0 174Sets 175.Dv RES_USE_EDNS0 . 176Attach an OPT pseudo-RR for the EDNS0 extension, 177as specified in RFC 2671. 178This allows the resolver to advertise a larger UDP receive buffer size, 179permitting responses larger than the original 512-byte limit. 180.It Sy inet6 181Sets 182.Dv RES_USE_INET6 . 183Causes 184.Xr gethostbyname 3 185to look up AAAA records before A records 186and to map IPv4 responses into IPv6 addresses. 187The use of this option is discouraged. 188.It Sy insecure1 189Sets 190.Dv RES_INSECURE1 . 191Disables the check that the response was received from the 192same server to which the query was sent. 193Use of this option is a security risk and is not recommended. 194.It Sy insecure2 195Sets 196.Dv RES_INSECURE2 . 197Disables the check that the response contains a query 198matching the one that was sent. 199Use of this option is a security risk and is not recommended. 200.It Sy no-check-names 201Sets 202.Dv RES_NOCHECKNAME . 203Disables the check of incoming host names for invalid characters 204such as underscore, non-ASCII, or control characters. 205.It Sy no_tld_query 206tells the resolver not to attempt to resolve a top level domain name, that 207is, a name that contains no dots. 208Use of this option does not prevent 209the resolver from obeying the standard 210.Sy domain 211and 212.Sy search 213rules with the given name. 214.It Sy rotate 215Sets 216.Dv RES_ROTATE . 217Causes the resolver to round-robin among the configured name servers, 218distributing the query load instead of always trying the first 219listed server. 220.It Sy reload-period : Ns Ar n 221The resolver checks the modification time of 222.Pa /etc/resolv.conf 223every 224.Ar n 225seconds. 226If 227.Pa /etc/resolv.conf 228has changed, it is automatically reloaded. 229The default for 230.Ar n 231is two seconds. 232Setting it to zero disables the file check. 233.El 234.Pp 235Options may also be specified as a space or tab separated list using the 236.Dv RES_OPTIONS 237environment variable. 238.El 239.Pp 240The 241.Sy domain 242and 243.Sy search 244keywords are mutually exclusive. 245If more than one instance of these keywords is present, 246the last instance will override. 247.Pp 248The keyword and value must appear on a single line, and the keyword 249.Pq for example, Sy nameserver 250must start the line. 251The value follows the keyword, separated by white space. 252.Sh FILES 253.Bl -tag -width /etc/resolv.conf -compact 254.It Pa /etc/resolv.conf 255The file 256.Nm resolv.conf 257resides in 258.Pa /etc . 259.El 260.Sh EXAMPLES 261A basic resolv.conf file could be in the following form. 262.Bd -literal -offset indent 263# The domain directive is only necessary, if your local 264# router advertises something like localdomain and you have 265# set up your hostnames via an external domain. 266domain localdomain.tld 267 268# In case you a running a local dns server or caching name server 269# like local-unbound(8) for example. 270nameserver 127.0.0.1 271 272# IP address of the local or ISP name service 273nameserver 192.168.2.1 274 275# Fallback nameservers, in this case these from Google. 276nameserver 8.8.8.8 277nameserver 8.8.4.4 278 279# Attach an OPT pseudo-RR for the EDNS0 extension, 280# as specified in RFC 2671. 281options edns0 282.Ed 283.Sh SEE ALSO 284.Xr gethostbyname 3 , 285.Xr resolver 3 , 286.Xr hostname 7 , 287.Xr resolvconf 8 288.Sh HISTORY 289The 290.Nm resolv.conf 291file format appeared in 292.Bx 4.3 . 293