Community discussions

MikroTik App
 
MrBurger
just joined
Topic Author
Posts: 7
Joined: Sun Jan 11, 2015 12:14 am

RB850 DHCP Failover Impossible?

Sun Jan 11, 2015 12:54 am

Hi
I recently picked up an RB850Gx2 and after configuring port2 as a DHCP WAN connection to a cable router (in modem mode) I am able to obtain a WAN IP/DNS/Gateway fine but no matter what I do I cannot set this up to failover to port3 (connected to a RB912G + 4G miniPCIe modem) using pings...

It works fine if you pull the cable from port2, but invariably, when the cable modem fails, the ethernet connection remains online so the RB850 doesn't switch to port3 :(

When the 'add static route' option is disabled on the DHCP client and a new 0.0.0.0/0 static route is added to point to port2, nothing works..

The Gateway is dynamic too so I can't set it in the static route (it works if I use the previously obtained Gateway IP via DHCP in the route).

Any ideas anyone as this is doing our heads in..

Also, just a quick question re the RB912..
Currently this is connected to port3 on the RB850 and uses an IP of 192.168.2.1 (port3 on the RB850 is set as 192.168.2.2). These are the only IPs used on that subnet.
Is it possible to disable the DHCP client on the RB912 (that obtains a 4G WAN IP) and connect the RB912 directly to the RB850 and have the RB850 obtain an WAN IP instead? I know the 4G service is NAT'ing the connection anyways, but with the current setup, it's NAT'ted again on the RB912 and then again on the RB850.
Any better options people :)

Regards
 
User avatar
Caci99
Forum Guru
Forum Guru
Posts: 1075
Joined: Wed Feb 21, 2007 2:26 pm
Location: Tirane
Contact:

Re: RB850 DHCP Failover Impossible?

Tue Jan 13, 2015 1:36 pm

When it fails what happens? Do you still have a gateway active on /ip routes form the dhcp client?
I would suggest to turn the modem into bridge, so that you have one NAT only. For the failover, take a look at this article
http://wiki.mikrotik.com/wiki/Advanced_ ... _Scripting
it is a very convenient way to set it up. The problem there is that it requires IP-s. If you have a dynamic IP, you would need a script to grab the changing gateway. Here is a short script I wrote about that (make changes to your need):
:global wangw [/ip route get [find dst-address ="0.0.0.0/0" and dynamic static] gateway]
:global wanlastgw [/ip route get [find comment ="Default Route"] gateway]
if ($wangw != $wanlastgw) do= {/ip route set gateway= $wangw [find comment ="Default Route"]}
In the dhcp client setting, you should change the distance of the route accordingly, like 10 for example, so that it is not the primary route.
Try a little bit, and let us know.
For the RB912, you can try to bridge the ethernet and LTE interface into a bridge interface with arp=proxy-arp, and setup dhcp client in RB850.
 
MrBurger
just joined
Topic Author
Posts: 7
Joined: Sun Jan 11, 2015 12:14 am

Re: RB850 DHCP Failover Impossible?

Thu Jan 15, 2015 12:53 am

Hi
Thanks for the reply.

I will look into your suggestions, however I can report that the RB912 doesn't want to allow a bridge between the LTE interface and ether1.
Any attempt (via cli or winbox) to add the LTE interface to a bridge fails.

I guess I will have to stick with the aforementioned setup and rely on the 912 to obtain the LTE WAN IP and share it to the 850 as its secondary gateway.

Speaking of the 850. I will have a go at utilising that script and report back :)

Regards
 
MrBurger
just joined
Topic Author
Posts: 7
Joined: Sun Jan 11, 2015 12:14 am

Re: RB850 DHCP Failover Impossible?

Thu Jan 15, 2015 6:23 pm

Update:
I re-enabled and set the distance of the DHCP Client's 'add static route' to 99.

This is then used to source the Gateway IP and update a new static route (distance 1) every minute by means of that script.
I haven't used the advanced routing info as the ping check seems to function fine and switch to 4G and back again without it.

To test, I merely change the final octet of the Gateway IP and within a few seconds, it switches to the 4G (distance 2).
When the script runs, it spots the different Gateway IP and updates it back (also adding a comment to the system log) thus switching the Gateway back to the modem.

It's not exactly perfect, having a route purely to read its Gateway IP, but at least it works..

Why you can't have the same Gateway check on DHCP that you have for static is anyone's guess...

Many thanks for your help :)

Regards
 
User avatar
Caci99
Forum Guru
Forum Guru
Posts: 1075
Joined: Wed Feb 21, 2007 2:26 pm
Location: Tirane
Contact:

Re: RB850 DHCP Failover Impossible?

Thu Jan 15, 2015 7:19 pm

Why you can't have the same Gateway check on DHCP that you have for static is anyone's guess...
I guess that is the nature of the dhcp protocol, it doesn't look for the dhcp server until lease time expires (at my knowledge). And you can't modify a dynamic route, that's how mikrotik thought about it.
Anyway glad it helped, more so because I am not that good in scripting :).
 
MrBurger
just joined
Topic Author
Posts: 7
Joined: Sun Jan 11, 2015 12:14 am

Re: RB850 DHCP Failover Impossible?

Thu Jan 15, 2015 9:09 pm

Hi
If mikrotik allowed DHCP gateway checking (they already allow a custom distance) all it need do is check the gateway that it gets via DHCP and when down, move to the next highest metric (distance).

I can't see this would impact on any of the dynamic nature of the connection. It would make life easier for those with dynamic wans that want a quick and easy failover though.

Cheers

Who is online

Users browsing this forum: Bing [Bot], kakiharaNL and 134 guests