NetworkManager
Smoot Carl-Mitchell
smoot at tic.com
Wed Oct 8 20:08:40 UTC 2008
On Wed, 2008-10-08 at 16:00 -0300, Derek Broughton wrote:
> NoOp wrote:
>
> >
> > Set NM for "Roaming mode" and
> > sudo /etc/init.d/networking restart
> > cat /etc/resolv.conf
> >
> > You will see that Network Manager wrote into the /etc/resolv.conf file
> > as shown in Leonard's output.
>
> How? Network manager doesn't get _touched_ when you do "networking
> restart" - which is how this whole discussion started, because Karl
> couldn't figure out why a restart had no effect.
I think it is pretty clear NetworkManager overwrites /etc/resolv.conf.
Do this:
smoot at smoot:~$ strings /usr/sbin/NetworkManager | grep Modified_by:
# Modified_by: NetworkManager
NetworkManager is a dbus aware application and I believe dhclient is
also. They communicate with each other via dbus. A hint is the
argument to a running dhclient e.g.
smoot at smoot:~$ ps ax | grep dhclient
10565 ? S 0:00 /sbin/dhclient -1
-lf /var/lib/dhcp3/dhclient.ath0.leases -pf /var/run/dhclient.ath0.pid
-q -e dhc_dbus=31 -d ath0
dhclient certainly gets the nameserver information from the DHCP server
and I will bet it passes the info back to NetworkManager which handles
the update of /etc/resolv.conf.
A bit more sleuthing with "strings" shows:
smoot at smoot:~$ strings /usr/sbin/NetworkManager | grep resolv.conf
nm_system_should_modify_resolv_conf
/etc/resolv.conf.tmp
/etc/resolv.conf
Could not update /etc/resolv.conf: %s
<WARN> %s(): Could not write resolv.conf. Error: '%s'
rewrite_resolv_conf
set_ip4_config_from_resolv_conf
You can also do an strace on a running NM dameon like this:
sudo strace -p <pid_of_NM> -e open -e rename
which will show the open of /etc/resolv.conf.tmp and the rename
to /etc/resolv.conf as you switch networks.
--
Smoot Carl-Mitchell
System/Network Architect
smoot at tic.com
+1 480 922 7313
cell: +1 602 421 9005
More information about the ubuntu-users
mailing list