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