The reference should be this thread:
viewtopic.php?t=154606
where rextended explains the logic behind the code snippet.
I am trying to follow your netwatch script:
Simplified:
test 1.1.1.1
if down:
disable route WAN1
clear all connections (with timeout more than 60 seconds)
if up:
enable route WAN1
clear all connections (with timeout more than 60 seconds)
test 1.0.0.1
if down:
disable route WAN1-21
clear all connections (with timeout more than 60 seconds)
if up:
enable route WAN1-21
clear all connections (with timeout more than 60 seconds)
So, whatever happens, you are clearing all connections, so you want/need to select only the ones "belonging" to WAN1 or WAN1-21 routes/sets of routes, correct?
I think that a possible way would be to add a connection-mark via a mangle rule, so that you can "filter" connection that "belong" to the one or the other (ISP or route), but whether it is possible to apply correctly these connection-marks may depend on how exactly your traffic is generated.
I cannot find another suitable field among those in /ip firewall connection:
https://wiki.mikrotik.com/wiki/Manual:I ... n_tracking
If you can get a situation similar to the one depicted here:
viewtopic.php?t=172675
where each connection is either "ISP1_conn" or "ISP2_conn" it should be possible to adapt the /ip firewall connection remove to select them.
viewtopic.php?t=154606
where rextended explains the logic behind the code snippet.
I am trying to follow your netwatch script:
Simplified:
test 1.1.1.1
if down:
disable route WAN1
clear all connections (with timeout more than 60 seconds)
if up:
enable route WAN1
clear all connections (with timeout more than 60 seconds)
test 1.0.0.1
if down:
disable route WAN1-21
clear all connections (with timeout more than 60 seconds)
if up:
enable route WAN1-21
clear all connections (with timeout more than 60 seconds)
So, whatever happens, you are clearing all connections, so you want/need to select only the ones "belonging" to WAN1 or WAN1-21 routes/sets of routes, correct?
I think that a possible way would be to add a connection-mark via a mangle rule, so that you can "filter" connection that "belong" to the one or the other (ISP or route), but whether it is possible to apply correctly these connection-marks may depend on how exactly your traffic is generated.
I cannot find another suitable field among those in /ip firewall connection:
https://wiki.mikrotik.com/wiki/Manual:I ... n_tracking
If you can get a situation similar to the one depicted here:
viewtopic.php?t=172675
where each connection is either "ISP1_conn" or "ISP2_conn" it should be possible to adapt the /ip firewall connection remove to select them.
Statistics: Posted by jaclaz — Sat Jan 06, 2024 1:15 pm