Page 1 of 1

Feature request: routing via dynamic gateway w/out scripting

Posted: Tue Feb 22, 2011 10:20 am
by forne
The problem
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
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=<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.

Re: Feature request: routing via dynamic gateway w/out scrip

Posted: Wed Feb 23, 2011 8:17 pm
by Chupaka
Can anybody explain me ethernet network design, when GW can be changed during DHCP address renewal?..

Re: Feature request: routing via dynamic gateway w/out scrip

Posted: Fri Feb 25, 2011 4:26 pm
by forne
I suppose that there are several routers in one broadcast segment running in order to do load balancing.

Re: Feature request: routing via dynamic gateway w/out scrip

Posted: Fri Feb 25, 2011 5:55 pm
by Chupaka
but in that case previous gateway should also work, I believe...

Re: Feature request: routing via dynamic gateway w/out scrip

Posted: Sat Feb 26, 2011 4:38 am
by forne
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

Re: Feature request: routing via dynamic gateway w/out scrip

Posted: Thu Mar 10, 2011 11:14 am
by forne
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/viewtopic.php?f=9&t=40417
http://forum.mikrotik.com/viewtopic.php?f=2&t=14461
http://forum.mikrotik.com/viewtopic.php?f=6&t=6007
http://forum.mikrotik.com/viewtopic.php?f=6&t=2622

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@?

Re: Feature request: routing via dynamic gateway w/out scrip

Posted: Thu Mar 10, 2011 7:31 pm
by Chupaka
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

Re: Feature request: routing via dynamic gateway w/out scrip

Posted: Sat Mar 12, 2011 7:22 am
by forne
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?

Re: Feature request: routing via dynamic gateway w/out scrip

Posted: Sat Mar 12, 2011 8:06 pm
by Chupaka
no, you cannot - you don't know that. do you need that?

Re: Feature request: routing via dynamic gateway w/out scrip

Posted: Sat Aug 06, 2011 10:20 pm
by rborz
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. ;-)

See: http://forum.mikrotik.com/viewtopic.php?f=1&t=47781

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

Regards,
Robert

Re: Feature request: routing via dynamic gateway w/out scrip

Posted: Thu Aug 11, 2011 1:16 pm
by pedja
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.

Re: Feature request: routing via dynamic gateway w/out scrip

Posted: Tue Aug 16, 2011 5:47 pm
by pkelly1603
I had a similar request:

http://forum.mikrotik.com/viewtopic.php?f=2&t=50273

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

Re: Feature request: routing via dynamic gateway w/out scrip

Posted: Mon Oct 13, 2014 8:02 am
by jabavox
Is it any solution on this question yet,...Ohhh mikrotik

Re: Feature request: routing via dynamic gateway w/out scrip

Posted: Mon Oct 13, 2014 1:32 pm
by janisk
/ip dhcp-client add add-default-route=
no  special-classless  yes
and another option
default-route-distance

Re: Feature request: routing via dynamic gateway w/out scrip

Posted: Tue Oct 14, 2014 10:00 am
by jabavox
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.
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.
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.

Re: Feature request: routing via dynamic gateway w/out scrip

Posted: Thu Oct 23, 2014 7:38 pm
by jabavox
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.

Re: Feature request: routing via dynamic gateway w/out scrip

Posted: Fri Oct 24, 2014 11:29 am
by Chupaka
seems like it should be 'in version 7' =)

Re: Feature request: routing via dynamic gateway w/out scrip

Posted: Fri Oct 24, 2014 1:32 pm
by jabavox
seems like it should be 'in version 7' =)
Hi Chupaka,
Is it that long? hah! >_<