Almost every distro I know will wipe /etc/resolv.conf on reboot (I think DHCP does this) and thus the place to add static DHCP entries varies per distro. How do I add static DNS servers to a CentOS server, so that I know that my entries will survive a reboot?


2 Answers 2


For CentOS it looks like you add PEERDNS=no to /etc/sysconfig/network-scripts/ifcfg-eth0 (see the documentation).

More generically, iIf you're using dhclient then put the following in your dhclient.conf file:

interface "eth0" {
 supersede domain-name-servers,;

For dhcpcd you add the -R option to the command line to stop it changing /etc/resolv.conf.

Finally pump uses the -d option on the command line to stop it changing /etc/resolv.conf.


It would really just come down to how you configure your dhcp client.

From the link provided, it seems the relevant file will be


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .