Community discussions

MikroTik App
 
dke
newbie
Topic Author
Posts: 47
Joined: Tue Dec 10, 2019 11:30 pm
Location: Austria

Redundant WAN, Prefer ether1 over wlan1

Tue Jun 02, 2020 5:11 pm

Given two redundant WAN on ether1 and wlan1, I'd like to have ether1 route preferred over wlan1, in case both are available.
Current setup has two DHCP clients with two separate IP addresses. I tried a lower "Default Route Distance" for ether1 in its DHCP Client > Advanced options, but IP > Routes shows two 0.0.0.0/0 routes, DAS and DS, both "reachable wlan1". A static route to 0.0.0.0/0 over gateway ether1 does not work (not reachable), why? Temporarily disabling wlan1 changes the route to ether1 gateway as expected.

Thanks,
Daniel
 
solar77
Long time Member
Long time Member
Posts: 586
Joined: Thu Feb 04, 2016 11:42 am
Location: Scotland

Re: Redundant WAN, Prefer ether1 over wlan1

Thu Jun 04, 2020 12:56 pm

Routes shows two 0.0.0.0/0 routes
Yes it will do this as both are available. but in Winbox you will see one is black (active) and one is blue (inactive)
 
dke
newbie
Topic Author
Posts: 47
Joined: Tue Dec 10, 2019 11:30 pm
Location: Austria

Re: Redundant WAN, Prefer ether1 over wlan1

Thu Jun 04, 2020 2:37 pm

Yes, also the DAS (Dynamic Active Static) indicates this. But how can I enforce the ether1 route to be the active one?
 
solar77
Long time Member
Long time Member
Posts: 586
Joined: Thu Feb 04, 2016 11:42 am
Location: Scotland

Re: Redundant WAN, Prefer ether1 over wlan1

Thu Jun 04, 2020 3:38 pm

no need to enforce, once you see the correct route is black, that means it's active, and that's what the route for your internet uplink.
the other fail-over route, is blue, and while it is reachable, no traffic is routed towards this gateway.

to test, just type what is my ip address on google, it tells you which public IP you are currently behind.
and if setup correctly, if you unplug ether1, the route via wlan1 should turn from blue to black, meaning it is now active,

watch your dns setting so you don't use the DNS for one route, obviously when you use another route, this DNS server won't be available. I'd use something like 1.1.1.1
 
dke
newbie
Topic Author
Posts: 47
Joined: Tue Dec 10, 2019 11:30 pm
Location: Austria

Re: Redundant WAN, Prefer ether1 over wlan1

Thu Jun 04, 2020 5:54 pm

Thanks for digging in but I think there is still a misunderstanding.
I have an Ethernet cable plugged to ether1 and an active WiFi connection at wlan1 interface. Both are connected to the internetz and configured as WAN. Now I want to have the route to 0.0.0.0/0 via ether1 interface active (as it is faster), but for a reason I do not undestand, the router choses the route via wlan1 to be active. The wlan1 route shall only become active as fallback, once the ether1 is not available.
 
patrick7
Member
Member
Posts: 351
Joined: Sat Jul 20, 2013 2:40 pm

Re: Redundant WAN, Prefer ether1 over wlan1

Thu Jun 04, 2020 6:22 pm

metric?
 
dke
newbie
Topic Author
Posts: 47
Joined: Tue Dec 10, 2019 11:30 pm
Location: Austria

Re: Redundant WAN, Prefer ether1 over wlan1

Thu Jun 04, 2020 6:38 pm

metric?
Not sure what you mean with metric? I just see a "Distance" in the IP > Routes that is read-only, presumably because of the dynamic route?
 
solar77
Long time Member
Long time Member
Posts: 586
Joined: Thu Feb 04, 2016 11:42 am
Location: Scotland

Re: Redundant WAN, Prefer ether1 over wlan1

Thu Jun 04, 2020 9:10 pm

@dke

yes I understand what your request is.

