Friday, January 29, 2021

Fail Over with Recursive Gateway in Mikrotik

With Recursive Gateway, we don't need script to check if a gateway has internet or not. All you need to set just in IP - Routes . You can also use recursive gateway for Route with "routing mark".

For example : we have two gateways, one ( 192.168.100.1 ) for browsing and other ( 192.168.200.1 ) for game connection. And we want to set fail over for each gateway, to do that we need two ip addresses that we're gonna use for checking internet connection. In this example, i am gonna use google dns ( 8.8.8.8 and 8.8.4.4 ) for the internet checking.

First, we're gonna route 8.8.4.4 via 192.168.100.1 .

/ip route add dst-address=8.8.4.4 gateway=192.168.100.1 check-gateway=ping distance=1 disabled=no

Then, we set 8.8.4.4 as recursive gateway via 192.168.100.1 and we change target-scope to 30.

/ip route add gateway=8.8.4.4 check-gateway=ping distance=1 target-scope=30 scope=30 disabled=no

Second, we route 8.8.8.8 via 192.168.200.1 .

/ip route add dst-address=8.8.8.8 gateway=192.168.200.1 check-gateway=ping distance=1 disabled=no


Then, we set 8.8.8.8 as recursive gateway via 192.168.200.1 and we change target-scope to 30 and routing-mark to GAME. This routing mark ( GAME ) is created in IP - Firewall - Mangle section.

/ip route add gateway=8.8.8.8 check-gateway=ping distance=1 target-scope=30 scope=30 routing-mark=GAME disabled=no


 And, that's it. You have finally succeed setting Fail over with Recursive Gateway in Mikrotik.

No comments:

Post a Comment