I want my Linux laptop to connect to ethernet automatically when the ethernet cable is plugged in. Right now, if the laptop is connected to wifi, it will stay connected to wifi even after the ethernet cable is plugged in.
Here is the output of nmcli -f NAME,UUID,AUTOCONNECT,AUTOCONNECT-PRIORITY c
:
NAME UUID AUTOCONNECT AUTOCONNECT-PRIORITY
MySpectrumWifid2-5G d0358859-15c5-43a5-a617-617e9735bd5e yes 0
enp0s31f6 08db2aad-a10f-4068-93f1-4fe7f8c902b2 yes 10
lo 01eb66ee-0146-4b4e-94a4-ea5372417450 no 0
By using ip route get
, I can confirm it still uses the wifi even when the cable is plugged in.
I can force the connection to change by adding low-metric routes using ip route add
, but they go away when I unplug the cable.
nmcli c up enp0s31f6
whenever the ethernet cable is plugged in.nmcli con show enp0s31f6
or/etc/NetworkManager/system-connections/enp0s31f6
?