I have two WAN uplinks and I want to implement a failover mechanism based on a speed threshold. for example: if one of the links goes below 5mbps, the router should failover to the second link and recover when the primary goes above 5mbps.
How do you want measure the 5mbs limit assuming that the other failover part of configuration is possible?
How/when do you want to go back to main link, what leads to previous question?
Interesting question, in Tomas’ example (Tool: Traffic Monitoring) he uses traffic received and if its above a certain threshold, 5mbp/s in the Ops case perhaps some percentage of of the primary links capacity , then traffic is switched to WAN2. Below that threshold, traffic returns to WAN1
Testing current link capabilities is as testing the max speed for a car you drive having only that car and without messing with the traffic on the road.
On the other hand the question is what means that link "goes down below 5mbs". Temporarily? In short period? Longer than?
For me "drops below 5mbs" means that you need to know the current saturation, subtract it from max assigned by ISP speed and voilà ... we know the capbility dropped below the limit. Is it good method? Doubt that. However if you switch to backup than the main link immediatelly drops below the limit so it should be connected back. Result: switching back&forth in a St. Vitus's dance style. Not good, really not good solution
@anav, the issue here is with the OP’s wording of the requirement.
The normal scenario, where your concern regarding constant flapping makes sense, is that you stop sending new connections via an uplink that already carries enough traffic, and wait for its load to decrease until you start sending new connections through it again. And here we could talk about traffic patterns, hysteresis, and periodicity of measurement as ways to address your concerns.
But the OP asks for a reverse -
And that is a completely different requirement - unless we are talking about some transport system with adaptive modulation that adjusts to propagation conditions and publishes the information about current transmission speed via some managament interface, there is no way to determine the throughput of the link without actually loading it with traffic. So while not using it for the “real” traffic because its throughput is too low, you need to induce some bogus traffic to it so that you could determine the throughput.
So until @Mekka confirms or corrects the requirement, there is no point in assuming.
After reading everything, I realize now that what I want the failover to be based on is the actual throughput of the links not bandwidth.
To give more context, the two ISP’s are a local ISP(fibre optic)- primary and a local 5G provider- secondary. Both ISP’s do not deliver constant bandwidth and I want to know if there is a way to failover to the secondary when the throughput of the primary is below 5mbps and back when it is above 5mbps.
If the primary uplink is a fiber one, the throughput/bandwidth limitation depends on some bottlenecks in the ISP network, not on changing parameters of the transmission environment. So there is no other way to learn the current throughput than measuring the actual data arrival rate on the interface of your router.
And once you start sending new connections via the other uplink, the only data received via the optical one will be those belonging to connections previously established through it, which will eventually end, so the measured data arrival rate will become almost zero (some overhead may stay there).
You may periodically spawn short-term test connections to some speed testing site via the optical link while using the 5G link for normal traffic, but that doesn't address the occurrence of "false positives" when there's less normal traffic than 5 Mbps.
Also, are you sure that the periods of low throughput are not correlated on the two uplinks? It's quite normal that all networks serving the same area are loaded about the same during the same periods of the day.
How do you want to check if current throughput is below value X? That question does not depend on using Mikroik or other brand.
Again: comparing to car trafic problems: It as trying to answer if you can drive faster than X km/h all the time without any knowledge what traffic is beyond the first crossroad your driveway is connected to and all traffic lights at each intersection are operated by different companies with different traffic goals.