Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
check out this question on SU superuser.com/questions/82337/slackware-change-dns-permanently – phunehehe Nov 1 '10 at 5:31
up vote 4 down vote accepted

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.

share|improve this answer

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

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.