Resolv.conf

From ArchWiki
Revision as of 17:12, 26 November 2009 by Kyouens (Talk | contribs) (Added information about preserving resolv.conf settings)

Jump to: navigation, search

Tango-document-new.pngThis article is a stub.Tango-document-new.png

Notes: please use the first argument of the template to provide more detailed indications. (Discuss in Talk:Resolv.conf#)

The resolver 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.

On a normally configured system this file should not be necessary. The only name server to be queried will be on the local machine; the domain name is determined from the host name and the domain search path is constructed from the domain name.

Conserve DNS settings

Dhcpcd, NetworkManager, and various other processes can overwrite resolv.conf. When using dhcpcd, you can prevent this from happening by creating a file called Template:Filename containing your DNS servers. Dhcpcd will append this file to the beginning of resolv.conf. An example Template:Filename for someone using OpenDNS would be:

# Route DNS requests through dnsmasq first
nameserver 127.0.0.1
# First OpenDNS server
nameserver 208.67.222.222
# Second OpenDNS server
nameserver 208.67.220.220

If you are using NetworkManager, see here how to prevent it from overriding your resolv.conf.

Another way to protect your resolv.conf from being edited by anything is setting the write-protection attribute:

chattr +i /etc/resolv.conf