You are not logged in.

#1 2018-03-08 12:07:53

lordbalmung
Member
Registered: 2016-04-12
Posts: 3

Choosing the default interface

I use WiFi for internet and Ethernet to connect my printer/scanner. Ethernet does not have internet and it is not always connected (i.e. the printer is turned off). When I turn on my printer, network manager detects a connection and adds a route through enp3s0 (Ethernet) overriding default through wlp4s0 (WiFi). As a result, I cannot browse when I am scanning/printing.

default via 192.168.2.1 dev enp3s0 proto static metric 20100

One way I get around this is by executing an ip route delete and removing the default through my Ethernet subnet. Is there a way to automatically define my default route when Ethernet comes alive?

My setup is:
Arch Linux - Recent update to Linux 4.15.7-1
Desktop Environment - Gnome (including extras)
Ethernet subnet - 192.168.2.0/24
WiFi subnet - 192.168.1.0/24

Offline

#2 2018-03-08 12:35:30

progandy
Member
Registered: 2012-05-17
Posts: 5,184

Re: Choosing the default interface

You should be able to set the preference with the metric. routes with lower metric values will be used before those with higher values.

If your networkmanager gui cannot do that, then you can do it with nmcli
http://blog.felipe.lessa.nom.br/?p=129


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#3 2018-03-08 15:30:01

rsmarples
Member
Registered: 2009-05-12
Posts: 287

Re: Choosing the default interface

dhcpcd has supported this for over 10 years now.
Assuming you use dhcpcd you can add this to dhcpcd.conf

interface enp3s0
    # Set the highest possible metric so that it's the least preferred
    metric 4294967295

Offline

#4 2018-03-08 16:01:44

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,427

Re: Choosing the default interface

But OP has already mentioned that he's using NetworkManager and networkmanager can configure that just the same.

Don't hijack threads

Offline

#5 2018-03-09 09:47:19

rsmarples
Member
Registered: 2009-05-12
Posts: 287

Re: Choosing the default interface

Sorry pardon for reading network manager (exactly what he wrote) as a generic term rather than the product name NetworkManager.

Offline

Board footer

Powered by FluxBB