Resolv.conf

From wiki.filipefonseca.pt
Jump to navigation Jump to search

Prevent DHCP client from changing resolv.conf file

This is the method that I recommend using the most. changing dhcp hooks

Edit /etc/dhcp/dhclient-enter-hooks.d/nodnsupdate.

vi /etc/dhcp/dhclient-enter-hooks.d/nodnsupdate

Make the following edits:

#!/bin/sh
make_resolv_conf(){
    :
}

Save and exit.

Update the permissions on the nodnsupdate file.

chmod +x /etc/dhcp/dhclient-enter-hooks.d/nodnsupdate

Reboot your server. You can now update nameservers by editing /etc/resolv.conf without worrying about rollback.