OpenWrt does't flush the route of interfaces that are down

I have a WAN interface configured on DHCP protocol and the default gateway pointing towards the same but whenever I don't receive internet on that interface the default gateway pointing towards that interface doesn't get flushed from the routing table.
Please give me a solution.
Thanks in advance.

Is the interface really down or you cannot access the internet? These are different things.
If the route is flushed, what good will come out of it? Is there a redundant connection?

2 Likes

Yes there is a redundant connection.

Then you should be using mwan3 to monitor the connection and switchover accordingly.

1 Like

Mwan3 is a good option for internet traffic but when I am creating an IPsec tunnel the tunnel is trying to use the default route WAN connection to build the tunnel and it is failing so please suggest me what can I do?

Use mwan3 scripts to bump the ipsec. Or use wireguard.

1 Like

What do you mean by bump?

Do a down-up.

1 Like

By doing this still default gateway does't flush from routing table because we don't have the reachability of the internet but we have reachability of ISP router.

Did you try it and it failed?

1 Like

yes, I tried it and it failed.

Post the uci export mwan3 especially how you bumped the ipsec tunnel when the main interface lost connectivity.

1 Like

i bumped through

ifdown wan && ifup wan

How can i bumped it through mwan3?

hi @trendy please reply

You still didn't post the mwan3 config.
And the bump of the ipsec should occur in the mwan3 script section, not down-up of the wan.

1 Like

Please tell me how to bump wan via mwan3 scripts.

config globals 'globals'
        option mmx_mask '0x3F00'
        option local_source 'lo'

config interface 'sim1'
        option enabled '1'
        option initial_state 'online'
        option family 'ipv4'
        list track_ip '8.8.8.8'
        option track_method 'ping'
        option reliability '1'
        option count '5'
        option size '8'
        option check_quality '0'
        option timeout '5'
        option interval '2'
        option failure_interval '5'
        option recovery_interval '5'
        option down '3'
        option up '1'
        option flush_conntrack 'never'

config interface 'sim2'
        option enabled '1'
        option initial_state 'online'
        option family 'ipv4'
        list track_ip '8.8.8.8'
        option track_method 'ping'
        option reliability '1'
        option count '5'
        option size '8'
        option check_quality '0'
        option timeout '5'
        option interval '2'
        option failure_interval '5'
        option recovery_interval '5'
        option down '3'
        option up '1'
        option flush_conntrack 'never'

config interface 'wan'
        option enabled '1'
        option initial_state 'online'
        option family 'ipv4'
        list track_ip '8.8.8.8'
        option track_method 'ping'
        option reliability '1'
        option count '5'
        option size '8'
        option check_quality '0'
        option timeout '5'
        option interval '2'
        option failure_interval '5'
        option recovery_interval '5'
        option down '3'
        option up '1'
        option flush_conntrack 'never'

config member 'sim1_mem'
        option interface 'sim1'
        option weight '1'
        option metric '1'

config member 'sim2_mem'
        option interface 'sim2'
        option weight '1'
        option metric '1'

config member 'wan_mem'
        option interface 'wan'
        option metric '1'
        option weight '1'

config policy 'wan_aggregation'
        option last_resort 'unreachable'
        list use_member 'sim1_mem'
        list use_member 'sim2_mem'
        list use_member 'wan_mem'

config rule 'AllTraffic'
        option proto 'all'
        option sticky '0'
        option use_policy 'wan_aggregation'

A couple of things. You are using a load balancing policy only, without sticky. This can cause the same source to use different gateways, which may break things. Also you are not flushing the conntrack on any interface.
Regarding the mwan3 scripts you can read here.

1 Like