Community discussions

 
atlamar
just joined
Topic Author
Posts: 5
Joined: Wed Aug 21, 2019 5:52 pm

Loab Balance Failover

Wed Aug 21, 2019 6:42 pm

Hi guys!
Congratulations for this amazing forum. It's the 1st time i post here.
I'm trying to setup a load balance with fail over between 2 different wans, one from dsl router about 25 Mbps and another one from Nanostation 2, receiving from an AirGrid antenna.
I use the RB2011UiAS-2HnD-IN with its ether1(WAN1) connected to DSL Router and ether2(WAN2) connected to Nanostation M2 which is in Station mode.
The WAN1 IP is 192.168.2.2 and gateway is 192.168.2.1 while the WAN2 IP is 192.168.1.2 and gateway is 192.168.1.10.
I post below the configuration script for this project:
interface bridge
add name=bridge
/interface ethernet
set [ find default-name=ether1 ] name=WAN1
set [ find default-name=ether2 ] name=WAN2
/ip pool
add name=dhcp_pool0 ranges=192.168.20.2-192.168.20.254
/ip dhcp-server
add address-pool=dhcp_pool0 disabled=no interface=bridge name=dhcp1
/interface bridge port
add bridge=bridge interface=wlan1
add bridge=bridge interface=ether3
add bridge=bridge interface=ether4
add bridge=bridge interface=ether5
add bridge=bridge interface=ether6
add bridge=bridge interface=ether7
add bridge=bridge interface=ether8
add bridge=bridge interface=ether9
add bridge=bridge interface=ether10
/ip address
add address=192.168.2.2/24 interface=WAN1 network=192.168.2.0
add address=192.168.1.2/24 interface=WAN2 network=192.168.1.0
add address=192.168.20.1/24 interface=bridge network=192.168.20.0
/ip dhcp-server network
add address=192.168.20.0/24 gateway=192.168.20.1
/ip dns
set allow-remote-requests=yes servers=8.8.8.8,8.8.4.4
/ip firewall mangle
add action=mark-connection chain=input in-interface=WAN1 new-connection-mark=\
    WAN1_conn passthrough=yes
add action=mark-connection chain=input in-interface=WAN2 new-connection-mark=\
    WAN2_conn passthrough=yes
add action=mark-routing chain=output connection-mark=WAN1_conn \
    new-routing-mark=to_WAN1 passthrough=yes
add action=mark-routing chain=output connection-mark=WAN2_conn \
    new-routing-mark=to_WAN2 passthrough=yes
add action=accept chain=prerouting dst-address=192.168.2.0/24 in-interface=\
    bridge
add action=accept chain=prerouting dst-address=192.168.1.0/24 in-interface=\
    bridge
add action=mark-connection chain=prerouting dst-address-type=!local \
    in-interface=bridge new-connection-mark=WAN1_conn passthrough=yes \
    per-connection-classifier=both-addresses-and-ports:2/0
add action=mark-connection chain=prerouting dst-address-type=!local \
    in-interface=bridge new-connection-mark=WAN2_conn passthrough=yes \
    per-connection-classifier=both-addresses-and-ports:2/1
add action=mark-routing chain=prerouting connection-mark=WAN1_conn \
    in-interface=bridge new-routing-mark=to_WAN1 passthrough=yes
add action=mark-routing chain=prerouting connection-mark=WAN2_conn \
    in-interface=bridge new-routing-mark=to_WAN2 passthrough=yes
/ip firewall nat
add action=masquerade chain=srcnat out-interface=WAN1
add action=masquerade chain=srcnat out-interface=WAN2
/ip route
add check-gateway=ping distance=1 gateway=192.168.2.1 routing-mark=to_WAN1
add check-gateway=ping distance=1 gateway=192.168.1.10 routing-mark=to_WAN2
add check-gateway=ping distance=1 gateway=192.168.2.1
add check-gateway=ping distance=2 gateway=192.168.1.10

Every time i plug the cable to WAN2, i can't connect or the connection is slow. The mikrotik is online and has full speed only with WAN1 and even if i have plugged the WAN2 only, the system is offline... So no fail over, neither load balance...
What's wrong with it?

