Is it possible (with MikroTik RB3011uias-rm) to have 2 ports for 2 Wan and one port for lan, but :
Option 1
I want to do load balancing with policies routing, some Sip phone have to go with Wan1 and some other to Wan2
If Wan1 is KO, all phones go to the Wan2 and if Wan2 is KO, all Phones go to Wan1
If wan1 is KO, all Phones go to Wan2, but when Wan1 is going OK, Phones who are in communication and have to go to Wan1 are not going imédiately to Wan1 (because communications are cut), only go Wan1 when is ré-enregistreted
Option 2
No Load balancing and Routing policies, only backup :
Wan1 is active line and Wan2 is backup. When Wan1 is KO, Wan2 becomes active line and stays as far as is not KO. And Wan1 becames new line backup.
And when Wan2 is KO, Wan1 becames active line and Wan2 line backup…
If you don’t mind to have a static load distribution, where the primary and backup choices are fixed for each phone, 1/2 of phones has Wan1 and the other 1/2 has Wan 2 as a primary uplink, there is no problem to use policy based routing for that. This article tells you everything you need about tracking the availabiliy of internet connection via both Wan interfaces and use of routing marks. You’ll have two extra routing tables, one for each of the two groups of phones, where priorities of Wan 1 and Wan 2 for routing packets to the VoIP exchange’s subnets will be inverted (in table A Wan 1 will have higher priority = lower distance, in table B Wan 2 will have higher priority = lower distance)
The “persistent failover” scheme, where you only stop using a Wan interface when it fails and do not revert to it when it becomes OK again, would require scripting. The “preferred primary” scheme works with no scripting, while for each client (phone in your case), any of the Wan interfaces may be chosen as primary.
You also have to be aware that
when the Wan interface fails, connection tracking doesn’t drop the associated connections’ context including NAT settings, so you have to forcefully remove these connections so that they could re-establish via the new Wan interface. If you do not do that, packets leave e.g. via Wan 2 with source address set to that of Wan 1. So you have to periodically run a script which checks the state of both Wan interfaces (or, better, the recursive gateways associated to them) and if it detects a failure, remove all tracked connections associated to the failed interface.
the VoIP exchange sends incoming calls to the IP address from which it has received the last registration, so until the phone re-registers after the Wan goes down, it won’t receive incoming calls. So you have to set up quite short registration times, or, if the phones are connected directly to Mikrotik’s ethernet interfaces, you may disable and re-enable the interfaces to make the affected phones re-register out of schedule.
there is no way to save the active calls over the failed Wan interface, they will break when the uplink fails and will have to be established again - even if you don’t shutdown and re-enable the phone-facing interfaces.
With the simple Failover
If Wan1 is KO, communications are cut off and phones go to Wan2. But when, 5 minutes later, Wan1 becomes OK again, the phones will switch again on Wan1 and 2nd cuts.
So 2 cuts. That’s why I want Wan2 to remain the active connection.
With Load Balancing and routing policies
The half of the phones are impacted if Wan1 is KO. When Wan1 returns to Ok, half of the phones (the same ones) are impacted again. This is also 2 cuts, but only on the half phones!
Is miktotik automaticaly put phones on wan2 if wan1 ik KO (even routing policy says phones A to wan1)
Currently I use Zeroshell
With Failover :
when wan1 is KO, Wand2 becomes the active line and Wan1 remains the backup line.
When Wan2 is KO, then again Wan1 becomes the active line and Wan2 becomes the backup line. But not before.
With Load balancing
The half of the phones are impacted if Wan1 is KO but those phones telephones will automatically go to Wan2 (with a cut). When Wan1 returns to Ok, half of the phones (the same ones) are impacted again. This is also 2 cuts, but only on the half phones!