I think, with distance on ether1 set to 1 and distance on wlan1 set to 2, as long as ether1 is running, Mikrotik will route all traffic through ether1. this is what you want yes?
you will see both route showing up in routing table and both can be dynamic / static, but the lower distanced is active and is shown as Black, while the higher distanced route is reachable but not active, and is shown as Blue.
https://wiki.mikrotik.com/wiki/Manual:I ... _selection
Candidate route with the lowest distance becomes an active route. If there is more than one candidate route with the same distance, selection of active route is arbitrary (except for BGP routes).
 
dke
newbie
Topic Author
Posts: 47
Joined: Tue Dec 10, 2019 11:30 pm
Location: Austria

Re: Redundant WAN, Prefer ether1 over wlan1

Fri Jun 05, 2020 7:49 am

I think, with distance on ether1 set to 1 and distance on wlan1 set to 2, as long as ether1 is running, Mikrotik will route all traffic through ether1. this is what you want yes?
Yes, exactly. But this is not what the router does :(
With distance you are referring to the default-route-distance in IP > DHCP-Client, right?
you will see both route showing up in routing table and both can be dynamic / static, but the lower distanced is active and is shown as Black, while the higher distanced route is reachable but not active, and is shown as Blue.
It's true that both routes are created while only one is active but my problem is that both routes show "reachable wlan1":
/ip dhcp-client print detail
Flags: X - disabled, I - invalid, D - dynamic 
 0   ;;; defconf
     interface=ether1 add-default-route=yes 
     default-route-distance=1 use-peer-dns=yes use-peer-ntp=yes 
     dhcp-options=hostname,clientid status=bound address=192.168.144.170/24 
     gateway=192.168.144.254 dhcp-server=192.168.144.210 
     primary-dns=192.168.144.210 secondary-dns=8.8.4.4 
     expires-after=1w23h34m48s 

 1   interface=wlan24 add-default-route=yes default-route-distance=2 
     use-peer-dns=yes use-peer-ntp=yes dhcp-options=hostname,clientid 
     status=bound address=192.168.144.175/24 gateway=192.168.144.254 
     dhcp-server=192.168.144.210 primary-dns=192.168.144.210 
     secondary-dns=8.8.4.4 expires-after=1w23h59m9s
		 
		 
/ip route print detail
Flags: X - disabled, A - active, D - dynamic, 
C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme, 
B - blackhole, U - unreachable, P - prohibit 
 0 ADS  dst-address=0.0.0.0/0 gateway=192.168.144.254 
        gateway-status=192.168.144.254 reachable via  wlan24 distance=1 
        scope=30 target-scope=10 vrf-interface=ether1 

 1  DS  dst-address=0.0.0.0/0 gateway=192.168.144.254 
        gateway-status=192.168.144.254 reachable via  wlan24 distance=2 
        scope=30 target-scope=10 vrf-interface=wlan24 

 ...
The traffic is routed via wlan2 - I can say this for sure as Interfaces show traffic on wlan2 and in my case, wlan2 speed is ~5 Mbps while ether1 is 100 Mbps. When deactivating wlan2 interface I reach again 100 Mbps.
 
solar77
Long time Member
Long time Member
Posts: 586
Joined: Thu Feb 04, 2016 11:42 am
Location: Scotland

Re: Redundant WAN, Prefer ether1 over wlan1

Fri Jun 05, 2020 12:38 pm

I guess this is something to do with the fact both DHCP client share the same gateway, and DHCP server. so when the route changes, the gateway 192.168.144.254 remains the same
So they are connecting to the same router for Internet access ? I assume you want some redundancy if ether1 fails.

in this case, I am not sure what's the best way forward as this is not a common scenario.
but first try not use add default route in DHCP client, add static route yourself and use the interface as gateway, instead of an IP address. I am not sure if this is going to make a difference but it's easy enought to try.

few things also come to mind, OSPF with metric
or you want to try script, you can enable wlan1, only when ether1 is not running,
 
dke
newbie
Topic Author
Posts: 47
Joined: Tue Dec 10, 2019 11:30 pm
Location: Austria

Re: Redundant WAN, Prefer ether1 over wlan1

Mon Jun 08, 2020 11:59 am

So they are connecting to the same router for Internet access ? I assume you want some redundancy if ether1 fails.
Exactly.
but first try not use add default route in DHCP client, add static route yourself and use the interface as gateway, instead of an IP address. I am not sure if this is going to make a difference but it's easy enought to try.
I tried that as initially described. With the Route being active (AS), I don't have internet - is there a way to see why not? Even with both gateways set and reachable:
/ip route print detail
Flags: X - disabled, A - active, D - dynamic, 
C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme, 
B - blackhole, U - unreachable, P - prohibit 
 0 A S  dst-address=0.0.0.0/0 gateway=ether1,wlan1 
        gateway-status=ether1 reachable,wlan1 reachable distance=1 
        scope=30 target-scope=10
        
... (others are DS)
        
few things also come to mind, OSPF with metric
But that would require the above to work, right?
or you want to try script, you can enable wlan1, only when ether1 is not running,
Uh. I was hoping to avoid scripts for such a simple problem :(
 
solar77
Long time Member
Long time Member
Posts: 586
Joined: Thu Feb 04, 2016 11:42 am
Location: Scotland

Re: Redundant WAN, Prefer ether1 over wlan1

Tue Jun 09, 2020 2:24 pm

static route should work , mikrotik need 3 things to get wan interface working: route, correct IP on the interface and NAT.

I will setup a lab test and see how to get it working. no pint me trying suggesting something I am not 100% sure.

in the meantime, I think a simple bounding would definitely work, so you bound the ether1 and wlan ,in "active-backup" mode. have a look . I have tested load balancing rr mode which was not complicated to setup. have a look wiki examples.
 
dke
newbie
Topic Author
Posts: 47
Joined: Tue Dec 10, 2019 11:30 pm
Location: Austria

Re: Redundant WAN, Prefer ether1 over wlan1

Wed Jun 10, 2020 11:11 am

in the meantime, I think a simple bounding would definitely work
Thank you very much solar77! This is exactly what I was looking for. No custom routes, just a redundancy, perfect :-) At first I was a bit frustrated because it did not work, but a router reboot solved it.

What I did: Added both interfaces to the bonding with "active-backup" mode. Added bonding to WAN interface list. Added DHCP client for bonding, disabled the other DHCP clients. Ensured Firewall/NAT links to WAN interface list.
 
solar77
Long time Member
Long time Member
Posts: 586
Joined: Thu Feb 04, 2016 11:42 am
Location: Scotland

Re: Redundant WAN, Prefer ether1 over wlan1

Wed Jun 10, 2020 12:40 pm

glad it worked for you. I got my head stuck in trying to figure out the routing part, only realized bounding is the answer as I type up the last reply.

it would interesting to find how smooth the fail-over is and test if it causes noticeable drop in voip call or online gaming.
 
dke
newbie
Topic Author
Posts: 47
Joined: Tue Dec 10, 2019 11:30 pm
Location: Austria

Re: Redundant WAN, Prefer ether1 over wlan1

Wed Jun 10, 2020 1:39 pm

The duration of fail-over is not of importance for our application.
I did a quick non-formal test and the outage was approx 4.5 seconds for each of both directions (i.e. master->slave, plugging of ethernet cable, and slave->master, plugging back ethernet cable).
Thanks again!
 
solar77
Long time Member
Long time Member
Posts: 586
Joined: Thu Feb 04, 2016 11:42 am
Location: Scotland

Re: Redundant WAN, Prefer ether1 over wlan1

Wed Jun 10, 2020 2:44 pm

thank you for the test as well!
 
dke
newbie
Topic Author
Posts: 47
Joined: Tue Dec 10, 2019 11:30 pm
Location: Austria

Re: Redundant WAN, Prefer ether1 over wlan1

Fri Aug 28, 2020 10:12 am

Hi,

I'm not sure what happened but my failover WAN (via wlan1) isn't working anymore. I have a failover WAN bonding interface with active-backup and mii monitoring:
/interface bonding
add name=bond_wan slaves=ether1,wlan1 primary=ether1 mode=active-backup
The router gets IP and Gateway via DHCP, but is unable to ping the WAN router. After some time I found that there seems to be a MAC address confusion.
What I understand from the documentation ...
The MAC address of the bonding interface is presented onto the active port to avoid confusing the switch.
... is that the bonding interface should have a separate MAC address?

In my current setup, only wlan1 is connected. However, the MAC address of ether1 is presented in the bonding interface, although ether1 is not connected (no link). Only if I force the MAC address to the one from the wlan1 interface, I get WAN connectivity. Removing the forced MAC address, the interface MAC changes again to the one from ether1 and there is no WAN connectivity.

Is this expected behavior? What can I do to get around this?

hAP ac v6.47.2, also tested on v6.45.9.

Thanks,
Daniel
 
dke
newbie
Topic Author
Posts: 47
Joined: Tue Dec 10, 2019 11:30 pm
Location: Austria

Re: Redundant WAN, Prefer ether1 over wlan1

Mon Aug 31, 2020 12:58 pm

Is there more info/config you need? Or do you guys suggest to create a new topic?
Any suggestions very welcome.
 
WeWiNet
Long time Member
Long time Member
Posts: 610
Joined: Thu Sep 27, 2018 4:11 pm

Re: Redundant WAN, Prefer ether1 over wlan1

Mon Aug 31, 2020 1:38 pm

Bonding intended to connect two physical interfaces to the same other equipment and bond those links together.
It is to create faster speeds over for example 1Gbps ethernet, by using two or more of them...
It is kind of "one interface" afterwards.

You can not use this on two outgoing (WAN) interfaces which have different IP etc. (bonding needs the same mechanism on the other end).

Normally you should do:
Use your DHCP client on ETH1 with "add default route" checked. and on your DHCP client on WLAN uncheck the default route.
In IP/Route add one route for 0.0.0.0 with distance "20" that goes towards your WLAN interface...
This one will not be active until you DISCONNECT the ETH1 ethernet cable, or the device your box is connected is switched off!!!
All this setup does not cover the case where your modem will be up and running but your internet connection is lost.
For this you need to have recursive routes with failover. There is a good topic on this by Chupaka...!
 
dke
newbie
Topic Author
Posts: 47
Joined: Tue Dec 10, 2019 11:30 pm
Location: Austria

Re: Redundant WAN, Prefer ether1 over wlan1

Tue Sep 01, 2020 11:47 am

Use your DHCP client on ETH1 with "add default route" checked. and on your DHCP client on WLAN uncheck the default route.
In IP/Route add one route for 0.0.0.0 with distance "20" that goes towards your WLAN interface...
This one will not be active until you DISCONNECT the ETH1 ethernet cable, or the device your box is connected is switched off!!!
Thanks a lot, it works in principle, however, with two caveats:
1) If I just add a route via wlan1, it does not work. I had to specify the gateway IP address which is unfortunate. RouterOS says wlan1 reachable, but does not route unless I manually set the gateway.
2) If I connect ether1, it dynamically adds the route and works fine. If I unplug, the DCHP client remains bond (why?) and thus does not delete the dynamic route. Is there a way to have the DHCP binding released once interface has no link (without using periodic scripts)?
 
