I have internet on my RPi via 4G USB dongle, modem connection managed by NetworkManager (Raspbian/debian 10) using /dev/ttyUSB0. I have also OpenVPN tunnel active. Now I wanted to share this internet connection via ethernet eth0 (with Wifi AP connected to it by cable). So I added new NetworkManager connection nmcli connection add type ethernet ifname eth0 ipv4.method shared con-name ethShared. However when I connect anything to eth0, RPi loses internet access because of NetworkManager adding default gateway via eth0 for some reason.

root@rpi3meteo:~# ip route
default dev eth0 scope link src metric 202
default via dev wwan0 proto static metric 700 via dev tun0 dev tun0 proto kernel scope link src dev eth0 proto kernel scope link src metric 100 dev wwan0 proto kernel scope link src metric 700 dev eth0 scope link src metric 202

Also for some reason eth0 gets 2 IP addresses - which is used also by internal DHCP server and also (which is used in the spurious route table entry). I know is link-local and for use without DHCP server, but don't know why NetworkManager configures it for connection of type "shared", which does have DHCP automaticaly provided by NetworkManager.

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether b8:27:eb:20:80:80 brd ff:ff:ff:ff:ff:ff
    inet brd scope global noprefixroute eth0
       valid_lft forever preferred_lft forever
    inet brd scope global noprefixroute eth0
       valid_lft forever preferred_lft forever
3: wwan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000
    link/ether 00:1e:10:1f:00:00 brd ff:ff:ff:ff:ff:ff
    inet brd scope global noprefixroute wwan0
       valid_lft forever preferred_lft forever
4: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 100
    inet peer scope global tun0
       valid_lft forever preferred_lft forever

Internet access for both RPi and Wifi clients start to work when I manually remove the spurious route via route del default dev eth0. However as the RPi is at a remote location, it needs to work even after a reboot without manual intervention.

I already tried to set ipv4.never-default parameter, but it didn't help. Also already tried to manually set the IP address range via ipv4.addresses. I also found a workaround with altering priority of the default route (ipv4.route-metric ) and dns (ipv4.dns-priority), but didn't have time to test it yet, however I am more interested in preventing it happen in the first place, or having NetworkManager deleting the route automatically each time the connection is activated.

connection.id:                          ethShared
connection.stable-id:                   --
connection.type:                        802-3-ethernet
connection.interface-name:              eth0
connection.autoconnect:                 yes
connection.autoconnect-priority:        0
connection.autoconnect-retries:         -1 (default)
connection.multi-connect:               0 (default)
connection.auth-retries:                -1
connection.master:                      --
connection.slave-type:                  --
connection.autoconnect-slaves:          -1 (default)
connection.secondaries:                 --
connection.gateway-ping-timeout:        0
connection.metered:                     unknown
connection.lldp:                        default
connection.mdns:                        -1 (default)
connection.llmnr:                       -1 (default)
802-3-ethernet.port:                    --
802-3-ethernet.speed:                   0
802-3-ethernet.duplex:                  --
802-3-ethernet.auto-negotiate:          no
802-3-ethernet.mac-address:             --
802-3-ethernet.cloned-mac-address:      --
802-3-ethernet.mac-address-blacklist:   --
802-3-ethernet.mtu:                     auto
802-3-ethernet.s390-subchannels:        --
802-3-ethernet.s390-nettype:            --
802-3-ethernet.s390-options:            --
802-3-ethernet.wake-on-lan:             default
802-3-ethernet.wake-on-lan-password:    --
ipv4.method:                            shared
ipv4.dns:                               --
ipv4.dns-search:                        --
ipv4.dns-options:                       ""
ipv4.dns-priority:                      0
ipv4.addresses:                         --
ipv4.gateway:                           --
ipv4.routes:                            --
ipv4.route-metric:                      -1
ipv4.route-table:                       0 (unspec)
ipv4.ignore-auto-routes:                no
ipv4.ignore-auto-dns:                   no
ipv4.dhcp-client-id:                    --
ipv4.dhcp-timeout:                      0 (default)
ipv4.dhcp-send-hostname:                yes
ipv4.dhcp-hostname:                     --
ipv4.dhcp-fqdn:                         --
ipv4.never-default:                     no
ipv4.may-fail:                          yes
ipv4.dad-timeout:                       -1 (default)
GENERAL.NAME:                           ethShared
GENERAL.DEVICES:                        eth0
GENERAL.STATE:                          activated
GENERAL.DEFAULT:                        yes
GENERAL.DEFAULT6:                       no
GENERAL.SPEC-OBJECT:                    --
GENERAL.VPN:                            no
GENERAL.ZONE:                           --
GENERAL.MASTER-PATH:                    --
IP4.ROUTE[1]:                           dst =, nh =, mt = 100
IP4.ROUTE[2]:                           dst =, nh =, mt = 202
IP4.ROUTE[3]:                           dst =, nh =, mt = 202

1 Answer 1


I didn't found a solution, but at least found a workaround to get it working. I tried to change the route metrics as advised in this answer.

Setting the ipv4.route-metric on the ethShared connection to higher value (lower priority) didn't work, because it did not affect the spurious route via at all.

So I ended up setting ipv4.route-metric for the 4G modem connection from default 700 to 99 (so it has now higher priority than the ethernet's 202 priority).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .