Community discussions

MikroTik App
 
twoj
just joined
Topic Author
Posts: 4
Joined: Sun Jul 02, 2023 11:17 pm

Failover WAN Thru wifi bridge

Sun Jul 02, 2023 11:50 pm

Hi Everyone,
Recently i made the move from an EdgeRouter to Mikrotik since i recently got a fiber connection and the old router wouldn't have kept up. So forgive me on my learning curve on these devices.
So my main router is the CCR2004-16G-2S+PC and is working great. I also have a good data plan on my cellphone and i would like to set up a failover WAN connection that runs from my cellphone hotspot to a hAP ax2; the setup would look like this;

Failover_WAN_Thru_Wifi_Bridge.JPG

The connection from the hAP i have figured out, and I think i know how to put in the second route as a lower distance than the primary wan. (i read that recursive routing would be better but that it doesn't really work with PPPoE connections)
However i am uncertain what would be the best way to configure the connection between the hAP and the CCR2004 (The magic link).
I'd appreciate any guidance.
thanks.
You do not have the required permissions to view the files attached to this post.
 
drasked
just joined
Posts: 11
Joined: Sun Jun 18, 2023 1:03 pm

Re: Failover WAN Thru wifi bridge

Mon Jul 03, 2023 10:57 pm

You can make recursive routes over pppoe interfaces.

On the HAP i would make a bridge and add the wlan interface and the interface connected to the CCR, and on the CCR i would add a dhcp client on that interface to get an IP from your hotspot.
 
twoj
just joined
Topic Author
Posts: 4
Joined: Sun Jul 02, 2023 11:17 pm

Re: Failover WAN Thru wifi bridge

Tue Feb 20, 2024 7:02 pm

What initially set me off on this parh was that i was having trouble with my main ISP so i wanted to be able to have a failover to my mobile hotspot in case i needed to access the internet while the main ISP was down.
I had found this article which shows how to do one part of the setup, specifically the wifi bridge to the AP;
https://sanisimov.com/2019/02/connect-m ... iguration.
This is designed with the older RouterOS6 so its a bit different now in RouterOS7

After some time i finally was able to spend the time to figure this out - it is relatively simple once you understand the networking, Here is the main points of my config for the hAP ax2
/ip pool
add name=default-dhcp ranges=192.168.88.10-192.168.88.254
/ip dhcp-server
add address-pool=default-dhcp interface=bridge name=defconf
/interface bridge port
add bridge=bridge interface=ether2 internal-path-cost=10 path-cost=10
add bridge=bridge interface=ether3 internal-path-cost=10 path-cost=10
add bridge=bridge interface=ether4 internal-path-cost=10 path-cost=10
add bridge=bridge interface=ether5 internal-path-cost=10 path-cost=10
add bridge=bridge interface=WiFi_2.4G internal-path-cost=10 path-cost=10
/ip neighbor discovery-settings
set discover-interface-list=LAN

/interface detect-internet
set detect-interface-list=all
/interface list member
add comment=defconf interface=bridge list=LAN
add comment=defconf interface=WiFi_5G list=WAN
/ip address
add address=192.168.88.1/24 comment="Bridge to Main Router" interface=bridge \
    network=192.168.88.0
/ip dhcp-client
add comment="This is the DHCP Client to access the 5GHz AP - ie the source wif\
    i connection - This connection will be invalid if not connected to the AP" \
    interface=WiFi_5G
add address=192.168.88.0/24 comment=defconf dns-server=192.168.88.1 gateway=\
    192.168.88.1
/ip dns
set allow-remote-requests=yes
/ip dns static
add address=192.168.88.1 comment=defconf name=router.lan

/ip firewall nat
add action=masquerade chain=srcnat comment="defconf: masquerade" \
    ipsec-policy=out,none out-interface-list=WAN
/ip route
add comment="Return path to Lan_Primary" disabled=no dst-address=\
    192.168.10.0/24 gateway=192.168.88.1 routing-table=main \
    suppress-hw-offload=no
The basic setup is setting the LAN ports (optionally add wifi_2.4 ) as a bridge, define a static IP of 192.168.88.1 on an interface (int2 in my case) , set the 5Ghz in station mode, and then join the AP of your secondary WAN. Once connected you can confirm that you have internet access through that connection. Then set a static route back to your main router LAN IP range using the interface IP on the hAP, again my case it is 192.168.88.1

Next on the main router i configured a static IP of 192.168.88.2 on int1(eth1), connect int1 (main router) to int2 on hAP and verify that you can ping both sides of the connection. Finally add an second internet route in the main router with a higher distance out to the internet using the IP of the hAP (in my case 192.168.88.1).
I made the mistake of using the IP on the main router, 192.168.88.2, as the gateway but in reflection it is the source IP and not the gateway.

Here's what the diagram looks like and i hope this helps anyone figure out this type of setup;
You do not have the required permissions to view the files attached to this post.
 
Mesquite
Member
Member
Posts: 420
Joined: Tue Jan 23, 2024 9:16 pm

Re: Failover WAN Thru wifi bridge

Tue Feb 20, 2024 8:08 pm

Recursive works fine,...........just dont select default route on the pppoe client settings as were are doing its routes manually!!
One WAN, two different DNS addresses to ensure the ppoe wan is reaching the internet.

/ip route
add distance=1 check-gateway=ping dst-address=0.0.0.0/0 gateway=1.1.1.1 routing-table=main scope=10 target-scope=12
add distance=2 check-gateway=ping dst-address=0.0.0.0/0 gateway=9.9.9.9 routing-table=main scope=10 target-scope=12
++++++++++++++++++
add distance=1 dst-address=1.1.1.1/32 gateway=pppoe-out1 routing-table=main scope=10 target-scope=11
add distance=2 dst-address=9.9.9.9/32 gateway=pppoe-out1 routing-table=main scope=10 target-scope=11


Now to make available the WIFI WAN connection in your IP DHCP client setings simply ensure distance=3.
If, the connection to the ISP is down, then both recursive routes will fail and the router will use the WIFI.
If, the connection to the ISP is up then the router will use the recursive connection to cloudflare.
If the connection to the ISP is up but the connection to cloudflare is not working, then the router will use the recursive route to quad9.

Due to distance selections and check-gateway=ping. the Router will attempt always to return to the recursive routes when they are back up.