From ArchWiki
Revision as of 11:39, 3 May 2010 by Hokasch (Talk | contribs) (Modify the dhcpcd Config)

Jump to: navigation, search

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.

Preserve DNS settings

Dhcpcd, NetworkManager, and various other processes can overwrite Template:Filename. This is usually desirable behavior, but sometimes DNS settings need to be set manually (e.g. when using a static IP). There are several ways to accomplish this. If you are using NetworkManager, see this thread on how to prevent it from overriding your resolv.conf.

Modify the dhcpcd Config

Dhcpcd's configuration file may be edited to prevent the dhcpcd daemon from overwriting Template:Filename. To do this, add the following to the last section of Template:Filename:

nohook resolv.conf

Use resolv.conf.head

Alternatively, you can create a file called Template:Filename containing your DNS servers. Dhcpcd will prepend this file to the beginning of resolv.conf. An example Template:Filename for someone using OpenDNS would be:

# OpenDNS servers

Write-protect 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