Skip to main content
Topic: Wifi then Ethernet -> no route (Read 4284 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Wifi then Ethernet -> no route

Hi
I have this behavior, that when I am connected on WIFI, and then I plug Ethernet cable, both are connected but I have to disconnect wifi to be able to browse internet.

On other distros, afaik you don't have to do that.

Does someone know how I can fix this?

Re: Wifi then Ethernet -> no route

Reply #1
Most likely this has to do with whatever you use to connect to networks. If you're using networkmanager, I would think it would do this for you, but I don't really know since I don't personally use it. What do you use to connect to networks exactly?

Re: Wifi then Ethernet -> no route

Reply #2
Indeed. I use NetworkManager  - on KDE Plasma.

Re: Wifi then Ethernet -> no route

Reply #3
NM probably keeps 2 default routes simultaneously. What's the output of route when both interfaces are connected?

Re: Wifi then Ethernet -> no route

Reply #4
Wifi only:

$ ip a
...
2: wlp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    inet 192.168.0.30/24 brd 192.168.0.255 scope global dynamic noprefixroute wlp1s0
...

$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.0.254   0.0.0.0         UG    600    0        0 wlp1s0
127.0.0.0       localhost       255.0.0.0       UG    0      0        0 lo
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0
172.18.0.0      0.0.0.0         255.255.0.0     U     0      0        0 br-db8a7800fecc
192.168.0.0     0.0.0.0         255.255.255.0   U     600    0        0 wlp1s0

After Ethernet plugged (via usb):

$ ip a
(all same except this added:)
28: enp0s20f0u2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:50:b6:c8:7d:91 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.16/24 brd 192.168.0.255 scope global dynamic noprefixroute enp0s20f0u2
       valid_lft 863985sec preferred_lft 863985sec
    inet6 fe80::c30:1b2a:6c74:3eb2/64 scope link noprefixroute
       valid_lft forever preferred_lft forever

$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.0.254   0.0.0.0         UG    600    0        0 wlp1s0
default         192.168.0.254   0.0.0.0         UG    20100  0        0 enp0s20f0u2
127.0.0.0       localhost       255.0.0.0       UG    0      0        0 lo
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0
172.18.0.0      0.0.0.0         255.255.0.0     U     0      0        0 br-db8a7800fecc
192.168.0.0     0.0.0.0         255.255.255.0   U     100    0        0 enp0s20f0u2
192.168.0.0     0.0.0.0         255.255.255.0   U     600    0        0 wlp1s0


So it seems my ADSL box has misconfiguration: it shall not put both cards in the same network ;-)
Nothing to do with Linux since it is DHCP.

Re: Wifi then Ethernet -> no route

Reply #5
Confirmed.

I had configured that DSL Box somewhere in 2018 with static DHCP for the wlan (static meaning "based on mac address"). Now removed.
Now when I connect both, the config is same but for some reason it works.

$ ip a
2: wlp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    inet 192.168.0.30/24 brd 192.168.0.255 scope global dynamic noprefixroute wlp1s0
..
30: enp0s20f0u2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    inet 192.168.0.16/24 brd 192.168.0.255 scope global dynamic noprefixroute enp0s20f0u2


$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.0.254   0.0.0.0         UG    100    0        0 enp0s20f0u2
default         192.168.0.254   0.0.0.0         UG    20600  0        0 wlp1s0
127.0.0.0       localhost       255.0.0.0       UG    0      0        0 lo
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0
172.18.0.0      0.0.0.0         255.255.0.0     U     0      0        0 br-db8a7800fecc
192.168.0.0     0.0.0.0         255.255.255.0   U     100    0        0 enp0s20f0u2
192.168.0.0     0.0.0.0         255.255.255.0   U     600    0        0 wlp1s0

First time I see  2 default gateways ;-)

Re: Wifi then Ethernet -> no route

