Monday, October 18, 2010

NetwokManager, resolv.conf & {k,edu,}ubuntu maverick 10.10:
how to tell nm that it must not kill your resolv.conf dns settings

The problem I'm trying to solve is NetworkManager always overwriting /etc/resolv.conf at each reboot, regardless of your /etc/neworking/interfaces file beeing present and setup.

The problem is quite easy to solve, but I could not find a source of info on the net on how to do it.
Even the official docs make no (eveident) mention to this. So...

Basically ubuntu is setup to use NM, but the config also tells NM not to manage the interfaces in /etc/neworking/interfaces. The problem is that, by default, NM clears your /etc/resolv.conf on startup and in /etc/neworking/interfaces there is usually no info to recreate it.

The fix is just to tell NetworkManager to setup the network in boot using info from the /etc/neworking/interfaces, plus adding dns info to that file

In /etc/NetworkManager/nm-system-settings.conf make sure that you have
[ifupdown]
managed=true

then in /etc/neworking/interfaces use something like
iface eth0 inet static
address 192.168.1.1
netmask 255.255.255.0
gateway 192.168.1.254
dns-nameservers 8.8.8.8 8.8.4.4
dns-search homelinux.org