Skip to main content

Simple Failover Mikrotik

Simple fail-over Mikrotik router configuration.
Most of the user wants backup link (Fiber link with Wireless backup), in case fiber down wireless link auto up. No downtime for the user. Here is simple setting on Mikrotik for fail-over.
I'm very great full to Anton to point out the mistake in src-address. It has been corrected now.

****default routes for new outgoing traffic.****
/ip route
add dst-address=0.0.0.0/0 gateway=ISP-GW-ADDR-1 distance=1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=ISP-GW-ADDR-2 distance=2

++masquerade both WAN connections++
/ip firewall nat
add chain=srcnat src-address=192.168.0.0/24 out-interface=WAN-1 action=masquerade
add chain=srcnat src-address=192.168.0.0/24 out-interface=WAN-2 action=masquerade

Thats it.



Comments

  1. Hi,

    For this:

    ++masquerade both WAN connections++
    /ip firewall nat
    add chain=srcnat src-address=192.168.1.1 out-interface=WAN-1 action=masquerade
    add chain=srcnat src-address=192.168.1.1 out-interface=WAN-2 action=masquerade

    which is the src-address ? Which ip i should set here? Thanks in advance.

    ReplyDelete
  2. anton, src-address should be your lan IP range. src-address=192.168.1.0/24, if you have 192.168.1.0 network.

    ReplyDelete
  3. As per the above connection, when Primary WAN is down it is switching to backup WAN Link automatically, but when the primary WAN is up then it is not switching back from backup Link to primary WAN Link automatically. Pls suggest...

    ReplyDelete
  4. Try to increase the distance, e.g primary link distance=1 and secondary distance=10. This is working fine for me.

    ReplyDelete
  5. "src-address should be your lan IP range. src-address=192.168.1.0/24, if you have 192.168.1.0 network."

    What if I have multiple lan networks, can I keep it empty?

    ReplyDelete
  6. @Ambro
    you can do add multiple address with masquerade option or just leave blank at src-address with masquerade, that will masquerade whole your network.

    Regards
    Jay

    ReplyDelete
  7. Hello, if the both WAN gateways are connected to the routerboard but for example of you have a DSL connection and the DSL link is down while its still connected to the routerboard and pingable locally the routung rule is still counting is as the primary connection,

    can't we specify the ping destination for example google.com or 8.8.8.8 ??

    ReplyDelete
  8. Dear Samer,
    Yes you can ping other sites like google or yahoo or bing, it would be nice to add their IP's. Here we don't ping the local IP's. Here we ping remote IP, so router can detect link down and switch to next path.

    ReplyDelete
  9. Hello
    thx for this it works for me
    but I have question how can i send mail when the isp is down ?
    I triyed netwatch but the gw is still UP

    ReplyDelete
  10. how to configure fail over cluster on Mikrotik?

    ReplyDelete
  11. Hello, if the both WAN gateways are connected to the routerboard but for example of you have a DSL connection and the DSL link is down while its still connected to the routerboard and pingable locally the routung rule is still counting is as the primary connection,

    can't we specify the ping destination for example google.com or 8.8.8.8 ??

    I have the same question as Above. How do i add a site IP so as if internet is down router will switch to the second ISP?

    ReplyDelete
    Replies
    1. Instead of using ISP gateway try to ping 8.8.8.8.

      Delete
  12. what about single gateway with dual link

    ReplyDelete
    Replies
    1. hi, there is bonding feature and bridging, so if one link fail your traffic goes through other link.

      Delete

Post a Comment

Popular posts from this blog

MongoDB Failed to start lsb an object/document-oriented database

After long gap I'm going to post new blog. Due to the work load and research I have little time.  MongoDB could not started after installation of 3.6 version, However downgrade to the 3.4, still the Mongodb couldn't start and show below error message. Search don't help to resolved the issue. After so much hit and trail nothing work. One Chinese forum posted this command and its works for me.  cd /var/lib sudo rm -rf ./mongodb sudo mkdir mongodb sudo chown -R mongodb mongodb/ sudo serivce mongodb restart

IOS XR GNS3 QEMU

This time lets have tutorial on Cisco XR 9k series router image running on the GNS3. Please don't ask for the XR image. Your are smart enough to get it. My system configuration: Ubuntu 16.04 GNS3 1.4 RAM 8Gig i7 processor Used XR Image iosxrv-k9-demo-6.0.1.qcow2 This image is VIRL extracted image. You need to convert this image into QEMU image, follow this link I strongly recommend you to run it on the Linux system. Now you have converted image, then go to the GNS3>Edit>Preferences>QEMU>Qemu VMs>New then follow the onscreen procedure. Setting for QEMU XR Image. RAM:- 4Gig CPU:- 1 Adapters at lest 4.  -enable-kvm Here you can see I can run the XR on my system. Interface is up and system is already booted.  I have run 3 XR router  here is my system RAM CPU usages. RP/0/0/CPU0:XR3(config)#int gi0/0/0/0 RP/0/0/CPU0:XR3(config-if)#ip add 192.168.13.2 255.255.255.252 RP/0/0/CPU0:XR3(config-if)#co

Cisco ASA in GNS3

Here is another tutorial running Cisco ASAv on GNS3 using Qemu. For Configure GNS3 In My case I have used ASAv952-204.qcow2 Go  to the GNS3>Edit>Preferences>QEMU>Qemu VMs>New Follow on screen procedure.  Don't forget to enable kvm and memory allocation.  Now you can see I can run ASAv 9.5.2 Blank Password.