Terminate state on gateway change

Started by jeliasson, November 22, 2023, 04:11:14 PM

Previous topic - Next topic
Hello everyone,

I'm currently dealing with a setup involving two gateways: the primary gateway (WAN1) is a wired unmetered connection, while the secondary gateway (WAN2) is a metered LTE connection. The failover to the LTE connection works seamlessly when the primary gateway (WAN1) goes down, but I'm facing a specific challenge.

The issue I'm encountering is that persistent connections (SSH, RDP, etc.) continue to use WAN2 even after the primary gateway is restored following a period of downtime. This results in unnecessary latency and, naturally, unwarranted traffic on the metered connection.

I'm wondering if there's a method to terminate states associated with a specific WAN interface when an active gateway changes. Essentially, I'm seeking a way to terminate WAN2 states when WAN1 becomes active. Alternatively, I'm open to discovering a more graceful approach to dropping secondary connections, prompting clients to reconnect/reestablish with the now active WAN1.

Any insights or suggestions on how to address this would be greatly appreciated.

Thanks!

Bump. If there's any part of my explanation that seems unclear, let me know, and I'll try to express it differently. Thanks again!

You should be able to smooth this over a bit by disabling sticky connections (advanced firewall settings). Research the possible implications of doing so, however. I ventured down that path and encountered more bullcorn than benefit.

As for how to flip it back to WAN1 with sticky conn enabled, you might have success with automating ifdown/ifup on WAN2 if a test for connectivity on WAN1 succeeds (shellscript+cron). Also you may need to account for the gateway interval period by inserting a sleep routine in the script.

These are the commands I use for another LTE connectivity need:

/usr/local/sbin/configctl interface linkup stop ue0
/usr/local/sbin/configctl interface reconfigure ue0
/usr/local/sbin/configctl interface linkup start ue0