NM assigns a lower metric to the default route over wlan than ifup assigns to the default route over eth.

Bug #47379 reported by Mark Favas
24
This bug affects 1 person
Affects Status Importance Assigned to Milestone
network-manager (Ubuntu)
Confirmed
Medium
Unassigned

Bug Description

Binary package hint: network-manager

Dapper RC, IBM Thinkpad T41p: when booted while connected to my wired network, the network-manager also detects a nearby open access point and establishes a connection there as well. Despite specifying eth0 as the default gateway in the networking applet, default routes are installed for both networks, with the wireless route listed first by "netstat -nr", and traceroute shows all network access tries to use the wireless route. To use my wired network, I have to manually deactivate the wireless interface. It was my understanding that the newly added network-manager in Dapper automated this, preferring wired over wireless when both were available. Even if this is not the case, selecting the wired network as the default gateway in the networking applet should work, and remove the default route to the wireless interface.

Revision history for this message
Tom Taylor (scraplab) wrote :

I am also experiencing this, on the final release of Dapper, with updates current to 08/08/06

Revision history for this message
Mika Fischer (zoop) wrote :

I can confirm this.

I think the problem is that NM just completely ignores interfaces that are configured by network-admin (or directly via /etc/networks/interfaces).

I think the correct thing would be for NM to not configure those interfaces but still watch them, so that it knows if the machine is currently connected via a wired connection in which case it should not try to use WLAN at all. When the wired connection goes down NM would notice and start searching for WLANs...

Changed in network-manager:
status: Unconfirmed → Confirmed
Revision history for this message
Scott Robinson (scott-ubuntu) wrote : Re: NM confused by combination of static and dynamic configured interfaces

Yup, still exists in edgy.

Revision history for this message
Kasper Peeters (kasper-peeters) wrote :

I don't think this is a duplicate of #5364 (which is about static IPs). On my Intrepid installation with a wired and wireless card, NM first connects to the wired network using DHCP. A while later (I haven't been able to spot the logic, sometimes it never happens) it also connects to the wireless network.

nm-tool reports both as 'state: connected'. The routing table looks like

Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 0.0.0.0 255.255.255.0 U 1 0 0 eth0
192.168.1.0 0.0.0.0 255.255.255.0 U 2 0 0 wlan0
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 eth0
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0

That is, 192.168.1.0 traffic now has two destinations.

Revision history for this message
Thomas Hood (jdthood) wrote :

Does this bug still exist?

Maarten Bezemer (veger)
Changed in network-manager (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Thomas Hood (jdthood) wrote :
Download full text (5.3 KiB)

In Precise I brought up eth0 with ifup and wlan0 with NetworkManager, as shown below. The result is two default routes which isn't a problem in itself. The problem is that NM assigns a lower metric (0) to the wlan0 default route than ifup assigned to the eth0 default route (100), which causes the kernel to send most traffic over wlan0. If I manually assign a metric of 200 to the "default via 192.168.1.254 dev wlan0 proto static" route then traffic is directed to eth0.

I don't know how this should be solved.

=============================================
# # network-manager is stopped at this point
# grep -v '^$' /etc/NetworkManager/NetworkManager.conf
[main]
plugins=ifupdown,keyfile
dns=dnsmasq
no-auto-default=F0:DE:F1:6B:22:BF,
[ifupdown]
managed=false
# grep -v '^$' /etc/network/interfaces
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
 address 192.168.1.30
 netmask 255.255.255.0
 gateway 192.168.1.254
# ifconfig
lo Link encap:Local Loopback
          inet addr:127.0.0.1 Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING MTU:16436 Metric:1
          RX packets:6853 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6853 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:536455 (536.4 KB) TX bytes:536455 (536.4 KB)

# ifup eth0
# ifconfig
eth0 Link encap:Ethernet HWaddr f0:de:f1:6b:22:bf
          inet addr:192.168.1.30 Bcast:192.168.1.255 Mask:255.255.255.0
          inet6 addr: fe80::f2de:f1ff:fe6b:22bf/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
          RX packets:4425 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4756 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2563417 (2.5 MB) TX bytes:688741 (688.7 KB)
          Interrupt:20 Memory:f2500000-f2520000

lo Link encap:Local Loopback
          inet addr:127.0.0.1 Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING MTU:16436 Metric:1
          RX packets:7089 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7089 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:551439 (551.4 KB) TX bytes:551439 (551.4 KB)

# ip route show
default via 192.168.1.254 dev eth0 metric 100
169.254.0.0/16 dev eth0 scope link metric 1000
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.30
# start network-manager
network-manager start/running, process 7004
# # Enable networking in network-manager
# NM connects to wireless network
# ifconfig
eth0 Link encap:Ethernet HWaddr f0:de:f1:6b:22:bf
          inet addr:192.168.1.30 Bcast:192.168.1.255 Mask:255.255.255.0
          inet6 addr: fe80::f2de:f1ff:fe6b:22bf/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
          RX packets:4497 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4848 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2580263 (2.5 MB) TX bytes:702714 (702.7 KB)
          Interrupt:20 Memory:f2500000-f25...

Read more...

summary: - NM confused by combination of static and dynamic configured interfaces
+ NM assigns a lower metric to the default route over wlan than ifup
+ assigns to the default route over eth.
Changed in network-manager (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
Thomas Hood (jdthood) wrote :

I tried to work around this problem by means of the "metric" option in /etc/network/interfaces but I did not succeed. The smallest value allowed is 1 whereas the metric assigned by NM to the route to the default gateway via wlan0 is 0.

I suggest that NM assign a value higher than 0 to the route so that it's possible to use the "metric" option in /e/n/i to give a lower metric to a route via another interface. The value 100 (ifup's default) might be a good choice.

Revision history for this message
Thomas Hood (jdthood) wrote :

Here's a reference with some relevance for the present report.

https://live.gnome.org/NetworkManager/SystemSettings#ifupdown

"The ifupdown plugin also uses [...] NetworkManager.conf (0.8.1 and later) for some configuration. All ifupdown-specific options go in a "[ifupdown]" section. If the "managed" key is set to "false", then any device listed in /etc/network/interfaces will be completely ignored by NetworkManager. Remember that NetworkManager controls the default route, so because the device is hidden, NetworkManager will assign the default route to some other device."

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.