Eth0.2 routes are not removed when static config and link down

Hi folks!
I using a RAK7240 lorawan gateway, which runs OpenWRT as OS.
Everything works ok but except for eth0.2 when it is configured with static IP.
What happen is that when I disconnect the ethernet cable (link down) the eth0.2 config still remains in the routing table so the traffic is still preferring that interface (instead the wifi) but obviously it doesn't work because it is not connected.

This is the routing table when the eth0 is not connected:

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth0.2
0.0.0.0         192.168.1.1     0.0.0.0         UG    20     0        0 apcli0
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth0.2
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0.2
192.168.1.0     0.0.0.0         255.255.255.0   U     20     0        0 apcli0
192.168.1.1     0.0.0.0         255.255.255.255 UH    20     0        0 apcli0
192.168.230.0   0.0.0.0         255.255.255.0   U     0      0        0 br-lan

I tried setting force_link='0' in order to put the interface down when the link is down but it didn't work.

This behavior is not present when I configure eth0.2 with DHCP.

Do you know if that behavior is expected?
Any ideas on how I can change that?

Thank you in advance!

Your post does not appear to be related to an officially released OpenWrt version, package or supported operation.

It is unlikely that you will receive useful input here.

Please seek advise from the relevant maintainer.

Wlan-bridge / Site-to-site failover when cable disconnected - #2 by vgaetera

These are the events I receive when I disconnect the eth0:

Sun Aug 29 11:16:29 2021 user.notice esw: esw link state changed : down - ifup wan
Sun Aug 29 11:16:29 2021 daemon.notice netifd: Interface 'wan' is now down
Sun Aug 29 11:16:29 2021 daemon.notice netifd: Interface 'wan' is setting up now
Sun Aug 29 11:16:29 2021 daemon.notice netifd: Interface 'wan' is now up
Sun Aug 29 11:16:29 2021 user.notice hotplug: USER=root ACTION=ifdown SHLVL=2 HOME=/ HOTPLUG_TYPE=iface DEVICENAME= LOGNAME=root TERM=linux PATH=/usr/sbin:/usr/bin:/sbin:/bin INTERFACE=wan PWD=/
Sun Aug 29 11:16:29 2021 user.notice mwan3: ifdown interface wan (unknown)
Sun Aug 29 11:16:30 2021 user.notice ping-watchdog: wan  ifdown
Sun Aug 29 11:16:31 2021 user.notice hotplug: USER=root ACTION=ifup SHLVL=2 HOME=/ HOTPLUG_TYPE=iface DEVICENAME= LOGNAME=root TERM=linux PATH=/usr/sbin:/usr/bin:/sbin:/bin INTERFACE=wan PWD=/ DEVICE=eth0.2
Sun Aug 29 11:16:31 2021 user.notice mwan3: ifup interface wan (eth0.2)
Sun Aug 29 11:16:32 2021 user.notice ping-watchdog: wan eth0.2 ifup
Sun Aug 29 11:16:32 2021 user.notice firewall: Reloading firewall due to ifup of wan (eth0.2)

I looks like when eth0.2 goes down then immediately there is something that put it UP again.

1 Like

Something like mwan3 or ping-watchdog.