Feature request: routing via dynamic gateway w/out scripting

The problem
There is a way to set up load balancing with failover without scripting described here: http://wiki.mikrotik.com/wiki/Advanced_Routing_Failover_without_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

GW1 and GW2 must be ip addresses. If we use interface names here, recursive nexthop lookup will not be working. But what to do in cases when a gateway address may change? If we reconnect to ISP and get a new gateway address, all our static routes related to that ISP will become inactive because they are still using an old gateway address.

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?

The solution
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=/32 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 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.

Can anybody explain me ethernet network design, when GW can be changed during DHCP address renewal?..

I suppose that there are several routers in one broadcast segment running in order to do load balancing.

but in that case previous gateway should also work, I believe…

That is true if the previous gateway is in the same network as a newly assigned ip address. Otherwise it will not work. Example of possible load balancing in the same broadcast segment:

dhcp1: network=10.10.1.0/24 router=10.10.1.1
dhcp2: network=10.10.2.0/24 router=10.10.2.1
dhcp3: network=10.10.3.0/24 router=10.10.3.1

It’s strange not to see other comments, especially from MT team. This question has been asked many times and every time a script has been suggested as a solution:

http://forum.mikrotik.com/t/routing-with-dynamic-gateway/36494/1
http://forum.mikrotik.com/t/how-to-route-on-dynamic-gateway/12184/1
http://forum.mikrotik.com/t/ecmp-on-dynamic-interfaces/4456/1
http://forum.mikrotik.com/t/changed-policy-routing-with-dynamic-ips/1787/1

I believe my solution is simple to use, easy to implement and completely solves the problem of policy routing via dynamic gateway. Would it be correct if I e-mail this feature request to support@?

yeah, having some additional options in DHCP client would be nice… like

default-route-routing-mark=
default-route-scope=
default-route-target-scope=
default-route-override-dst-address=

write to support@, I’ll be glad to see their answer here

If an pppoe/pptp/l2tp client on RouterOS wants to always use a static remote ip address specified in a ppp profile, can an ISP deny doing that or not? Does anyone know for certain?

no, you cannot - you don’t know that. do you need that?

On the first sight I think we’re on the same wavelenght…

I also want an additional option for the DHCP client for almost the same thing you mentioned. :wink:

See: http://forum.mikrotik.com/t/feature-request-dhcp-client-add-default-route-to-table/43332/1

Has anyone submitted this feature request to support@mikrotik.com yet?

Regards,
Robert

This has been several time in last few years but Mikrotik stuff is categorical not to add such option.

Even windows has it. When you set DHCP client there is simple check box to choose wether to automatically add DHCP provided gateway as default gateway or not. You can even set metrics for that default route.

I had a similar request:

http://forum.mikrotik.com/t/routing-using-interface-as-gateway-w-dhcp/45683/1

It is very difficult to do failover with a dhcp WAN connection on Mikrotik.

Is it any solution on this question yet,…Ohhh mikrotik

/ip dhcp-client add add-default-route=
no  special-classless  yes

and another option

default-route-distance

Hello janisk,
I’m new with mikrotik,believe… your reply only for dhcp-client(is it?), my point is solution for “pppoe-client”. i really need it for load balancing with failover without scripting.

I’m not try that yet(Can i?,with mikrotik) because my ISP always provide dynamic ip(if i need static ip..have to pay more:( ). So what do you suggest?

Thanks in advance.

Reply from Microtik support:

Hello, It is not possible because of current nexthop resolution algorithm. There will be a lot of improvements in version 6, > so most likely this feature will also be added. > You can try looking in our wiki > http://wiki.mikrotik.com/wiki/User/Routing > There are a lot of load balancing examples, for example, “ECMP Failover Script” Regards, Maris B. 10/23/2014 15:27

Thank you very much Maris,I hope so…very soon.What took you so long? Ohh…Mikrotik.

seems like it should be ‘in version 7’ =)

Hi Chupaka,
Is it that long? hah! >_<