Usual failover without scripting:
https://wiki.mikrotik.com/wiki/Advanced ... _Scripting
Once a virtual gateway is down due to loss of internet connectivity, the second gateway is immediately available but all old tcp connections (as seen in /ip firewall connection) are still up and your device session is stuck in trying the old gateway.
A manual flush of connections causes immediately to bring back connectivity on the new active gateway (or wait for old connections to die).
How can I get this to happen automatically when failover takes place ?