FreeBSD Protect resolv.conf from dhclient auto update

If you have the need for a custom resolv.conf and you are fed up with dhclient consistenly overwriting your handy work, this is an easy way to keep your info from being changed.

Edit /etc/dhclient.conf and add the following options for adding your info before dhclient info

prepend domain-name "yourdomain.com ";
prepend domain-name-servers 127.0.0.1;

If you want to ignore the dhclient info change the prepend command to supersede.

Works for me, I hope it works for you.

To test just make the changes and then run:

# dhclient eth0; cat /etc/resolv.conf

Leave a Reply