I have a machine with a built-in NIC (eth0), which serves as a DHCP server for a Raspberry Pi. I also have a USB 3G modem, which shows up as ethernet device eth1. eth0 has the static ip in /etc/network/interfaces. When I connect the Pi to the server, /var/log/syslog shows

NetworkManager[2366]: <info> Policy set 'Ifupdown (eth0)' (eth0) as default for IPv4 routing and DNS.

and after, ip route show gives

default via dev eth0  proto static

I then need to manually

ip route delete default
ip route add default via

to get it to connect to the internet via the 3G modem again. I am using CrunchBang Linux, based on Debian 7 wheezy, on the server, and the latest Raspbian on the Pi.

How can I choose the default pathway for NetworkManager to prefer?

Edit: here's my /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

allow-hotplug eth0
auto eth0
iface eth0 inet static

allow-hotplug eth1
auto eth1
iface eth1 inet dhcp

Note that I've changed /etc/NetworkManager/NetworkManager.conf to have


because I want to be able to disconnect eth1, the 3G Modem, using nm-applet. Here's /etc/NetworkManager/NetworkManager.conf:


  • Don't you have two default routes at some point? – Konrad Gajewski May 13 '15 at 23:01
  • ip route show only ever shows one default route. What I'd like to know is, where does NetworkManager define its preferred route - which keeps overriding my manual setting. – appas May 13 '15 at 23:07
  • In connections. It's either in gui, accessible through nmcli, or under /etc/NetworkManager/system-connections/ – Konrad Gajewski May 13 '15 at 23:12
  • I'm not sure what you're asking. In the nm-applet GUI, I have entries for both wired connections, with eth0 listed as ifupdown (eth0). The problem is that when connected, this connection will cause nm-applet to notify "You are now connected to 'ifupdown (eth0)' " and the "Policy set" message to appear in syslog. – appas May 13 '15 at 23:23
  • what is the content of /etc/NetworkManager/NetworkManager.conf ? – user2196728 May 14 '15 at 0:00

If using GUI, try checking the "Use only for resources on this connection" checkbox.

If using the config files (like you are :) ), in the [ipv4] section add never-default=true .

This way you will be able to delete the default route going in the tunnel & add your own.

|improve this answer|||||
  • Thanks a lot! editing config helped me to make internet open on my wifi, ifmetric did not help. ifmetric not working with network manager? – Alexei Martianov Mar 17 '18 at 6:23
  • That question is a bit offtopic, but it also seems like coming from a time machine. Looks like the latest version of ifmetric came out in 2004... – Richlv Mar 18 '18 at 17:48
  • :-) I've just recently started to use Linux on a regular basis, now trying things found by internet search, some are still valid, some are not... Does there any way to insert line to file in specific section by bash script? I want to write a script to configure my Linux after install automatically next time to suit my needs. – Alexei Martianov Mar 22 '18 at 18:01
  • This is getting completely offtopic now :) I'd suggest checking out corresponding manpages and then IRC channels of bash and sed. – Richlv Mar 22 '18 at 21:51

I'm 4 years late, but I've just spent 12 hours discovering and then fixing this issue. Similar situation here: ARM based Jetson Nano running Linux 4 Tegra kernel and Ubuntu 18.04 OS, with the Ethernet port (eth0) used for a local network and a USB Cellular dongle (eth1) used for Internet.

Symptoms are similar - once the Ethernet cable is plugged in the interface is brought up, then 3 minutes later I get:

NetworkManager[3773]: [1562908622.2587] policy: set 'Wired connection 1' (eth0) as default for IPv4 routing and DNS

in syslog and the internet connection is dropped.

NetworkManager works in mysterious ways that are difficult to program around - much better suited to having a user sitting in front that can reset things if necessary. I don't have that luxury, so had to make it work.

Ultimately what worked was to set the ipv4.route-metric lower (higher priority) on eth1. Check the output of route -n to see what the current metrics are. Ignore the additional 20000 on some routes - this is NetworkManager trying to de-prioritise routes that don't have Internet connectivity, but it's screwy.

So say eth0 has a metric of 100. Prioritise your eth1 interface with:

sudo nmcli con mod "Wired connection 2" ipv4.route-metric 99

And reboot.

Now to save you 10 hours of troubleshooting - note that the route metric is independent of the DNS priority! So if you still have connectivity issues, make sure it's not a DNS resolution issue (eg. your DHCP server is providing a dummy resolution service). If it is, then increase the ipv4.dns-priority of your eth0 connection to make it lower priority, and/or make sure the ipv4.dns-search of your eth1 is set to "~" to make it the go-to option.

|improve this answer|||||

Network manager will always override your settings, You must edit:

vi /etc/network/interfaces

Find the eth0 and set:


Re start network service:

/etc/init.d/networking restart
|improve this answer|||||
  • 1
    I did this, but as soon as I connect interface eth0, I get the NetworkManager[2366]: <info> Policy set 'Ifupdown (eth0)' (eth0) as default for IPv4 routing and DNS and ip route show will show default via dev eth0 proto static. – appas May 13 '15 at 23:39
  • I'm confused, if manager will overwrite, why edit that default old location, not manager config files? On my Linux interfaces file contains info only about lo. – Alexei Martianov Mar 22 '18 at 18:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.