Discussion
Loading...

Post

Log in
  • About
  • Code of conduct
  • Privacy
  • About Bonfire
Gary Parker :party_porg:
Gary Parker :party_porg:
@WiteWulf@cyberplace.social  ·  activity timestamp 3 days ago

#linux #networking connection (device is running moOde audio, effectively Debian Trixie): on a system with both wired and wireless connections (with addresses in the same subnet), how do I prioritise use of the wired connection, while keeping the wireless in case of connectivity issues?

  • Copy link
  • Flag this post
  • Block
Neil Brown
Neil Brown
@neil@mastodon.neilzone.co.uk replied  ·  activity timestamp 3 days ago

@WiteWulf

If you are using Network Manager / nmcli, does setting "connection.autoconnect-priority 100" on the wired network (or, rather, setting a higher priority on wired than the priority of WLAN) solve it?

Alternatively, could you have it bring up the WLAN automatically if the wired network fails?

A la https://neilzone.co.uk/2025/01/networkmanager-automatically-switch-between-ethernet-wi-fi-and-wwan/

NetworkManager: automatically switch between Ethernet, Wi-Fi, and WWAN

A couple of years ago, I wrote about using NetworkManager’s dispatcher.
⁂
More from
Neil Brown
  • Copy link
  • Flag this comment
  • Block
Ryan Clough :scremcat:
Ryan Clough :scremcat:
@CiscoJunkie@techhub.social replied  ·  activity timestamp 3 days ago

@neil @WiteWulf Depending on the system specifics, the first option recommended here might not work.

I'm on Ubuntu 25.10, and by default my wireless network (Gnosis) has a higher autoconnect-priority value:

❯ nmcli -f name,autoconnect,autoconnect-priority c
NAME AUTOCONNECT AUTOCONNECT-PRIORITY
Wired connection 1 yes -999
Gnosis yes 0
lo no 0

Looking at the route table, though, you'll see that we're doing the "right" thing and prioritizing the wired interface by setting a higher metric (600) on the wireless interface (wlp63s0).

❯ ip route
default via 192.168.1.1 dev enp11s0 proto dhcp src 192.168.1.168 metric 100
default via 192.168.1.1 dev wlp63s0 proto dhcp src 192.168.1.167 metric 600
192.168.1.0/24 dev enp11s0 proto kernel scope link src 192.168.1.168 metric 100
192.168.1.0/24 dev wlp63s0 proto kernel scope link src 192.168.1.167 metric 600

This is the default behavior for Debian, I think.

  • Copy link
  • Flag this comment
  • Block
Ryan Clough :scremcat:
Ryan Clough :scremcat:
@CiscoJunkie@techhub.social replied  ·  activity timestamp 3 days ago

@neil @WiteWulf Here's a good StackExchange answer on how to adjust route metrics in a persistent way:

https://unix.stackexchange.com/questions/344974/how-can-i-make-changes-to-the-network-routing-metric-permanently

Unix & Linux Stack Exchange

How can I make changes to the network routing metric permanently

I'm able change my network routing metrics with ifmetric, for example ifmetric enp0s3 1. Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0...
  • Copy link
  • Flag this comment
  • Block
Ryan Clough :scremcat:
Ryan Clough :scremcat:
@CiscoJunkie@techhub.social replied  ·  activity timestamp 3 days ago

@neil @WiteWulf I'll call out, though, that you should check current preferences and metrics to see if the default behavior is doing what you want. I'd be a bit surprised if the behavior you want isn't already the case. ☺️ (Hopefully those commands I pasted help.)

  • Copy link
  • Flag this comment
  • Block
Gary Parker :party_porg:
Gary Parker :party_porg:
@WiteWulf@cyberplace.social replied  ·  activity timestamp 3 days ago

@CiscoJunkie @neil yeah, just checked it now using ‘ip r’ and it shows a metric of 100 for wired and 600 for wireless on both v4 and v6. So: sensible defaults.

Thanks ppl 🙏

  • Copy link
  • Flag this comment
  • Block
Neil Brown
Neil Brown
@neil@mastodon.neilzone.co.uk replied  ·  activity timestamp 3 days ago

@WiteWulf @CiscoJunkie Yes, very helpful!

  • Copy link
  • Flag this comment
  • Block
Gary Parker :party_porg:
Gary Parker :party_porg:
@WiteWulf@cyberplace.social replied  ·  activity timestamp 3 days ago

@neil ah, yes, nmcli. I’ll have a look at that, ta!

  • Copy link
  • Flag this comment
  • Block

BT Free Social

BT Free is a non-profit organization founded by @ozoned@btfree.social . It's goal is for digital privacy rights, advocacy and consulting. This goal will be attained by hosting open platforms to allow others to seamlessly join the Fediverse on moderated instances or by helping others join the Fediverse.

BT Free Social: About · Code of conduct · Privacy ·
Bonfire social · 1.0.1 no JS en
Automatic federation enabled
Log in
  • Explore
  • About
  • Code of Conduct