Hello, how to rioritaze eth0, eth1 or bond0 interface over wlan0 / WiFi interface?
I have Orange Pi 5 Plus and so respectvely created bond0 interface by joining eth0 and eth1, also using tailscale, and want to have WiFi as just as backup so I want to have prioritizied my bond0 interface over wlan0.
I tried the to add like this:
sudo tee -a /etc/network/interfaces.d/wlan0 << 'EOF'
auto wlan0
iface wlan0 inet dhcp
metric 101
EOF
sudo systemctl restart networking ; sudo ifup wlan0
sudo tee -a /etc/network/interfaces.d/bond0 << 'EOF'
auto bond0
iface bond0 inet dhcp
bond-slaves eth0 eth1
bond-mode 802.3ad
bond-miimon 100
bond-downdelay 200
bond-updelay 400
bond-lacp-rate 1
metric 100
EOF
sudo systemctl restart networking ; sudo ifup bond0 ; sudo systemctl status -l networking --no-pager
when I do so - I can connect via tailscale but system DNS can not resolv anything even though it has correctly setup /etc/resolv.conf. When I delete /etc/network/interfaces.d/wlan0 - everything starts to work normally again and /etc/resolv.conf stays the same - resolving works again, but priority goes back to wlan0 interface. The only solution to disable WiFi adapter, but I do not want to do so.
did you checked /etc/network/interfaces
directly? Usually there is a wlan0
interface already present.
Yeah, of course, but there is written
Location: /etc/network/interfaces
Please modify network settings via: dietpi-config or create your own drop-ins in: /etc/network/interfaces.d/
####### Drop-in configs
source interfaces.d/*
so I suspect that it should be done using via dropins in interfaces.d/* respectively.
I know but adding a /etc/network/interfaces.d/wlan0
will double the configuration for wlan0
. Best to have just one.
In this case I think this should be mentioned in this file, is not it? why in this case these instructions are there?
They have been for a while. Anyway, there is a long term plan to rework the whole network stack as it’s not that flexible atm. But not ETA so far.
So in this case I can edit wlan0 interface safely there?
Yes, at least as lomg as you don’t use network options part within dietpi-config
. This could overwrite your settings possibly
unfortunatelt, after modifying, the system behaviour was so weird, so I had to reinstall the system, DO NOT MODIFY IT IN THAT FILE, as comment says
Can you be more specific about what you did where? Normally it is not a problem to customise /etc/network/interfaces
as it is a standard Debian configuration file for ifupdown
. In any case, it is not DietPi-specific.
When I set metric parameter in /etc/network/interfaces
# Location: /etc/network/interfaces
# Please modify network settings via: dietpi-config
# Or create your own drop-ins in: /etc/network/interfaces.d/
# Drop-in configs
source interfaces.d/*
# Ethernet
allow-hotplug eth0
iface eth0 inet static
address 192.168.0.100
netmask 255.255.255.0
gateway 192.168.0.1
#dns-nameservers 100.100.100.100
# WiFi
allow-hotplug wlan0
iface wlan0 inet dhcp
address 192.168.0.100
netmask 255.255.255.0
gateway 192.168.0.1
#dns-nameservers 100.100.100.100
metric 110
pre-up iw dev wlan0 set power_save off
post-down iw dev wlan0 set power_save on
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
.
.
.
and also have /etc/network/interfaces.d/bond0
auto bond0
iface bond0 inet dhcp
bond-slaves eth0 eth1
bond-mode 802.3ad
# address 192.168.8.89
bond-miimon 100
bond-downdelay 200
bond-updelay 400
bond-lacp-rate 1
metric 100
.
.
.
tailscale works, but resolving something else - is impossible
jjaard@JJRD-Fida:~$ ip route show table all
100.66.244.28 dev tailscale0 table 52
100.69.15.29 dev tailscale0 table 52
100.69.151.87 dev tailscale0 table 52
100.74.76.125 dev tailscale0 table 52
100.81.29.125 dev tailscale0 table 52
100.85.57.108 dev tailscale0 table 52
100.90.24.12 dev tailscale0 table 52
100.90.211.85 dev tailscale0 table 52
100.100.100.100 dev tailscale0 table 52
100.105.165.69 dev tailscale0 table 52
100.106.207.33 dev tailscale0 table 52
100.108.131.124 dev tailscale0 table 52
100.111.254.111 dev tailscale0 table 52
100.112.84.36 dev tailscale0 table 52
100.112.184.45 dev tailscale0 table 52
100.114.208.19 dev tailscale0 table 52
100.115.227.110 dev tailscale0 table 52
100.116.54.60 dev tailscale0 table 52
100.122.29.87 dev tailscale0 table 52
100.127.134.96 dev tailscale0 table 52
default via 192.168.0.1 dev eth0 onlink
default via 192.168.8.1 dev bond0 metric 100
default via 192.168.8.1 dev wlan0 metric 110
192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.100
192.168.8.0/24 dev bond0 proto kernel scope link src 192.168.8.96
192.168.8.0/24 dev wlan0 proto kernel scope link src 192.168.8.69
local 100.77.104.17 dev tailscale0 table local proto kernel scope host src 100.77.104.17
broadcast 127.0.0.0 dev lo table local proto kernel scope link src 127.0.0.1
local 127.0.0.0/8 dev lo table local proto kernel scope host src 127.0.0.1
local 127.0.0.1 dev lo table local proto kernel scope host src 127.0.0.1
broadcast 127.255.255.255 dev lo table local proto kernel scope link src 127.0.0.1
broadcast 192.168.0.0 dev eth0 table local proto kernel scope link src 192.168.0.100
local 192.168.0.100 dev eth0 table local proto kernel scope host src 192.168.0.100
broadcast 192.168.0.255 dev eth0 table local proto kernel scope link src 192.168.0.100
broadcast 192.168.8.0 dev bond0 table local proto kernel scope link src 192.168.8.96
broadcast 192.168.8.0 dev wlan0 table local proto kernel scope link src 192.168.8.69
local 192.168.8.69 dev wlan0 table local proto kernel scope host src 192.168.8.69
local 192.168.8.96 dev bond0 table local proto kernel scope host src 192.168.8.96
broadcast 192.168.8.255 dev bond0 table local proto kernel scope link src 192.168.8.96
broadcast 192.168.8.255 dev wlan0 table local proto kernel scope link src 192.168.8.69
fd7a:115c:a1e0::/48 dev tailscale0 table 52 metric 1024 pref medium
fd7a:115c:a1e0::3601:6811 dev tailscale0 proto kernel metric 256 pref medium
fe80::/64 dev tailscale0 proto kernel metric 256 pref medium
fe80::/64 dev bond0 proto kernel metric 256 pref medium
fe80::/64 dev wlan0 proto kernel metric 256 pref medium
local ::1 dev lo table local proto kernel metric 0 pref medium
local fd7a:115c:a1e0::3601:6811 dev tailscale0 table local proto kernel metric 0 pref medium
local fe80::7f42:be2d:de85:3050 dev tailscale0 table local proto kernel metric 0 pref medium
local fe80::c274:2bff:fefe:94a9 dev bond0 table local proto kernel metric 0 pref medium
local fe80::ca8a:d8ff:fe12:64fa dev wlan0 table local proto kernel metric 0 pref medium
multicast ff00::/8 dev tailscale0 table local proto kernel metric 256 pref medium
multicast ff00::/8 dev bond0 table local proto kernel metric 256 pref medium
multicast ff00::/8 dev wlan0 table local proto kernel metric 256 pref medium
jjaard@JJRD-Fida:~$
jjaard@JJRD-Fida:~$ ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
From 192.168.0.100 icmp_seq=1 Destination Host Unreachable
From 192.168.0.100 icmp_seq=2 Destination Host Unreachable
^C
--- 8.8.8.8 ping statistics ---
7 packets transmitted, 0 received, +2 errors, 100% packet loss, time 6088ms
pipe 2
jjaard@JJRD-Fida:~$
- removed
metric
parameter from /etc/network/interfaces
or /etc/network/interfaces.d/bond0
or both – issue persists, so I can for some reason connect via Tailscale and priority goes to eth0 but nothing else can be resolved.
- with disabled WiFi adapter via
sudo dietpi-config
– Solves the non-working resolving issue, but priority goes to WiFi
@trendy can you have a look. Maybe a misconfiguration within one of the files.
Well, you are using the same subnet in both bond and wlan, hence it’s expected to face such issues.
I’d remove the wlan altogether, the metric is not helping with the failover you want to achieve anyway.
Also from the last configuration post, I don’t see any dns configured, they are all commented out.
All parameters (including commented DNS) is what automatically done by system. Only thing what I have added is “metric 110”. But for failover I think it would be somehow easier to do via some scripting.
Something tested a while ago Using ethernet + WLAN interfaces (not at the same time) in v6.30
A failover from Ethernet to WiFi using the same IP address on both adapter.
1 Like