CINXE.COM
resolv.conf(5) - Linux manual page
<!DOCTYPE html> <html lang="en-US"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>resolv.conf(5) - Linux manual page</title> <link rel="stylesheet" type="text/css" href="../../../style.css" title="style" /> <link rel="stylesheet" type="text/css" href="../style.css" title="style" /> </head> <body> <div class="page-top"><a id="top_of_page"></a></div> <!--%%%TOP_BAR%%%--> <div class="nav-bar"> <table class="nav-table"> <tr> <td class="nav-cell"> <p class="nav-text"> <a href="../../../index.html">man7.org</a> > Linux > <a href="../index.html">man-pages</a> </p> </td> <td class="training-cell"> <p class="training-text"><a class="training-link" href="http://man7.org/training/">Linux/UNIX system programming training</a></p> </td> </tr> </table> </div> <hr class="nav-end" /> <!--%%%PAGE_START%%%--> <h1>resolv.conf(5) — Linux manual page</h1> <table class="sec-table"> <tr> <td> <p class="section-dir"> <a href="#NAME">NAME</a> | <a href="#SYNOPSIS">SYNOPSIS</a> | <a href="#DESCRIPTION">DESCRIPTION</a> | <a href="#FILES">FILES</a> | <a href="#SEE_ALSO">SEE ALSO</a> | <a href="#COLOPHON">COLOPHON</a> </p> </td> </tr> <tr> <td class="search-box"> <div class="man-search-box"> <form method="get" action="https://www.google.com/search"> <fieldset class="man-search"> <input type="text" name="q" size="10" maxlength="255" value="" /> <input type="hidden" name="sitesearch" value="man7.org/linux/man-pages" /> <input type="submit" name="sa" value="Search online pages" /> </fieldset> </form> </div> </td> <td> </td> </tr> </table> <!--%%%TEXT_START%%%--> <pre> <span class="headline"><i>resolv.conf</i>(5) File Formats Manual <i>resolv.conf</i>(5)</span> </pre> <h2><a id="NAME" href="#NAME"></a>NAME <a href="#top_of_page"><span class="top-link">top</span></a></h2><pre> resolv.conf - resolver configuration file </pre> <h2><a id="SYNOPSIS" href="#SYNOPSIS"></a>SYNOPSIS <a href="#top_of_page"><span class="top-link">top</span></a></h2><pre> <b>/etc/resolv.conf</b> </pre> <h2><a id="DESCRIPTION" href="#DESCRIPTION"></a>DESCRIPTION <a href="#top_of_page"><span class="top-link">top</span></a></h2><pre> The <i>resolver</i> is a set of routines in the C library that provide access to the Internet Domain Name System (DNS). The resolver configuration file contains information that is read by the resolver routines the first time they are invoked by a process. The file is designed to be human readable and contains a list of keywords with values that provide various types of resolver information. The configuration file is considered a trusted source of DNS information; see the <b>trust-ad </b>option below for details. If this file does not exist, only the name server on the local machine will be queried, and the search list contains the local domain name determined from the hostname. The different configuration options are: <b>nameserver </b>Name server IP address Internet address of a name server that the resolver should query, either an IPv4 address (in dot notation), or an IPv6 address in colon (and possibly dot) notation as per RFC 2373. Up to <b>MAXNS </b>(currently 3, see <i><resolv.h></i>) name servers may be listed, one per keyword. If there are multiple servers, the resolver library queries them in the order listed. If no <b>nameserver </b>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.) <b>search </b>Search list for host-name lookup. By default, the search list contains one entry, the local domain name. It is determined from the local hostname returned by <a href="../man2/gethostname.2.html">gethostname(2)</a>; the local domain name is taken to be everything after the first '.'. Finally, if the hostname does not contain a '.', the root domain is assumed as the local domain name. This may be changed by listing the desired domain search path following the <i>search</i> keyword with spaces or tabs separating the names. Resolver queries having fewer than <i>ndots</i> dots (default is 1) in them will be attempted using each component of the search path in turn until a match is found. For environments with multiple subdomains please read <b>options ndots:</b><i>n</i> below to avoid man-in-the-middle attacks and unnecessary traffic for the root-dns-servers. Note that this process may be slow and will generate a lot of network traffic if the servers for the listed domains are not local, and that queries will time out if no server is available for one of the domains. If there are multiple <b>search </b>directives, only the search list from the last instance is used. In glibc 2.25 and earlier, the search list is limited to six domains with a total of 256 characters. Since glibc 2.26, the search list is unlimited. The <b>domain </b>directive is an obsolete name for the <b>search</b> directive that handles one search list entry only. <b>sortlist</b> This option allows addresses returned by <a href="../man3/gethostbyname.3.html">gethostbyname(3)</a> to be sorted. A sortlist is specified by IP-address- netmask pairs. The netmask is optional and defaults to the natural netmask of the net. The IP address and optional network pairs are separated by slashes. Up to 10 pairs may be specified. Here is an example: sortlist 130.155.160.0/255.255.240.0 130.155.0.0 <b>options</b> Options allows certain internal resolver variables to be modified. The syntax is <b>options </b><i>option ...</i> where <i>option</i> is one of the following: <b>debug </b>Sets <b>RES_DEBUG </b>in <i>_res.options</i> (effective only if glibc was built with debug support; see <a href="../man3/resolver.3.html">resolver(3)</a>). <b>ndots:</b><i>n</i> Sets a threshold for the number of dots which must appear in a name given to <a href="../man3/res_query.3.html">res_query(3)</a> (see <a href="../man3/resolver.3.html">resolver(3)</a>) before an <i>initial absolute query</i> will be made. The default for <i>n</i> is 1, meaning that if there are any dots in a name, the name will be tried first as an absolute name before any <i>search</i> <i>list</i> elements are appended to it. The value for this option is silently capped to 15. <b>timeout:</b><i>n</i> Sets the amount of time the resolver will wait for a response from a remote name server before retrying the query via a different name server. This may <b>not </b>be the total time taken by any resolver API call and there is no guarantee that a single resolver API call maps to a single timeout. Measured in seconds, the default is <b>RES_TIMEOUT</b> (currently 5, see <i><resolv.h></i>). The value for this option is silently capped to 30. <b>attempts:</b><i>n</i> Sets the number of times the resolver will send a query to its name servers before giving up and returning an error to the calling application. The default is <b>RES_DFLRETRY </b>(currently 2, see <i><resolv.h></i>). The value for this option is silently capped to 5. <b>rotate </b>Sets <b>RES_ROTATE </b>in <i>_res.options</i>, which causes round-robin selection of name servers from among those listed. This has the effect of spreading the query load among all listed servers, rather than having all clients try the first listed server first every time. <b>no-aaaa (since glibc 2.36)</b> Sets <b>RES_NOAAAA </b>in <i>_res.options</i>, which suppresses AAAA queries made by the stub resolver, including AAAA lookups triggered by NSS-based interfaces such as <a href="../man3/getaddrinfo.3.html">getaddrinfo(3)</a>. Only DNS lookups are affected: IPv6 data in <a href="../man5/hosts.5.html">hosts(5)</a> is still used, <a href="../man3/getaddrinfo.3.html">getaddrinfo(3)</a> with <b>AI_PASSIVE </b>will still produce IPv6 addresses, and configured IPv6 name servers are still used. To produce correct Name Error (NXDOMAIN) results, AAAA queries are translated to A queries. This option is intended preliminary for diagnostic purposes, to rule out that AAAA DNS queries have adverse impact. It is incompatible with EDNS0 usage and DNSSEC validation by applications. <b>no-check-names</b> Sets <b>RES_NOCHECKNAME </b>in <i>_res.options</i>, which disables the modern BIND checking of incoming hostnames and mail names for invalid characters such as underscore (_), non-ASCII, or control characters. <b>inet6 </b>Sets <b>RES_USE_INET6 </b>in <i>_res.options</i>. This has the effect of trying an AAAA query before an A query inside the <a href="../man3/gethostbyname.3.html">gethostbyname(3)</a> function, and of mapping IPv4 responses in IPv6 "tunneled form" if no AAAA records are found but an A record set exists. Since glibc 2.25, this option is deprecated; applications should use <a href="../man3/getaddrinfo.3.html">getaddrinfo(3)</a>, rather than <a href="../man3/gethostbyname.3.html">gethostbyname(3)</a>. <b>ip6-bytestring </b>(since glibc 2.3.4 to glibc 2.24) Sets <b>RES_USEBSTRING </b>in <i>_res.options</i>. This causes reverse IPv6 lookups to be made using the bit-label format described in RFC 2673; if this option is not set (which is the default), then nibble format is used. This option was removed in glibc 2.25, since it relied on a backward-incompatible DNS extension that was never deployed on the Internet. <b>ip6-dotint</b>/<b>no-ip6-dotint </b>(glibc 2.3.4 to glibc 2.24) Clear/set <b>RES_NOIP6DOTINT </b>in <i>_res.options</i>. When this option is clear (<b>ip6-dotint</b>), reverse IPv6 lookups are made in the (deprecated) <i>ip6.int</i> zone; when this option is set (<b>no-ip6-dotint</b>), reverse IPv6 lookups are made in the <i>ip6.arpa</i> zone by default. These options are available up to glibc 2.24, where <b>no-ip6-dotint </b>is the default. Since <b>ip6-dotint </b>support long ago ceased to be available on the Internet, these options were removed in glibc 2.25. <b>edns0 </b>(since glibc 2.6) Sets <b>RES_USE_EDNS0 </b>in <i>_res.options</i>. This enables support for the DNS extensions described in RFC 2671. <b>single-request </b>(since glibc 2.10) Sets <b>RES_SNGLKUP </b>in <i>_res.options</i>. By default, glibc performs IPv4 and IPv6 lookups in parallel since glibc 2.9. Some appliance DNS servers cannot handle these queries properly and make the requests time out. This option disables the behavior and makes glibc perform the IPv6 and IPv4 requests sequentially (at the cost of some slowdown of the resolving process). <b>single-request-reopen </b>(since glibc 2.9) Sets <b>RES_SNGLKUPREOP </b>in <i>_res.options</i>. The resolver uses the same socket for the A and AAAA requests. Some hardware mistakenly sends back only one reply. When that happens the client system will sit and wait for the second reply. Turning this option on changes this behavior so that if two requests from the same port are not handled correctly it will close the socket and open a new one before sending the second request. <b>no-tld-query </b>(since glibc 2.14) Sets <b>RES_NOTLDQUERY </b>in <i>_res.options</i>. This option causes <b>res_nsearch</b>() to not attempt to resolve an unqualified name as if it were a top level domain (TLD). This option can cause problems if the site has ``localhost'' as a TLD rather than having localhost on one or more elements of the search list. This option has no effect if neither RES_DEFNAMES or RES_DNSRCH is set. <b>use-vc </b>(since glibc 2.14) Sets <b>RES_USEVC </b>in <i>_res.options</i>. This option forces the use of TCP for DNS resolutions. <b>no-reload </b>(since glibc 2.26) Sets <b>RES_NORELOAD </b>in <i>_res.options</i>. This option disables automatic reloading of a changed configuration file. <b>trust-ad </b>(since glibc 2.31) Sets <b>RES_TRUSTAD </b>in <i>_res.options</i>. This option controls the AD bit behavior of the stub resolver. If a validating resolver sets the AD bit in a response, it indicates that the data in the response was verified according to the DNSSEC protocol. In order to rely on the AD bit, the local system has to trust both the DNSSEC- validating resolver and the network path to it, which is why an explicit opt-in is required. If the <b>trust-ad </b>option is active, the stub resolver sets the AD bit in outgoing DNS queries (to enable AD bit support), and preserves the AD bit in responses. Without this option, the AD bit is not set in queries, and it is always removed from responses before they are returned to the application. This means that applications can trust the AD bit in responses if the <b>trust-ad</b> option has been set correctly. In glibc 2.30 and earlier, the AD is not set automatically in queries, and is passed through unchanged to applications in responses. The <i>search</i> keyword of a system's <i>resolv.conf</i> file can be overridden on a per-process basis by setting the environment variable <b>LOCALDOMAIN </b>to a space-separated list of search domains. The <i>options</i> keyword of a system's <i>resolv.conf</i> file can be amended on a per-process basis by setting the environment variable <b>RES_OPTIONS </b>to a space-separated list of resolver options as explained above under <b>options</b>. The keyword and value must appear on a single line, and the keyword (e.g., <b>nameserver</b>) must start the line. The value follows the keyword, separated by white space. Lines that contain a semicolon (;) or hash character (#) in the first column are treated as comments. </pre> <h2><a id="FILES" href="#FILES"></a>FILES <a href="#top_of_page"><span class="top-link">top</span></a></h2><pre> <i>/etc/resolv.conf</i>, <i><resolv.h></i> </pre> <h2><a id="SEE_ALSO" href="#SEE_ALSO"></a>SEE ALSO <a href="#top_of_page"><span class="top-link">top</span></a></h2><pre> <a href="../man3/gethostbyname.3.html">gethostbyname(3)</a>, <a href="../man3/resolver.3.html">resolver(3)</a>, <a href="../man5/host.conf.5.html">host.conf(5)</a>, <a href="../man5/hosts.5.html">hosts(5)</a>, <a href="../man5/nsswitch.conf.5.html">nsswitch.conf(5)</a>, <a href="../man7/hostname.7.html">hostname(7)</a>, <b>named</b>(8) Name Server Operations Guide for BIND </pre> <h2><a id="COLOPHON" href="#COLOPHON"></a>COLOPHON <a href="#top_of_page"><span class="top-link">top</span></a></h2><pre> This page is part of the <i>man-pages</i> (Linux kernel and C library user-space interface documentation) project. Information about the project can be found at ⟨<a href="https://www.kernel.org/doc/man-pages/">https://www.kernel.org/doc/man-pages/</a>⟩. If you have a bug report for this manual page, see ⟨<a href="https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/CONTRIBUTING">https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/CONTRIBUTING</a>⟩. This page was obtained from the tarball man-pages-6.9.1.tar.gz fetched from ⟨<a href="https://mirrors.edge.kernel.org/pub/linux/docs/man-pages/">https://mirrors.edge.kernel.org/pub/linux/docs/man-pages/</a>⟩ on 2024-06-26. If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up- to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is <i>not</i> part of the original manual page), send a mail to man-pages@man7.org <span class="footline">4th Berkeley Distribution 2024-05-02 <i>resolv.conf</i>(5)</span> </pre> <hr class="end-man-text" /> <p>Pages that refer to this page: <a href="../man1/pmdanetcheck.1.html">pmdanetcheck(1)</a>, <a href="../man1/pmhostname.1.html">pmhostname(1)</a>, <a href="../man1/resolvectl.1.html">resolvectl(1)</a>, <a href="../man3/resolver.3.html">resolver(3)</a>, <a href="../man5/host.conf.5.html">host.conf(5)</a>, <a href="../man5/hosts.5.html">hosts(5)</a>, <a href="../man5/resolved.conf.5.html">resolved.conf(5)</a>, <a href="../man5/systemd.network.5.html">systemd.network(5)</a>, <a href="../man7/hostname.7.html">hostname(7)</a>, <a href="../man8/systemd-resolved.service.8.html">systemd-resolved.service(8)</a> </p> <hr/> <p class="page-copyright"><a href="../man5/resolv.conf.5.license.html">Copyright and license for this manual page</a></p> <hr class="start-footer" /> <div class="footer"> <table class="colophon-table"> <tr> <td class="pub-info"> <p> HTML rendering created 2024-06-26 by <a href="https://man7.org/mtk/index.html">Michael Kerrisk</a>, author of <a href="https://man7.org/tlpi/"><em>The Linux Programming Interface</em></a>. </p> <p> For details of in-depth <strong>Linux/UNIX system programming training courses</strong> that I teach, look <a href="https://man7.org/training/">here</a>. </p> <p> Hosting by <a href="https://www.jambit.com/index_en.html">jambit GmbH</a>. </p> </td> <td class="colophon-divider"> </td> <td class="tlpi-cover"> <a href="https://man7.org/tlpi/"><img src="https://man7.org/tlpi/cover/TLPI-front-cover-vsmall.png" alt="Cover of TLPI" /></a> </td> </tr> </table> </div> <hr class="end-footer" /> <!--BEGIN-SITETRACKING--> <!-- SITETRACKING.man7.org_linux_man-pages --> <!-- Default Statcounter code for man7.org/linux/man-pages http://www.man7.org/linux/man-pages --> <script type="text/javascript"> var sc_project=7422636; var sc_invisible=1; var sc_security="9b6714ff"; </script> <script type="text/javascript" src="https://www.statcounter.com/counter/counter.js" async></script> <noscript><div class="statcounter"><a title="Web Analytics Made Easy - StatCounter" href="https://statcounter.com/" target="_blank"><img class="statcounter" src="https://c.statcounter.com/7422636/0/9b6714ff/1/" alt="Web Analytics Made Easy - StatCounter"></a></div></noscript> <!-- End of Statcounter Code --> <!-- Start of Google Analytics Code --> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-9830363-8']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> <!-- End of Google Analytics Code --> <!--END-SITETRACKING--> </body> </html>