0

I have a Raspberry Pi 4 running bookworm.

It has a cellular modem attached via USB (interface usb0)and a Wireless connection (interface wlan0).

The usb0 has a metric of 100 and the wlan0 a metric of 600. It appears because the usb0 has a lower metric I can not connect over LAN (wlan0) connection when the modem is active.

Guide I found talked about editing the /etc/dhcpcd.conf - but this file does not exist on newer versions of Rpi OS.

How can I set the wlan0 to have a lower metric?

Al Grant
  • 103
  • 5

1 Answers1

1

The command nmcli connection edit WiFi… puts you in interactive mode.

nmcli connection show will show you existing connections & what it chooses to call them (which is not standardised) e.g. if you preconfigure on the imager it is called preconfigured.

Under the networking icon select network Advanced Options Edit Connection ⚙︎, IPv4 Settings, Routes has an option to Add metric (you might want to ignore automatically obtained routes)

You can edit /etc/NetworkManager/system-connections/WiFi….nmconnection but I have not tried setting metric there and defaults are not shown.

I didn't say it was easy! NetworkManager can do practically anything BUT finding the right incantation is a bit hit & miss and I am still learning.

You can, of course select dhcpcd instead.


I have tried sudo nmcli connection modify 'WiFi…' ipv4.route-metric 50 which appears to work.

This sets in .nmconnection

[ipv4]
method=auto
route-metric=50
Milliways
  • 62,573
  • 32
  • 113
  • 225