Thank you in advance.
 
Sob
Forum Guru
Forum Guru
Posts: 4784
Joined: Mon Apr 20, 2009 9:11 pm

Re: Loab Balance Failover

Wed Aug 21, 2019 8:58 pm

Stupid question, are you sure that WAN2 works at all? Config seems ok.

Edit: Are WAN2 routes active? You can also try arp instead of ping for check-gateway.
People who quote full posts should be spanked with ethernet cable. Some exceptions for multi-topic threads may apply.
 
atlamar
just joined
Topic Author
Posts: 5
Joined: Wed Aug 21, 2019 5:52 pm

Re: Loab Balance Failover

Thu Aug 22, 2019 4:16 pm

Stupid question, are you sure that WAN2 works at all? Config seems ok.

Edit: Are WAN2 routes active? You can also try arp instead of ping for check-gateway.

Sure it works, since i see activity in the interface list, although it never exceeds the 20 kbits/s, despite the fact that the Nanostation locks up to 4 Mbits/s.
I'll give a try to arp command in the "check-gateway" field...
 
anav
Forum Guru
Forum Guru
Posts: 3100
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada

Re: Loab Balance Failover

Thu Aug 22, 2019 4:22 pm

I would wait on calling the forum amazing until you have experienced it more fully in all its glory. The good news is that you are in good hands with Sob.
I'd rather manage rats than software. Follow my advice at your own risk! (Sob & mkx forced me to write that!)
 
atlamar
just joined
Topic Author
Posts: 5
Joined: Wed Aug 21, 2019 5:52 pm

Re: Loab Balance Failover

Thu Aug 22, 2019 5:04 pm

I would wait on calling the forum amazing until you have experienced it more fully in all its glory. The good news is that you are in good hands with Sob.
I've been reading this forum the last 2 years when i met the magic world of Mikrotik devices back then, without posting.
It's time to discover it deeper! :D
 
Sob
Forum Guru
Forum Guru
Posts: 4784
Joined: Mon Apr 20, 2009 9:11 pm

Re: Loab Balance Failover

Thu Aug 22, 2019 5:05 pm

Activity on interface doesn't necessarily mean that there's access to internet. What if you disconnect the router and instead plug the cable into computer with statically configured 192.168.1.2/24 and gateway 192.168.1.10?
People who quote full posts should be spanked with ethernet cable. Some exceptions for multi-topic threads may apply.
 
atlamar
just joined
Topic Author
Posts: 5
Joined: Wed Aug 21, 2019 5:52 pm

Re: Loab Balance Failover

Thu Aug 22, 2019 5:36 pm

Activity on interface doesn't necessarily mean that there's access to internet. What if you disconnect the router and instead plug the cable into computer with statically configured 192.168.1.2/24 and gateway 192.168.1.10?
Thank you Sob in advance.
I'll let you know later, because i have to start my shift in my job now.

Rgds
 
atlamar
just joined
Topic Author
Posts: 5
Joined: Wed Aug 21, 2019 5:52 pm

Re: Loab Balance Failover

Fri Aug 23, 2019 3:31 am

Finally, i made it!
IMHO, all the trick was to set the WAN2 IP above the gateway 192.168.1.10.
Once i set it as of 192.168.1.11, i managed to get online, no matter which WAN is plugged. Also, in multiple sockets apps, the download max is the sum of both lines.
Bonding and fail over at once! Thank you guys for all your help!
God bless Mikrotik!
 
Sob
Forum Guru
Forum Guru
Posts: 4784
Joined: Mon Apr 20, 2009 9:11 pm

Re: Loab Balance Failover

Sat Aug 24, 2019 12:31 am

The usual trick is to use address (and other config) provided by ISP or whoever you get the connection from. So I guess there was perhaps some miscommunication in this regard? But important is that it works.
People who quote full posts should be spanked with ethernet cable. Some exceptions for multi-topic threads may apply.

Who is online

Users browsing this forum: No registered users and 21 guests