How to set automatic shutdown interface with the channel reservation on mikrotik?

Hello! The situation is the following: you must configure redundant Internet channel on the router Mikrotik (6.34) with automatic switching to backup channel in case of disappearance of the core, and the transition back to the primary when it ping.
Everything is already set up with ping of ranting (using Distance + Scope) everything is fine switches and ranting and overwrite each other when shutting down, but faced with the same problem:
When switching from standby back to the primary channel I have part of the device (wifi, phone) remain on the backup router and to use them impossible. When you manually disable the backup interface - everything comes back to normal.

A network of 30 computers, there are 2 or reduce the life of TCP connections to 1 minute (I'm afraid that the router will choke on) or automatic shutdown of backup channel when using the basic when you ping from the primary, and accordingly the inclusion of a backup channel in the absence of the ping from the primary. I will be glad to hear any help on this issue.
July 12th 19 at 16:47
1 answer
July 12th 19 at 16:49
may clean up conntrack?
simple version:
/ip firewall connection tracking set enabled=no
:delay 1
/ip firewall connection tracking set enabled=yes

or slightly more complicated

:local dumplist [/ip firewall connection find]
:foreach i in=$dumplist do={
 /ip firewall connection remove $i
checked the script - works perfectly! Prompt please as it to implement in a router? At the moment I have configured buzzcity method of reserving a channel, how to activate this script when switching to standby/ return to the main channel? - marvin55 commented on July 12th 19 at 16:52
A method of switching next - ranting and added with a constant ping Dst.adress and with the same distance (1) and Scope (10), and through them recursively 2 roat with Hatoyama and respectively, with the distances 2 and 3, and scope 30. with the disappearance of ping on the main route (Distance 2) automatically moves to the next (distance 3). If you experience ping-based - picks up the route with the smallest distance. All this is implemented without script, tell me please how it can be implemented with your script on a clean connection? - marvin55 commented on July 12th 19 at 16:55
1. to do it through script, not through the "inline script" (then, as now configured)
2. to call the script periodically and assess the current channel, if it differs from the latter used to reset the connection - esmeralda_Nolan commented on July 12th 19 at 16:58

Find more questions by tags MikrotikReservation