I have a raspberry pi 4B 1GB running Pi OS Bookworm 64 bit Lite, that I normally connect to using its hostname (p1s-cam.local) via ssh or sftp. The rpi is connected to my LAN via both ethernet and wifi, which I can see using ethtool, nmcli, ifconfig, etc. The ethernet and wifi interfaces each have a separate ipv4 and ipv6 local address assigned to them - it seems this was done automatically/via DHCP from the router.
The problem I have is that despite the fact that ethernet is connected, recently when I connect using the local address/hostname it always connects using wifi instead of ethernet.
How can I fix this so that the local address always uses the ethernet connection if it is plugged in, and falls back to using wifi if ethernet is not available?
I thought this was supposed to be the default behaviour but it seems like it's not working.
I confirmed that the hostname was using wifi by doing a simple iperf test, using the pi as a host/server, and then connecting to it from my PC using the local address, the ethernet IP address, and the wifi IP address. Wifi and the local address both showed a slow speed of 40Mbps, whereas connecting using the ethernet IP address showed just under gigabit speed (948 Mbps) which is what I would expect.
I tried to fix the problem already by changing some things in nmcli, such as increasing the ipv4.route-metric for the wifi (preconfigured) connection from the default of -1 (the same as the ethernet connection) to 200 in order to make it prefer ethernet.
For some reason, the ethernet connection (Wired connection 1) was also setup with a really low priority by default:
So I increased the connection.autoconnect-priority for ethernet to 100 instead. However neither of these things have fixed the issue, even after restarting the pi.
The problem I have is that despite the fact that ethernet is connected, recently when I connect using the local address/hostname it always connects using wifi instead of ethernet.
How can I fix this so that the local address always uses the ethernet connection if it is plugged in, and falls back to using wifi if ethernet is not available?
I thought this was supposed to be the default behaviour but it seems like it's not working.
I confirmed that the hostname was using wifi by doing a simple iperf test, using the pi as a host/server, and then connecting to it from my PC using the local address, the ethernet IP address, and the wifi IP address. Wifi and the local address both showed a slow speed of 40Mbps, whereas connecting using the ethernet IP address showed just under gigabit speed (948 Mbps) which is what I would expect.
I tried to fix the problem already by changing some things in nmcli, such as increasing the ipv4.route-metric for the wifi (preconfigured) connection from the default of -1 (the same as the ethernet connection) to 200 in order to make it prefer ethernet.
For some reason, the ethernet connection (Wired connection 1) was also setup with a really low priority by default:
Code:
nmcli --fields autoconnect-priority,name connectionAUTOCONNECT-PRIORITY NAME-999 Wired connection 10 lo0 preconfiguredStatistics: Posted by Snelso91 — Sat Jan 25, 2025 12:17 pm