Reply #6
nm-connection-editor
This is a config GUI for NetworkManager and it has a field to set the 'priority' of your connections to select the preferred one if more than one is available.
When installed it might be found under a Settings menu as Advanced Network Configuration or you can use nm-connection-editor in a terminal to start it too.
It's in the world repo and only depends on libnma so it looks independent of GTK or QT choices. There are lots of other settings too, including VPN, Bluetooth, IP tunnel, all sorts of stuff. You can set 'priority' other ways too, including commandline options. Well that's what some people say anyway, I haven't tried the priority feature, but nm-connection-editor did work to connect to wifi easily at least, just add SSID and pw.  ;D

Re: Wifi then Ethernet -> no route

Reply #7
Hi, thanks. Today I learned something ;-)

NetworkManager's detailed network screen  looks very close to nm-connection-editor's: the order & position of the inputs are the same.
I wasn't aware of that option "Connect automatically with priority", Both have it.

Re: Wifi then Ethernet -> no route

Reply #8
Actually I was wrong and nm-connection-editor DOES depend on GTK, as libnma requires GTK3.

First I just installed these:
$ yay -S networkmanager-openrc
Packages (14) bluez-libs-5.50-6.1  gpm-1.20.7.r27.g1fd1941-1  libmm-glib-1.10.0-1  libndp-1.7-1  libnewt-0.52.20-2  libnm-1.18.0-1  libnm-glib-1.18.0-1  libpgm-5.2.122-3
              libsodium-1.0.17-1  libteam-1.28-2  networkmanager-1.18.0-1  slang-2.3.2-1  zeromq-4.3.1-2  networkmanager-openrc-20180428-1
But there didn't seem to be any GUI at all. So I removed those and started again:
$ yay -S network-manager-applet nm-connection-editor networkmanager-openrc
Packages (19) bluez-libs-5.50-6.1  gcr-3.28.1-1  gpm-1.20.7.r27.g1fd1941-1  libmm-glib-1.10.0-1  libndp-1.7-1  libnewt-0.52.20-2  libnm-1.18.0-1  libnm-glib-1.18.0-1
              libnma-1.8.21dev+3+gb4c365b1-1  libpgm-5.2.122-3  libsodium-1.0.17-1  libteam-1.28-2  mobile-broadband-provider-info-20190116-1  networkmanager-1.18.0-1
              slang-2.3.2-1  zeromq-4.3.1-2  network-manager-applet-1.8.21dev+3+gb4c365b1-1  networkmanager-openrc-20180428-1  nm-connection-editor-1.8.21dev+3+gb4c365b1-1
This worked after enabling the NetworkManager service and using the GUI. The applet looks like a bar graph and appears next to the power symbol although I did not notice it at first.
But where is your alternate GUI from?
Perhaps you have a QT GUI that performs the same function, possibly:
networkmanager-qt
so that would be the better choice for KDE or LXQT, although if you already had other GTK apps installed it might not matter too much.

Re: Wifi then Ethernet -> no route

Reply #9
After using NetworkManager a bit it's not so great, now the connection is a bit slow it kept losing connection, and putting a window onscreen asking for the wifi password, despite the fact it already had been configured with the password. So I kept closing that window then clicking 'reconnect' on the applet menu which worked. Then I got fed up so clicked disconnect and did some other things offline, but could not connect later as no networks at all were shown. So I had to reboot then. Perhaps it needs more config but it does seem a bit unreliable as installed.  :(

Re: Wifi then Ethernet -> no route

Reply #10
Wifi only:

$ ip a
...
2: wlp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    inet 192.168.0.30/24 brd 192.168.0.255 scope global dynamic noprefixroute wlp1s0
...

$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.0.254   0.0.0.0         UG    600    0        0 wlp1s0
127.0.0.0       localhost       255.0.0.0       UG    0      0        0 lo
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0
172.18.0.0      0.0.0.0         255.255.0.0     U     0      0        0 br-db8a7800fecc
192.168.0.0     0.0.0.0         255.255.255.0   U     600    0        0 wlp1s0

