Skip to content

Prefer Ethernet Over Wi-Fi on Raspberry Pi

Use a lower route metric on the Ethernet profile to make it the primary route. Keep a higher-metric Wi-Fi default route available for when the Ethernet route disappears. First check the routes already installed on your Pi, since NetworkManager can assign suitable metrics automatically. NetworkManager route metrics

Check which connection the Pi uses

Run these on Raspberry Pi OS with NetworkManager. The route lookups use example addresses and show the choice Linux would make without sending traffic.

1
2
3
4
5
6
7
8
# List active profiles and their network interfaces.
nmcli -f NAME,UUID,TYPE,DEVICE connection show --active

# Compare installed default routes and select a route for each address family.
ip -4 route show default
ip -4 route get 203.0.113.10
ip -6 route show default
ip -6 route get 2001:db8::10

Compare the metrics for the default routes and read dev in each lookup. For two otherwise comparable default routes in the same routing table, the lower metric wins. A route to a specific network or a VPN policy can send traffic elsewhere. Use the actual destination IP when checking an application. If IPv6 has no usable route, focus first on the address family you use. Linux route lookup and metrics

Set the NetworkManager route metrics

Use a local console or a separate management connection before reactivating either profile. Copy the UUID for the active Ethernet profile and the Wi-Fi profile from the first command above. Record any existing values so you can restore them.

1
2
3
4
5
6
7
8
# Replace each placeholder with the UUID of the corresponding active profile.
wired=YOUR_ETHERNET_PROFILE_UUID
wifi=YOUR_WIFI_PROFILE_UUID
nmcli -g ipv4.route-metric,ipv6.route-metric connection show uuid "$wired"
nmcli -g ipv4.route-metric,ipv6.route-metric connection show uuid "$wifi"

sudo nmcli connection modify uuid "$wired" ipv4.route-metric 100 ipv6.route-metric 100
sudo nmcli connection modify uuid "$wifi" ipv4.route-metric 600 ipv6.route-metric 600

IPv4 and IPv6 each have their own route metric. With these example values, Ethernet wins when both profiles supply comparable default routes for the relevant protocol. A value of -1 lets NetworkManager choose a metric based on the device. NetworkManager IPv4 settings · NetworkManager IPv6 settings

Reactivate one connection at a time to apply the saved settings. Replace eth0 and wlan0 with the interface names from your Pi.

sudo nmcli connection up uuid "$wired" ifname eth0
sudo nmcli connection up uuid "$wifi" ifname wlan0

Rerun the route lookups. If you need to undo the change, restore the original values in each profile and reactivate them again. nmcli connection commands

Check what happens when Ethernet goes away

On Pi 4B with Trixie, two simulated links in an isolated network had default routes with metrics of 100 and 600. Both IPv4 and IPv6 lookups selected the lower metric. Removing that link made the lookups select the remaining route. In a separate check, NetworkManager saved both metric fields in a test profile without activating it.

With local access, you can test the same behavior by checking the route, disconnecting Ethernet, and checking again. Start a fresh application connection over Wi-Fi. Existing sessions can drop when their source address changes. If the Ethernet link stays up while the router loses internet access, the preferred route can remain installed. In that case check reachability separately. Network and DNS checks

Donate