5

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?

1

2 Answers 2

4

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.

2

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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