Yes, a local override is preferred over the more global defaults. However, you may have a tool or system process controlling resolv.conf, so you should go through that process instead of directly modifying that file.
depends on your system. you'll probably find that if you're using Ubuntu or a Debian based setup that even if you edit /etc/resolv.conf it's just gonna continually be overwritten with garbage all the time and screw it all up
you can make /etc/resolv.conf on that machine immutable so nothing else can modify it on reboot or just whenever it feels like
After posting I read up a wee bit on chattr and then tried it as SuperUser and it seems to have worked.
sudo didn't appear to work and got no error messages but using lsattr was helpful to see if changes made.
Thanks for pointer.
Geffers
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Just tried sudo chatrr -i /etc/resolv.conf and for some reason after reboot it still gets overwritten.
Even tried using sudo chmod to 444 to make it read only but still gets overwritten.
I'm going round in circles here, it is a Raspberry Pi device running Raspian Stretch, all I want to try is to prevent this one computer on my network using Pi-Hole.
I've added the DNS servers I want to use in the /etc/network/interfaces file and they get added to resolv.conf after reboot BUT the Pi_hole server has the first listing and temporarily I want to stop using Pi-Hole but just for this one computer.
This solution does work, but the underlying processes will still be trying to modify file--but they won't be able to.
NetworkManagerNetworkMangler is notorious for modifying this file. It can work well if you let it, but lots of people find it annoying hence it's affectionate nickname. Also, dhclient tries to own the file in a similar manner.
I've got a Pi Zero that has one job, it has an ADS-B tuner attached and logs aircraft. Headless and runs 24/7
For some reason if I alter the hostname and copy that in to hosts file for some reason the network connections on that device completely fail every so often. Random time, sometimes hours, sometimes minutes. Fixed IP disappears, all interface connection settings seem to disappear.
Restarting network service does not resolve anything(I can still get into device with serial-usb connection) but reboot does.
Log files show it losing connection but as yet not found out why.
If I leave the deafult name for the Zero all works fine. Why should that happen?