4:22 PM - Overriding DNS server changes when dhcp is enabled.
By default, /etc/resolv.conf is updated when DHCP is enabled for an interface. This is useful for WiFi or laptops where you frequently change networks. However, it can be problematic sometimes when different DNS servers are required.
For static IP addresses, this is not modified automatically.
Preventing Automatic Config Changes
Methods to try:
Use a static IP address
Make /etc/resolv.conf immutable
Override the dhclient configuration
Turn off resolvconf
Static IP
Simply edit your /etc/rc.conf and replace DHCP in your ifconfig line with a static IP configuration
Immutable resolv.conf
chflags schg /etc/resolv.conf
Override the dhclient config
place the following in /etc/dhclient.conf, but change the name of the interface as appropriate. This example uses OpenDNS with an Intel Gigabit NIC.
interface "em0" {
supersede domain-name-servers 208.67.222.222,208.67.220.220;
}
You will need to restart the dhclient for changes to take effect.
service dhclient restart em0
Disable resolvconf(8)
Create a file
/etc/resolvconf.conf
Place this in the file
resolv_conf="/dev/null"
resolvconf="NO"