Hi all,
i have a Mikrotik router with several interfaces, both of them are gateways from different ISPs.
this is my /ip route pr:
Flags: X - disabled, A - active, D - dynamic, C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme,
B - blackhole, U - unreachable, P - prohibit
0 S 0.0.0.0/0 reachable A.A.A.A 10 vlan1
1 A S 0.0.0.0/0 reachable B.B.B.B 1 vlan2
Both gateways are reachable all the time, one is primary - B.B.B.B with distance 1.
I`d like to make a script that is running all the time and watching for the states of the link and if gateway B.B.B.B goes down, the script should automatically put the gateway A.A.A.A as main gateway. An when the link with gateway B.B.B.B is up again the script should put it as a primary gateway.
I have manage to write a script but seems that it does not work, probably i am missing something.
Could someone check it and see if there is something wrong.
You shouldnt need a script for basic failover operations. Just enable “check-gateway=” on the route. If you choose ping it will ping the gateway and when it doesnt respond it will automatically enable the higher cost route. If you choose ARP it will look for MAC address in arp table, if its not there it will automatically fail over.
My question is how to go beyond the simple ping. I have 2 service providers (a DSL line and a fiber line) the intent is that if the fiber line fails, the DSL takes over. Here is my problem. When the fiber has failed in the past, the local router provided by the wholesaler still responds to pings, but there is nothing beyond that. Because it responds to pings, my RB will not failover, just assume that the line is active. I need to be able to have it ping beyond the gateway for connectivity. Any suggestions?
My question is how to go beyond the simple ping. I have 2 service providers (a DSL line and a fiber line) the intent is that if the fiber line fails, the DSL takes over. Here is my problem. When the fiber has failed in the past, the local router provided by the wholesaler still responds to pings, but there is nothing beyond that. Because it responds to pings, my RB will not failover, just assume that the line is active. I need to be able to have it ping beyond the gateway for connectivity. Any suggestions?
I have the same question. Does anybody have the answer yet?
Use netwatch to monitor an IP address further down the path, and fire scripts on up and down events that modify the configuration accordingly. You must be very careful to ensure that whatever you’re monitoring is only reachable through one path, usually that involves firewall filters dropping packets based on destination and out-interface unless routing makes it impossible for the second path to reach that target.