In the network world, there is something called the Mikrotik Failover Configuration Technique. This technique is a technique used to provide two connection lines where if one connection line dies, the connection will continue to run by being diverted to another line.
The way this Failover works is where when there is a broken link (Main Link), the internet will be redirected using the backup link. Actually, there is more than one way to Failover the Mikrotik Router, such as using the check-gateway and distance parameters or using a script. If you want to set up the proxy in more detail, you can read the article about various settings in proxy this.
For example for Failover Mikrotik, this is the topology used:
To shorten, this way is a method that has only gotten to the point. This Mikrotik failover technique also uses a Script blend.
- Make sure the 2 internet connections that you are going to use have happened well in Mikrotik.
- Go to System -> Script -> Add. Add the following 2 Mikrotik scripts:
Failover script::
if ([/ ip route get [/ ip route find comment = “main”] disabled] = yes) do = {/ ip route enable [/ ip route find comment = “main” ]} else = {/ ip route disable [/ ip route find comment = “main”]}
Script to return to main path
: if ([/ ip route get [/ ip route find comment = “main”] disabled] = yes) do = {/ ip route enable [/ ip route find comment = “main”]}
- The next step in Mikrotik failover is to create a Netwatch rule. Go to Tools -> Netwatch -> Add. Create the following two rules:
Netwatch Failover:
[Tab Host]
– Host: 8.8.8.8
– Interval: 00:00:03
– Timeout: 1000 ms [Tab Down]
– On Down: failover (adjust to the script name)
[Tab Up ]
– On Up: back2main (adjust to the name of the script)
- The next step is to edit the Mikrotik cable routing. The trick is to go to IP -> Routes. Make it like the following picture:
- To route for the main line:
Manually create a route for the main line with the configuration:
– Dst Address: 0.0.0.0/0
– Gateway: ether1 (select the interface connected to the main line)
– Distance: 1
– Check Gateway :ping
Interested With mikrotik failover engineering service from NetData? Immediately check our mikrotik products below :