Resolver configuration file
The resolver library routines provide access to the Internet Domain Name System (DNS). When these routines are first invoked by a process, they read information contained in the resolver configuration file. This file contains a list of keywords with user-specified values that provide various types of resolver information.
This file is optional. If it isn't present:
You can use the following confstr() configuration strings to override the data contained in /etc/resolv.conf:
The netmanager utility modifies the _CS_RESOLVE configuration string.
The socket library uses the following search order to locate the resolver data:
Utilities such as dhcp.client and pppd can optionally set the configuration strings.
The keyword and its associated value must appear on a single line. The line must start with the keyword (e.g. nameserver) followed by whitespace and the value.
The domain and search keywords are mutually exclusive. If more than one instance of these keywords is present, the last instance overrides any others.
The Internet address (in dot notation) of a name server that the resolver should query. Up to MAXNS (currently 3) name servers may be listed, one per keyword. If multiple server entries are present, the resolver library queries them in the order listed. If no server entries are present, the default is to use the name server on the local machine. (The algorithm used is to try a name server, and if the query times out, try the next, until out of name servers, then repeat trying all the name servers until a maximum number of retries are made).
The local domain. Most queries for names within this domain can use short names relative to the local domain. If no domain entry is present, the domain is determined from the local hostname returned by gethostname(); the domain part is taken to be everything after the first dot. If the hostname doesn't contain a domain part, the root domain is assumed.
The search list used for looking up hostnames. The search list is normally determined from the local domain name. By default, it begins with the local domain name, then with successive parent domains that have at least two components in their names.
You can override the default list by specifying the desired domain search path and by following the search keyword with the names. Most resolver queries are attempted using each component of the search path in turn until a match is found.
|This process may be slow and generates a lot of network traffic if the servers for the listed domains aren't local. Queries time out if no server is available for one of the domains.|
The search list is currently limited to six domains with a total of 256 characters.
By default, the resolv.conf data is parsed at application startup only. It is not checked again. Specifying “nocache on” will cause the resolv.conf data to be parsed at every lookup. If you wish to invalidate the cache at a specific time, it would be better to call res_init() directly, or turn off the _res.options flag RES_INIT.
/etc/hosts, netmanager, /etc/nsswitch.conf
dn_comp(), dn_expand(), gethostname(), res_init(), res_mkquery(), res_query(), res_search(), res_send() in the Library Reference
TCP/IP Network Administration
DNS and BIND by Paul Albitz and Cricket Liu, O'Reilly & Associates (ISBN 1-56592-010-4)