You are not logged in.
I have a situation where I run a local network between two computers over an ethernet router. The ethernet router is not connected to the internet, but the wireless network is. I would like to be able to stay online, even when I am connected to the local, ethernet network... Is there a way to tell systemd-networkd/iwd/systemd-resolved to prioritize wifi over ethernet for internet, while maintaining the ethernet connection? I use iwd, systemd-networkd and systemd-resolved for my network needs. I tried setting RouteMetric to different values (I assume a lower value has a higher priority) but this didn't seem to work.
My config:
/etc/systemd/network/20-wired.network
---
[Match]
Name=enp0s31f6
[Network]
DHCP=yes
[DHCPv4]
RouteMetric=20/etc/systemd/network/25-wireless.network
---
[Match]
Name=wlan0
[Network]
DHCP=yes
[DHCPv4]
RouteMetric=10Offline
Make sure that only one default route exists: the internet one.
Knowing others is wisdom, knowing yourself is enlightenment. ~Lao Tse
Offline
Make sure that only one default route exists: the internet one.
That is the easiest solution, just set set DefaultRouteOnDevice=false in the [Network] section I think.
If you want to use the ethernet as a fallback connection, you can set up both computers as a gateway for the ethernet and then choose a different metric for the default routes.
The RouteMetric option cannot set the metric for the default route, only the prefix routes. A custom route section should work, though. A lower metric will have a higher priority. Maybe you have to use DefaultRouteOnDevice=false as well.
[Route]
Destination=0.0.0.0/0
Metric=10 #or 11 or 20The same can be done for ipv6 with ::/0
Last edited by progandy (2022-03-21 17:44:43)
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |
Offline