How can I stop traffic from going over Wi-Fi when Ethernet is connected?

I’m running EndeavourOS from the Cassini Nova 03 2003 R3 release with the latest updates from eos-update --yay, and booting into the LTS kernel 6.1.56-1-lts. I’m running the KDE Plasma desktop environment. My hardware is an Apple MacBook4,1, and the on-board networking equipment is as follows:

02:00.0 Ethernet controller [0200]: Qualcomm Atheros AR242x / AR542x Wireless Network Adapter (PCI-Express) [168c:001c] (rev 01)
        Subsystem: Apple Inc. AirPort Extreme [106b:0086]

03:00.0 Ethernet controller [0200]: Marvell Technology Group Ltd. 88E8058 PCI-E Gigabit Ethernet Controller [11ab:436a] (rev 13)
        Subsystem: Marvell Technology Group Ltd. Imac 8,1 Wired Ethernet Adapter [11ab:00ba]

Networking in general is working fine, except when I’m connected to both Wi-Fi and Ethernet. In this case, traffic seems to route unpredictably over both the Wi-Fi and Ethernet networks. It’s possible that it may be working as designed, but the issue is that my Wi-Fi network is considerably slower than Ethernet, so I’d rather not send traffic over Wi-Fi at all when Ethernet is available. My current solution is to disable Wi-Fi manually from the system tray widget whenever I connect to Ethernet, and re-enable it manually when I disconnect from Ethernet.

Is there any way to force the system not to route traffic over Wi-Fi at all when Ethernet is connected, or alternatively, to automatically disable Wi-Fi completely when Ethernet is connected?

https://man.archlinux.org/man/route.8.en

You can create a route to 0.0.0.0 for the ethernet address with a better metric, but as far as I understand, that should be the default already.

Based on this, I wonder if your Ethernet connection is not flapping…

Or, you could just increase the metric of the Wifi adapter so it is not the preferred default route.

I have both WiFi and Ethernet on my system and i just turn WiFi on in KDE only when i want it otherwise i use ethernet because it’s always going to be faster than WiFi.

Edit: I do have both connected sometimes as it makes no difference on my system. I can use both together or either one by just turning one on or off.

Edit: Topic #7 might be the answer you are looking for by setting up a script.

https://bbs.archlinux.org/viewtopic.php?id=230665

The TLP Radio Device Wizard (Arch Wiki page) tlp-rdw can disable WLAN when LAN is connected, and re-enable WLAN on LAN disconnect, if you use NetworkManager. See the TLP RDW Manual page at linrunner.de for details. As a bonus you’ll also get some power savings for your Macbook from installing tlp, a dependency of tlp-rdw.

Specifically you want the lines DEVICES_TO_DISABLE_ON_LAN_CONNECT="wifi wwan" and DEVICES_TO_ENABLE_ON_LAN_DISCONNECT="wifi wwan" to be uncommented in/etc/tlp.conf.