On Debian 12 (Bookworm) and Raspberry Pi OS Bookworm, dhcpcd has been deprecated and replaced by NetworkManager as the default network management stack. Consequently, /etc/dhcpcd.conf is no longer present.
When multiple network interfaces (such as Ethernet eth0 and Wi-Fi wlan0) are connected simultaneously, the Linux kernel determines the default gateway based on routing metrics. Lower metric values take precedence over higher values.
1. Inspect Current Routing Metrics
Check the existing routing table and metric values:
ip route show
# or:
route -n
2. List NetworkManager Connection Profiles
Identify the exact connection name you wish to adjust:
nmcli connection show
3. Adjust the Route Metric
You can set the route metric directly using a single nmcli command:
# Set metric to 100 for higher priority (e.g. Ethernet)
nmcli connection modify "Wired connection 1" ipv4.route-metric 100
# Reactivate the connection to apply changes
nmcli connection up "Wired connection 1"
Alternatively, you can edit the connection interactively:
nmcli connection edit "Wired connection 1"
nmcli> set ipv4.route-metric 100
nmcli> save
nmcli> quit
Run ip route show again to verify that your preferred connection now holds the lowest metric on the default route.
No comments:
Post a Comment