I have two Internet connections. A fibre connection and an ADSL connection. I’d like to use the fibre connection as the primary connection and re-route traffic over the ADSL connection if the fibre link goes down. Implementing this in principal seems easy enough using IP Routes. I setup a route via the fibre connection with a cost of 1 and the ADSL with a cost of 2. If I disconnect my fibre router from the Mikrotik router, traffic is rerouted over ADSL.
The problem is that if the fibre connection goes down it probably won’t be the connection between the fibre router and my Mikrotik router, it will be from the fibre router to the ISP. So I need to find a way to mark the route as down if the remote router is unreachable.
When you configure a route, you can set it up to ping the gateway and if the gateway goes down mark the route as unavailable. So the question is how to I monitor a remote host? Ideally I want to ping the router on the other side of the fibre connection and mark that route as down if it is not available.
I’m sure this can be accomplished without scripting. I started reading here http://wiki.mikrotik.com/wiki/Advanced_Routing_Failover_without_Scripting (basic setup) but I’m sure there are steps missing as I couldn’t get it to work, and the steps don’t make sense on their own. I’m still relatively new to RouterOS. Using Winbox mostly as I don’t have a good grasp of the shell commands just yet.
So my next thought is I can monitor the remote host using netwatch. If the host is up, enable the route. If the host is down, disable the route. I would however need to force traffic to that specific host always over the fibre connection with a static route. I’m not sure how to implement this part? And, is my thinking sound on the way I am approaching this or is there a better way without netwatch?
DHCP client and attached script is all automatic
when client get lease from server, this scrip will do folowing things:
add check gateway
add default route
add src-nat rule
I haven’t done this with MikroTik, but I have done something similar with Cisco and Juniper.
I would do this with VRRP on the downstream interfaces, and then use netwatch to watch something above the fiber link, probably it’s default gateway.
Make the VRRP interface on the fiber router the primary, and the VRRP interface on the DSL the secondary.
Once netwatch detects that the gateway on the fiber router is down, shut the VRRP interface on the primary. All clients will move over to the DSL router and use it’s default gateway instead.
There’s a bit more to it than this, but this is where I would start from a high level.
EDIT: I read your post thinking you had 2 routers. Looks like you don’t. If it were me, I would take this opportunity to use 2 routers in a failover setup probably, maybe that was my thought path. With MikroTik, you can do this cheaply of course. And it’s a cooler setup.
You can do this with netwatch. Just add extra route for host you want to check with ping. For example if you want to ping 10.5.5.1 host over fiber
ip route add dst-address=10.5.5.1 gateway=192.168.92.1 (except you should use fiber ip address as gateway)