Score:1

Frequent switches between Ethernet and Wifi

ru flag

I'm using a Thinkpad docking station with a Thinkpad T480s, which runs Ubuntu 20.04.

The docking station is connected via Ethernet.

I have wired connection, wifi and also mobile broadband configured to connect automatically via sudo nm-connection-editor. Also, I give the wired connection priority 2, the wifi priority 1 and the broadband connection priority 0.

When I'm connected to the docking station, it usually runs on wired, but all of a sudden it changes to wifi and then back after a couple of seconds, always resulting in a short connection loss, which is especially annoying when on a video call. I also have the feeling that it happens more often during video calls, but here I might be biased.

How could that be? It happens at home and also in the office, at both places I'm using the same docking station.

Haven't tried connecting the Ethernet cable directly to the laptop though..

UPDATE: Here's a view of the logs (sudo journalctl -b 0 -u NetworkManager -p 7):

Feb 17 10:53:24 xxx-5 NetworkManager[357866]: <info>  [1645091604.0138] policy: set 'Sunrise' (wwan0) as default for IPv4 routing and DNS
Feb 17 10:53:24 xxx-5 NetworkManager[357866]: <info>  [1645091604.7573] manager: NetworkManager state is now CONNECTED_GLOBAL
Feb 17 10:53:24 xxx-5 NetworkManager[357866]: <info>  [1645091604.7590] policy: set 'xxx-x' (wlp61s0) as default for IPv4 routing and DNS
Feb 17 10:58:44 xxx-5 NetworkManager[357866]: <info>  [1645091924.3914] manager: NetworkManager state is now CONNECTED_SITE
Feb 17 10:58:44 xxx-5 NetworkManager[357866]: <info>  [1645091924.3926] manager: NetworkManager state is now CONNECTED_LOCAL
Feb 17 10:58:44 xxx-5 NetworkManager[357866]: <info>  [1645091924.3929] manager: NetworkManager state is now CONNECTED_SITE
Feb 17 10:58:44 xxx-5 NetworkManager[357866]: <info>  [1645091924.3931] policy: set 'Sunrise' (wwan0) as default for IPv4 routing and DNS
Feb 17 10:58:53 xxx-5 NetworkManager[357866]: <info>  [1645091933.8794] manager: NetworkManager state is now CONNECTED_GLOBAL
Feb 17 10:58:53 xxx-5 NetworkManager[357866]: <info>  [1645091933.8809] policy: set 'xxx-x' (wlp61s0) as default for IPv4 routing and DNS
Feb 17 10:59:55 xxx-5 NetworkManager[357866]: <info>  [1645091995.6824] policy: set 'xxx-x ethernet via usb-c' (enx083a885a6802) as default for IPv4 routing and DNS

So in this period depicted above (~6mins), the network switched from mobile broadband to Wifi to mobile broadband to Wifi and then to Ethernet. But that's all the info I get, no errors or anything. There doesn't seem to be any debug messages.

UPDATE: I made sure my Thunderbolt 3 Dock runs the latest available firmware. According to fwupdmgr, I'm running version 56.00

20L7001NMZ
│
├─ThinkPad Thunderbolt 3 Dock:
│ │   Device ID:          c1ab0998129c6116e14b27922063a6285c110599
│ │   Current version:    56.00
│ │   Vendor:             Lenovo (THUNDERBOLT:0x0108, TBT:0x0108)

If I run fwupdmgr get-updates, I see that it is the latest available:

Devices with no available firmware updates: 
 • ThinkPad Thunderbolt 3 Dock

However there seem to be a couple of newer firmware updates which are not yet available through fwupdmgr: https://download.lenovo.com/pccbbs/mobiles/trdockfw3180_readme.txt None of them mention anything wrt Ethernet though.

waltinator avatar
it flag
Look at the logs! `sudo journalctl -b 0 -u NetworkManager`. Read `man journalctl`.
grssnbchr avatar
ru flag
Thanks - I'll note down when it happens and post here what the log says.
heynnema avatar
ru flag
Check for a firmware update for the docking station.
grssnbchr avatar
ru flag
I updated the post with the logs. Anything useful? (not to me...)
heynnema avatar
ru flag
Did you check the firmware as I suggested two days ago?
heynnema avatar
ru flag
Example: See https://support.lenovo.com/us/en/downloads/ds506176 and https://support.lenovo.com/us/en/downloads/ds501903-thinkpad-usb-c-dock-firmware. Need EXACT dock model/serial # to get the exact firmware download.
grssnbchr avatar
ru flag
Yes, sorry, forgot to mention that. Accordingly, I'm on the latest state...
Score:1
in flag

I had a problem last year:

The solution there could work for you:


A script that automatically disables WiFi when Ethernet (Network) is connected:

#!/bin/bash
export LC_ALL=C

enable_disable_wifi ()
{
    result=$(nmcli dev | grep "ethernet" | grep -w "connected")
    if [ -n "$result" ]; then
        nmcli radio wifi off
    else
        nmcli radio wifi on
    fi
}

if [ "$2" = "up" ]; then
    enable_disable_wifi
fi

if [ "$2" = "down" ]; then
    enable_disable_wifi
fi

The script has to be created in a specific directory. After creation mark it executable:

chmod a+x /etc/NetworkManager/dispatcher.d/70-wifi-wired-exclusive.sh
grssnbchr avatar
ru flag
This seems like to be the best and pragmatic solution. It works out of the box. I first tried a hack that would detect whether I'm connected to the dock, but that only worked half-way. https://gist.github.com/seanf/e3be5bf745395d50e975 Let me thoroughly test and then I'll accept your answer. Thanks!
Score:0
to flag

Do you have a WiFi with 2.4GHz and 5GHz active on the same name / SSID? Had a similar issue (without the broadband) where it switched from wireless to wired because it tried to switch from 2.4GHz to 5GHz. But somehow the driver and/or hardware got a timeout and the network manager switched to wired instead. --> I now use two separate SSIDs for the wireless networks

Score:0
za flag
SLS

Under normal use in most cases Ubuntu will prioritize the connection with the best bandwidth and latency: assumed Ethernet first, then WiFi, then Wlan. If for some reason one of these connections are not stable enough; as in the example mentioned by Raven above, it will switch to the connection that is stable. Do check the routing table to see the priorities of what interface is used (sudo apt install net-tools then use the route command). Please note that you can simply turn off WiFi in the Gnome settings or in the Gnome drop down menu in the upper right corner; alternatively in the KDE panel's network icon: witch would force the use of the Ethernet. Same goes for the Wlan. I you do not want to operate like this; at least this would let you see if the Ethernet connection may have an issue intermittently, that could simply be a hardware fault.

Score:-1
lu flag

Are you trying to get wireless, or wired. If you want wireless, try connecting to wired then going to additional drivers and installing a wireless driver. If you want wired, try going to the file /etc/NetworkManager/NetworkManager.conf, then change managed=false to managed=true. After that, run sudo service network-manager restart in the terminal.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.