#693512 network-manager: Network manager does not remove default routes

Package:
network-manager
Source:
network-manager
Description:
network management framework (daemon and userspace tools)
Submitter:
Miguel Angel
Date:
2012-11-19 14:09:03 UTC
Severity:
normal
#693512#5
Date:
2012-11-17 11:28:00 UTC
From:
To:
I have 2 connections in my computer:

eth0  : physical connectivity
wlan0 : wireless connectivity

I used to connect to my network through a physical connection but it is not in place anymore, so I decided to connect through wifi (wlan0).
Network-manager is not removing the default routing I had before and every time I would like to connect I have to manually remove this route.
As far as I understand from the network-manager, this should be automatically done by network-manager (removing and adding default new routes depending on current network connection)

Here you have the example:

/* System has booted up*/

$ netstat -nr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.2.1     0.0.0.0         UG        0 0          0 eth0
192.168.2.0     0.0.0.0         255.255.255.0   U         0 0          0 eth0

/* I connect to my wifi connection through network manager in KDE */

# netstat -nr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.2.1     0.0.0.0         UG        0 0          0 wlan0
192.168.2.0     0.0.0.0         255.255.255.0   U         0 0          0 eth0
192.168.2.0     0.0.0.0         255.255.255.0   U         0 0          0 wlan0

/* As you can see, eth0 configuration routing is still there!!)

# route del -net 192.168.2.0 netmask 255.255.255.0 eth0

/* After deleting the default route, it is working again)

# netstat -nr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.2.1     0.0.0.0         UG        0 0          0 wlan0
192.168.2.0     0.0.0.0         255.255.255.0   U         0 0          0 wlan0

/* Traffic is routed properly */

I have also modified NetworkManager configuration file to be able to manage the eth0 connection (according to http://wiki.debian.org/NetworkManager) with no success:

$ cat /etc/NetworkManager/NetworkManager.conf
[main]
plugins=ifupdown,keyfile

[ifupdown]
managed=true

#693512#10
Date:
2012-11-18 10:58:26 UTC
From:
To:
Am 17.11.2012 12:28, schrieb Miguel Angel:

You are not deleting the default route here. The default route is
correctly pointing to wlan0.

Could you post your /etc/network/interfaces config file.
I'm wondering if you configure eth0 via ifupdown.

Michael

#693512#15
Date:
2012-11-18 12:29:28 UTC
From:
To:
     Hi Michael,

     You're right. This is not the default route but it seems my DNS
servers are pointing to the my router (DHCP default configuration in my
router); therefore I cannot resolve DNS entries because these DNS
packages are going through eth0 (eth0 route entry is before wlan one, as
you may see) . If I try to connect through IP, my network connectivity
is working.

      Here you have my e/n/i:
-------------------------------------------
$ cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet static
         address 192.168.2.2
         netmask 255.255.255.0
         network 192.168.2.0
         broadcast 192.168.2.255
         gateway 192.168.2.1
         # dns-* options are implemented by the resolvconf package, if
installed
         dns-nameservers 85.62.229.131 85.62.229.132
-------------------------------------------

     As you may see, after networkmanager installation,
/etc/network/interfaces was not modified (I do not know if this is the
default behaviour). I managed to enable interface managed according to
http://wiki.debian.org/NetworkManager#Enabling_Interface_Management.
After doing that, networkmanager was able to manage the interface and I
suppose it got the information from /etc/network/interfaces.

      Let me know if you need anything else from my side. I really do
not know where this route is coming from. Perhaps I did something wrong
in the procedure, but I just followed the standard manuals.

      I really appreciate your time and effort. Thanks!

#693512#20
Date:
2012-11-18 12:39:46 UTC
From:
To:
You have eth0 configured in /etc/network/interfaces.

This device is now configured *both* by ifupdown and NetworkManager if
you set managed=true. So I actually do not recommend that as maintainer
of network-manager (contrary to what the wiki says).
So, if you want to manage eth0 with NetworkManager it is better to
remove the (eth0) configuration from /etc/network/interfaces completely,
so ifupdown does no longer touch it.

Now, while NetworkManager does not enable a ethernet interface if there
is no network link, ifupdown does not care.
It simply runs "ifup eth0" during boot.
This is why your eth0 network device is brought up and you have this
route entry.

So, in summary, I don't think there is actually a bug in
network-manager. It's just the way what happens if you configure your
system to use managed=true.

Andrew, do you have a better idea how to handle this situation?
Could ifup/ifdown be changed to check if managed=true is set and not
configure the device in this case?

Michael

#693512#25
Date:
2012-11-19 09:11:04 UTC
From:
To:
    Hi Michael,

    Thanks for the troubleshooting. I think we have several options here
(as far as I see). We can also combined some of them:

- Modify ifupdown to be aware of networkmanager installation (as you
suggested)
- Modify networkmanager to remove/modify/backup /e/n/i interfaces managed
by it (at installation time only or automatically done after the interfaces
is managed by networkmanager - this last one is even complex?)
- Message in networkmanager at installation time if ifupdown is installed
(also include this information in /usr/share/doc)
- Modify networkmanager documentation (
http://wiki.debian.org/NetworkManager#Enabling_Interface_Management) to
point out Michael suggestion to manually remove references in /e/n/i for
interfaces managed by networkmanager (if not done automatically by previous
options)

    What do you think?

     Regards

#693512#30
Date:
2012-11-19 14:06:10 UTC
From:
To:
I'm a bit worried about that. We already do mangle /e/n/i for dhcp-only
connections [1], and NM get's a lot of bad rep because of that.
If we do that, we should at least pop up a debconf prompt, so users can
opt-out of that process.

In the past, we had to do that, because the debian-installer creates a
/e/n/i configuration for basically every system. So NM was useless by
default, because it did not manage the device. This confused a *lot* of
people.

In d-i 7, the installer will write a NM config and *no* /e/n/i config if
NM is installed e.g. via the GNOME desktop task.

So I'm tempted to just drop the /e/n/i mangling altogether or as said,
at least put it behind a debconf prompt.

A simple warning on stdout would be trivial to implement. I fear, that
it might go unnoticed though for many. But it certainly is an option.

The wiki should definitely be updated.

Michael


[1] via /usr/lib/NetworkManager/ifblacklist_migrate.sh