Take the 2-minute tour ×
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.

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 to 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
add comment

2 Answers

up vote 3 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 8.8.4.4, 8.8.8.8;
}

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
add comment

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

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

/etc/sysconfig/network-scripts/ifcfg-eth0
share|improve this answer
add comment

Your Answer

 
discard

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.