After Ethernet plugged (via usb):

$ ip a
(all same except this added:)
28: enp0s20f0u2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:50:b6:c8:7d:91 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.16/24 brd 192.168.0.255 scope global dynamic noprefixroute enp0s20f0u2
       valid_lft 863985sec preferred_lft 863985sec
    inet6 fe80::c30:1b2a:6c74:3eb2/64 scope link noprefixroute
       valid_lft forever preferred_lft forever

$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.0.254   0.0.0.0         UG    600    0        0 wlp1s0
default         192.168.0.254   0.0.0.0         UG    20100  0        0 enp0s20f0u2
127.0.0.0       localhost       255.0.0.0       UG    0      0        0 lo
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0
172.18.0.0      0.0.0.0         255.255.0.0     U     0      0        0 br-db8a7800fecc
192.168.0.0     0.0.0.0         255.255.255.0   U     100    0        0 enp0s20f0u2
192.168.0.0     0.0.0.0         255.255.255.0   U     600    0        0 wlp1s0


So it seems my ADSL box has misconfiguration: it shall not put both cards in the same network ;-)
Nothing to do with Linux since it is DHCP.

the dhcpd is messed up - you have two routes going through 192.168.0.0

and BTW the default network is also duplicated to the network  gateway 192.168.0.254!  >>blink<< - Say what???

Re: Wifi then Ethernet -> no route

Reply #11
default         192.168.0.254   0.0.0.0         UG    20100  0        0 enp0s20f0u2

20100 ????

Re: Wifi then Ethernet -> no route

Reply #12
So having removed Network Manager and installing WICD instead, it shows me I have 2 wifi networks with the same SSID on different channels, because it's one of those newfangled dual band types - I think that was what must have been confusing Network Manager in my case,  when combined with a bit of distance and signal drop out. Possibly relevant to the double entries above? WICD has a check box under (arrow top right corner) preferences - always switch to a wired connection when available. I've only tried WICD for a few minutes so far though.

Re: Wifi then Ethernet -> no route

Reply #13
that is not likely the problem.  The problem is that the ethernet needs to take priority over the wifi and the wifi should drop even if they are on the same network.  There is not really easy way to solve this without using the command line.  Turn off the wifi

It would also help if your DHCP Server was set up correctly.

Re: Wifi then Ethernet -> no route

Reply #14
I think Nadir's problem could be resolved by GUI, reading more about this, using the priority settings, and configuring the dual band wireless better (if that is an issue). Say you have 2 wireless networks with the same SSID, this confuses network manager in itself. Disconnect from one then it connects to the other, as the standard ethernet priority is set  to the lowest, -999 and both wireless networks, even if they are identified separately will be 10 or whatever they were as default.  So do something about that. And also separate the two networks -  change the router settings (if it's possible), but it's worth noting that common ISP provided routers do seem to give both 2.4 and 5GHz bands the same SSID and passphrase as the standard setting so this is probably quite a common situation. The other way is not give the SSID to network manager but use the BSSID instead, so network manager can tell them apart instead of creating double entries and apparently suffering a logic breakdown.
There are some network manager guides online that might help.
Or use wicd, which can automatically tell there are 2 different networks but with the same SSID, without having to be told about this! That's what I'm using now and still without issues.
Can any of them use the 2 bands simultaneously I wonder - sadly my router doesn't support this so I couldn't say. I was actually surprised my wireless card could even see the second network, I didn't know it could do dual band.
Manual config is great to make a simple connection at home, but not in some instances if I need to connect quickly to someone elses unknown network. I've been using manual config of dhcpcd and wpa-supplicant but with the SSID and I think that was causing problems there too, occasionally getting a slow connection, probably due to randomly hooking up to the 'wrong' network, so this has revealed something useful there too.