WeWiNet
Long time Member
Long time Member
Posts: 610
Joined: Thu Sep 27, 2018 4:11 pm

Re: Redundant WAN, Prefer ether1 over wlan1

Tue Sep 01, 2020 12:23 pm

Export tour IP/route settings.
If you have DHCP client with add dynamic route it on ETH1 and you unplug the cable it should not be reachable.
Have you put anither fixed address on ETH1?
 
dke
newbie
Topic Author
Posts: 47
Joined: Tue Dec 10, 2019 11:30 pm
Location: Austria

Re: Redundant WAN, Prefer ether1 over wlan1

Tue Sep 01, 2020 12:57 pm

If you have DHCP client with add dynamic route it on ETH1 and you unplug the cable it should not be reachable.
It is remains on reachable as not recognized automatically. Only once I do a manual Release/Renew it is no longer reachable via ether1.
Have you put anither fixed address on ETH1?
No. My configuration is quite simple:
/ip route
add distance=20 gateway=192.168.144.254

/ip dhcp-client
add disabled=no interface=ether1
add add-default-route=no disabled=no interface=wlan1

# /ip address has only non-WAN address on my internal bridge
If I unplug ether1, both the static and dynamic route remains on reachable via ether1 and DHCP Client remains on "bound".
 
WeWiNet
Long time Member
Long time Member
Posts: 610
Joined: Thu Sep 27, 2018 4:11 pm

Re: Redundant WAN, Prefer ether1 over wlan1

Tue Sep 01, 2020 4:43 pm

PS: Which ROS are you on?

Have you removed all the "bonding" you mentioned earlier? Without that it will not work!

You must have two GW uplinks (one on ETH1 and one on WLAN). With two different GW IP?
The routes also need to go to the GW IP address!

192.168.144.254 in your route might be the IP address of the interface "WLAN" or ETH1 and not the one of the GW?
Normally GW should be 192.168.144.1 ...! Which is the IP address of your WLAN router or ETH1 DSL? or GPON router.
 
dke
newbie
Topic Author
Posts: 47
Joined: Tue Dec 10, 2019 11:30 pm
Location: Austria

Re: Redundant WAN, Prefer ether1 over wlan1

Tue Sep 01, 2020 5:09 pm

PS: Which ROS are you on?
hAP ac v6.47.2
Have you removed all the "bonding" you mentioned earlier?
Yes
You must have two GW uplinks (one on ETH1 and one on WLAN). With two different GW IP?
No, it's the same router, same gateway. The use case is that I do not always have the possibility to attach an Ethernet cable and want to use wlan1 as fallback.
The routes also need to go to the GW IP address!
For your example, the dynamic route (ether1) gets the gateway from DHCP and sets it properly. The static route was configured by me.
192.168.144.254 in your route might be the IP address of the interface "WLAN" or ETH1 and not the one of the GW?
Normally GW should be 192.168.144.1 ...! Which is the IP address of your WLAN router or ETH1 DSL? or GPON router.
192.168.144.254 is in fact the gateway address of my WAN - just that it would be the same for both ether1 and wlan1.
 
