Link Balancing in MikroTik: How to Use Two Providers at the Same Time

The Challenge
A client had two internet links (Vivo and Claro), but used only one at a time. The second link remained idle, waiting for the main one to fail.
The request was clear: combine the speed of both links and have automatic protection in case one of them failed.
The Prompt Sent to Myrmex
Using the integration with the MikroTik router, we sent the following prompt:
I need to configure load balancing with failover on my MikroTik.
ENVIRONMENT:
- Device: @MKT-ROUTER-01
- RouterOS version: 7.21
- Link 1 (ISP1): Vivo Fibra, PPPoE connection, interface "pppoe-vivo"
- Link 2 (ISP2): Claro, dynamic IP via DHCP, interface "WAN-2", gateway 100.111.186.1
- Internal network: 10.99.0.0/16 (LAN)
REQUIREMENTS:
1. Use both links simultaneously (real balancing, not just failover)
2. Split traffic proportionally between links (50/50)
3. Maintain session persistence to avoid issues with banking sites and HTTPS
4. Implement automatic failover: if one link fails, all traffic should go to the other
5. Detect link failures even when the interface remains UP (recursive failover)
Apply the settings and validate the outputs.
Note: By mentioning the device with
@MKT-ROUTER-01, Myrmex knows exactly which equipment it is configuring, improving the accuracy of the settings.
What Myrmex Did
1. Environment Analysis
Myrmex started by collecting device information:
- ✅ Verified RouterOS version (v7.21) and adapted command syntax
- ✅ Identified available WAN interfaces and their statuses
- ✅ Mapped the internal network topology

2. NAT Configuration
Myrmex applied masquerade rules for both links:
/ip firewall nat
add chain=srcnat out-interface=pppoe-vivo action=masquerade comment="NAT Vivo"
add chain=srcnat out-interface=WAN-2 action=masquerade comment="NAT Claro"
Validation: Myrmex executed /ip firewall nat print and confirmed that both rules were created correctly.
3. Creating Routing Tables
For RouterOS version 7, it created separate tables:
/routing table
add name=to_ISP1 fib
add name=to_ISP2 fib
Validation: Executed /routing table print and verified the presence of to_ISP1 and to_ISP2 tables.
4. Balancing Configuration (PCC)
Myrmex implemented PCC (Per Connection Classifier) to split traffic:
/ip firewall mangle
add chain=prerouting dst-address=10.99.0.0/16 action=accept comment="Bypass internal traffic"
add chain=prerouting in-interface-list=LAN pcc=both-addresses:2/0 action=mark-connection new-connection-mark=ISP1_conn
add chain=prerouting in-interface-list=LAN pcc=both-addresses:2/1 action=mark-connection new-connection-mark=ISP2_conn
add chain=prerouting connection-mark=ISP1_conn action=mark-routing new-routing-mark=to_ISP1
add chain=prerouting connection-mark=ISP2_conn action=mark-routing new-routing-mark=to_ISP2
Why both-addresses? Myrmex chose this classifier because it considers both source AND destination, ensuring that the combination (User IP + Site IP) always uses the same link — essential for HTTPS sessions and banking.
Validation: Executed /ip firewall mangle print and confirmed the 5 rules created in the correct order.
5. Routes with Recursive Failover
To detect real failures (not just interface UP/DOWN), Myrmex configured recursive failover:
/ip route
add dst-address=8.8.8.8/32 gateway=pppoe-vivo scope=10 comment="Vivo health check"
add dst-address=8.8.4.4/32 gateway=100.111.186.1 scope=10 comment="Claro health check"
add dst-address=0.0.0.0/0 gateway=8.8.8.8 routing-table=to_ISP1 target-scope=11 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=8.8.4.4 routing-table=to_ISP2 target-scope=11 check-gateway=ping
Validation: Myrmex executed /ip route print and verified that all routes were active (status "A" = Active).
Final Validation by Myrmex
After applying all settings, Myrmex ran a battery of tests:
| Test | Command Executed | Result |
|---|---|---|
| NAT active | /ip firewall nat print | ✅ 2 masquerade rules |
| Tables created | /routing table print | ✅ to_ISP1 and to_ISP2 present |
| Mangle working | /ip firewall mangle print | ✅ 5 rules in correct order |
| Routes active | /ip route print | ✅ All with "A" status |
| Ping via ISP1 | /ping 8.8.8.8 src-address=<IP-Vivo> | ✅ Response in 12ms |
| Ping via ISP2 | /ping 8.8.4.4 src-address=<IP-Claro> | ✅ Response in 15ms |
Myrmex also generated an executive summary confirming that balancing was operational.
Result
With the configuration applied and validated by Myrmex:
- ✅ Doubled speed for simultaneous downloads
- ✅ Automatic redundancy without manual intervention
- ✅ Stable sessions on banking and e-commerce sites
- ✅ Zero downtime when a provider has issues
Prompt Variations
The same result can be adapted for different scenarios:
For 70/30 balancing:
...split traffic with 70% weight for Vivo and 30% for Claro using PCC with 7:3 ratio...
To add QoS:
...besides balancing, prioritize VoIP traffic (UDP ports 5060, 10000-20000) always via the link with lower latency...
For 3 or more links:
...I have 3 links: Vivo, Claro, and Oi. Split traffic equally among the three with cascade failover...
Want to replicate this result in your infrastructure? Try Myrmex and see how AI can configure and validate your networks automatically.
