In this article, we will guide you through configuring Auto failover on Mikrotik router devices using the Netwatch feature according to the example below.
– On the model that has been configured with IP, NAT, and static route according to the diagram, by default Wan 1 is the main, all traffic will go through it and Wan 2 is the backup, we will configure auto failover so that the router automatically switches over. Wan 2 when Wan 1 loses connection.
– For the purpose of using Netwatch to check the connection on Wan 1, the Mangle rule will create a routing mark to the Host address set up in Netwatch and create a static route with that routing mark, to ensure the connection to the Host will be successful. always go through Wan 1.
– Go IP -> Firewalland create 2 rules as follows.
– Finally create a static route to Wan 1 with the created routing mark.
– Go next Tools -> Netwatchcreate a new rule as follows to a host outside the internet that you trust, in this example it is 208.67.222.222, set the check interval at interval. interval. In Up tab Set up run command “/ip route enable 1” when Host Up, and at Down tab will run the command “/ip route disable 1” when Host Down, in there first is the order of static route to Wan 1 in Route version, in CLI use command “ip route print details” to check the route order, which in this example is 1.
– Check in normal state, connection goes through Wan 1, Netwatch status and Route table will be as below.
– If due to some problem the Netwatch feature above Router Mikrotik cannot connect to the established Host, it will go into down state and run the command to disable the route through Wan 1, at this time the route through Wan 2 will be active, on the Client to check the connection will now go through Wan 2. When Once the Netwatch reconnects to the Host, Wan 1 will be activated again.
!!! Thank you for following the article!!!
Xem tiếp...