Stop resolv.conf being overwritten by Network Manager

Going Minimal and Manual
This is one of those niggly little problems that happens when people who install full desktop environments face when they go for a bit of fluff reduction and start doing things manually.

Network-Manager and Wicd
I’ve already written about manually setting up a wireless connection, and static wired connections, which will just usually takeover and leave network-manager-gnome or wicd redundant but still showing the applet in your panel.
I completely remove network-manager-gnome anyway, but you may have a reason for keeping it just in case.


Resolvconf
The thing is, you still have the resolvconf package installed which will automatically take over and wipe your manually edited /etc/resolv.conf file, it even tells you what will happen at the top of the file in a commented out warning.

Quick n Easy Method
Just edit and change the write permissions on the resolv.conf file so that resolvconf can’t wipe it.

sudo vim /etc/resolv.conf

Add your nameservers (Iuse Google’s)

nameserver 8.8.8.8
nameserver 8.8.4.4

Then change it to read only (Can be reveresed by changing the + to a – in that command)

sudo chattr +i /etc/resolv.conf

Now reboot, you should have a nice manually configured wireless connection with no DNS issues or resolv.conf overwriting.

Advertisements

3 thoughts on “Stop resolv.conf being overwritten by Network Manager

  1. NetworkManager usually lets dnsmasq do all the resolving, and that's why it overrides any dns entry in resolv.conf. To cancel this effect, comment out the dns=dnsmasq in /etc/NetworkManager/NetworkManager.conf

  2. On Fedora/RHEL and derivatives, you need to have dns=none in the [main] section of /etc/NetworkManager/NetworkManager.conf. If you have no dns setting, the default behavior is to update /etc/resolv.conf.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s