Page 1 of 1

Dual WAN Failover with DHCP on WAN port.

Posted: Wed Jan 21, 2015 1:33 am
by jpineira
I need help with configuring internet failover on a Mikrotik. It's 2 WAN connections. Both connections are DHCP. I have gone through most tutorials but most failover scenarios are for WAN ports with static IPs and static gateways. The gateways on both of these connections will occasionally change. Any suggestions?

Re: Dual WAN Failover with DHCP on WAN port.

Posted: Wed Jan 21, 2015 7:13 pm
by rmmccann
Rather than specifying an IP address as the gateway, can you simply specify the physical interface as the gateway? I just tried this on a PPPoE lab connection I have and it seems to work fine for the default route.

ie:
/ip route add distance=1 gateway=ether1-gateway

Re: Dual WAN Failover with DHCP on WAN port.

Posted: Wed Jan 21, 2015 7:28 pm
by InoX
Set dhcp client on both connections.
Add default route 1 and default route 2 for main and secondary wans.
Done.
Default gateway will be pinged for every connection but if the internet is not working and ping till gateway work, failover will not work.

Re: Dual WAN Failover with DHCP on WAN port.

Posted: Mon Sep 11, 2017 6:38 am
by thewickerman666
InoX your solution worked awesomely well for me. This is on my hapAC (MikroTik RouterOS 6.40.3 (c) 1999-2017) dual wan failover with DHCP on wan ports.

I have ether1 (WAN1) connected to a TWC DOCSIS3.0 modem, and ether2 (WAN2) connected to a google fiber.
Selection_001.png
Selection_002.png
::For WAN1::
IP > DHCP Client > DHCP tab > interface: ether1; add default route : yes
IP > DHCP Client > Advanced tab > Default Route Distance: 1

::For WAN2::
IP > DHCP Client > DHCP tab > interface: ether2; add default route : yes
IP > DHCP Client > Advanced tab > Default Route Distance: 2

I had static routes set with scope and distance setting per some previous posts, I have now deleted them now. These are not needed if one uses InOX's solution.

Thanks InOX.

In addition i realised that without ping check the changeover is not very effective especially if you have unresponsive modem/gateway device. So found that adding this in the routing filter is helping:
/routing filter
add action=passthrough chain=dynamic-in disabled=no set-check-gateway=ping
the above is as suggested in here by tabate47: viewtopic.php?t=112532#

Would appreciate if people would post their finding and test observations. Thanks tabate47.

Re: Dual WAN Failover with DHCP on WAN port.

Posted: Sat Sep 21, 2019 1:56 pm
by viktorcode
I'm trying to fo roughly the same thing but with the difference being that one of my WAN connections is PPPoE and the other one is DHCP. My problem is when with the PPPoE connection setup I'm trying to add DHCP client to the corresponding ethernet port I get the following: "Couldn't add New DHCP Client - can not run on slave interface (6)"

How do I do it?