Comment 6 for bug 47379

Revision history for this message
Thomas Hood (jdthood) wrote : Re: NM confused by combination of static and dynamic configured interfaces

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-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:7878 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7878 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:609728 (609.7 KB) TX bytes:609728 (609.7 KB)

wlan0 Link encap:Ethernet HWaddr a0:88:b4:71:83:10
          inet addr:192.168.1.21 Bcast:192.168.1.255 Mask:255.255.255.0
          inet6 addr: fe80::a288:b4ff:fe71:8310/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
          RX packets:36848 errors:0 dropped:0 overruns:0 frame:0
          TX packets:26844 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:34907153 (34.9 MB) TX bytes:5777846 (5.7 MB)

# ip route show
default via 192.168.1.254 dev wlan0 proto static
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
192.168.1.0/24 dev wlan0 proto kernel scope link src 192.168.1.21 metric 2
# netstat -nr
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 192.168.1.254 0.0.0.0 UG 0 0 0 wlan0
0.0.0.0 192.168.1.254 0.0.0.0 UG 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
=============================================

Here's how it looks when NM controls both eth0 and wlan0:
=============================================
# ip route show
default via 192.168.1.254 dev eth0 proto static
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.20 metric 1
192.168.1.0/24 dev wlan0 proto kernel scope link src 192.168.1.21 metric 2
=============================================