WeWiNet
Long time Member
Long time Member
Posts: 610
Joined: Thu Sep 27, 2018 4:11 pm

Re: Redundant WAN, Prefer ether1 over wlan1

Tue Sep 01, 2020 6:28 pm

Oha...now I get it.

have you tried to enable "add default route" on both DHCP clients, and in the advanced tab, you put for distance "2" on the WLAN one?
if that does not work, create static routes and to put as GW the interface itself instead of the IP address into your route.

The problem is if you unplug or not ethernet, the router is able to reach destination (the GW) via WLAN ... so that might confuses him
and the route remains active.

I am pretty sure recursive routes should do it, but that needs more setup (see the article I mentioned in one of my earlier posts).
 
dke
newbie
Topic Author
Posts: 47
Joined: Tue Dec 10, 2019 11:30 pm
Location: Austria

Re: Redundant WAN, Prefer ether1 over wlan1

Wed Sep 02, 2020 9:50 am

Yes, certainly I tried this (see initial post), but RouterOS seems to be confused by the same gateway IP address.
I guess I found Chupakas Tutorial on Routing Failover you mentioned, but I doubt that this will work with the same gateway as the same problem persists.

I finally found a configuration that comes close to what I wanted to have. I described it in this new thread where I directly requested a change to prevent the route confusion in RouterOS.

Summary:
  • add-default-route=no on both interfaces
  • two static routes to the gateway, 192.168.144.254%wlan1 and 192.168.144.254%ether1
Best,
Daniel

Who is online

Users browsing this forum: No registered users and 27 guests