Community discussions

MikroTik App
 
User avatar
broderick
Member Candidate
Member Candidate
Topic Author
Posts: 242
Joined: Mon Nov 30, 2020 7:44 pm

Failover with Ethernet port 5 and WLAN1

Fri Mar 26, 2021 2:58 pm

Hi everyone,

I'd like to set a failover/load balance on my Mikrotik hap ac2.
It should be between ethernet port 5 and WLAN1, so that if WAN on ethernet port 5 goes down the wireless connection setting on Wlan1 (connection from my smartphone device in tethering)
automatically start or keeps working without me noticicing.
I am a bit at a loss as to how to set it properly though.

I managed (I hope) to set up the connection on WLAN1 and it works:
/interface bridge
add admin-mac=XX:XX:XX:XX:XX:XX auto-mac=no comment=defconf name=bridge
/interface list
add comment=defconf name=WAN
add comment=defconf name=LAN
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
......

add authentication-types=wpa2-psk eap-methods="" management-protection=allowed mode=dynamic-keys name="WAN WiFi VOD" \
    supplicant-identity="" wpa2-pre-shared-key=abcddefghilmno123
    

/interface wireless
set [ find default-name=wlan1 ] band=2ghz-b/g/n country="united states3" disabled=no frequency=2422 installation=indoor \
    keepalive-frames=disabled multicast-buffering=disabled security-profile="WAN01" ssid=vodcon station-roaming=\
    disabled wds-default-bridge=bridge wds-mode=dynamic wmm-support=enabled
......
    wmm-support=enabled wps-mode=disabled
/interface bridge port
add bridge=bridge comment=defconf interface=ether2
add bridge=bridge comment=defconf interface=ether4
add bridge=bridge comment=defconf interface=ether5
add bridge=bridge comment=defconf interface=wlan2
add bridge=bridge interface=wlan3
add bridge=bridge interface=ether1
add bridge=bridge interface=ether3
/interface list member
add comment=defconf interface=bridge list=LAN
add comment=defconf interface=wlan1 list=WAN


I am not sure now about how to set the second wan on port ethernet 5, then set a failover/load-balance with the two of them.

Could you help me figured it out please?
Thanks
 
aesmith
Member Candidate
Member Candidate
Posts: 264
Joined: Wed Mar 27, 2019 6:43 pm

Re: Failover with Ethernet port 5 and WLAN1

Fri Mar 26, 2021 3:54 pm

I have this working, although my failover is between two Ethernet interfaces, one goes to my LTE router as the main Internet connection. The other goes to a secondary. I use what Mikrotik call "recursive" routes, where you test a remote host via one of your interfaces, then set a default route via this remote host.
To get started, do you have both your Internet routes working? I don't see any routes in your configuration. However as an example, you way your main Internet is on Ether 5, for an Ethernet connection you also need the next hop gateway address. Let's say it's x.x.x.x
So choose a remote destination which should always be reachable via your main Internet, as an example we'll use 8.8.8.8. Create a route for that destination via your Ether 5 next hop.
/ip route 
add check-gateway=ping comment="*** Remote Gateway Google DNS ***" distance=1 dst-address=8.8.8.8/32 gateway=x.x.x.x scope=10
Then create a default route via that gateway ...
/ip route 
add check-gateway=ping comment="*** Default - LTE Recursive ***" distance=2 gateway=8.8.8.8
Now you have a default route to the Internet via your Ether5, but if it stops being able to ping 8.8.8.8 then that route will be deactivated. To complete the mechanism create another default route via your WLAN tethered phone, but set "distance" as something higher like 5 so it is only used if the preferred route is inactive.

You can beef this up a little in a few ways. For example I have two remote gateways via my main connection, and two default routes one for each gateway. So I only fail over if both those gateways go unreachable. Ideally don't use something generic like 8.8.8.8, use something specific to your ISP at least as one of them. Something like their NTP server or DNS.

Who is online

Users browsing this forum: 0xAA55, itvisionpk, rarlup and 43 guests