There is a way to set up load balancing with failover without scripting described here: http://wiki.mikrotik.com/wiki/Advanced_ ... _Scripting. All is working fine. We may use "virtual" hops and rely on recursive nexthop lookup. However in order to make it working, we have to define at least one route that points to the real gateway. Here is an example from the mentioned article:
/ip route add dst-address=Host1 gateway=GW1 scope=10 add dst-address=Host2 gateway=GW2 scope=10
There is a workaround for that if we connect to ISP using ppp (pppoe, pptp, l2tp, etc). We can specify a static remote ip address for particular connection in the ppp profile. But what to do in case of getting a dynamic gateway address via DHCP? We can use scripting here and change all the related routes according to the new gateway address. But I think the OS specially designed for routing should allow to do such things without scripting, shouldn't it?
I would propose to add the following new option to dhcp-client, pppoe-client, l2tp-client and all other clients:
gateway-alias (IP; Default: "")
If this option is specified, Router OS will automatically add the following dynamic route to the routing table when the connection is going up (the connected route is added):
/ip route add dst-address=<gateway-alias>/32 gateway=<real-gateway> distance=1 scope=10 target-scope=10
This route will be automatically removed when the connection is going down (the connected route is removed). So we can use <gateway-alias> as a gateway in our static routes and there is no need to change routes any more even if the real gateway is dynamic. Moreover, using this approach we can change ISP without need to change any static routes at all.