Community discussions

MikroTik App
 
MrIC
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 66
Joined: Tue Jan 13, 2009 11:34 pm

Load Balance doesn't work .

Fri Apr 17, 2009 2:51 pm

Hello there
i have to gateways and i tried to load balance them at firest i tried
ECMP load balancing with masquerade
i got the two lines speed
Image
but i got connection interruptions every 5~10 min so i tried to find why . i found this topic ECMP
so i tried the other way that normis talked about it ..

but i can't load balace the two lines now
Image

this is my config.

/ip address
add address=192.168.100.1/24 broadcast=192.168.100.255 comment="" disabled=no interface=Local network=192.168.100.0
add address=192.168.0.25/24 broadcast=192.168.0.255 comment="" disabled=no interface=WAN-1 network=192.168.0.0
add address=192.168.1.5/24 broadcast=192.168.1.255 comment="" disabled=no interface=WAN-2 network=192.168.1.0


/ip route
add comment="" disabled=no distance=1 dst-address=0.0.0.0/0 gateway=192.168.0.1 routing-mark=odd scope=255 target-scope=10
add comment="" disabled=no distance=1 dst-address=0.0.0.0/0 gateway=192.168.1.1 routing-mark=even scope=255 target-scope=10
add comment="" disabled=no distance=1 dst-address=0.0.0.0/0 gateway=192.168.1.1 scope=255 target-scope=10


/ip firewall nat
add action=masquerade chain=srcnat comment="" disabled=no out-interface=WAN-1
add action=masquerade chain=srcnat comment="" disabled=no out-interface=WAN-2


/ip firewall mangle
add action=mark-connection chain=prerouting comment="" disabled=no in-interface=Local new-connection-mark=odd passthrough=yes src-address-list=odd
add action=mark-routing chain=prerouting comment="" disabled=no in-interface=Local new-routing-mark=odd passthrough=yes src-address-list=odd
add action=mark-connection chain=prerouting comment="" disabled=no in-interface=Local new-connection-mark=even passthrough=yes src-address-list=even
add action=mark-routing chain=prerouting comment="" disabled=no in-interface=Local new-routing-mark=even passthrough=yes src-address-list=even
add action=mark-connection chain=prerouting comment="" connection-state=new disabled=no in-interface=Local new-connection-mark=odd nth=2,1 passthrough=yes
add action=add-src-to-address-list address-list=odd address-list-timeout=1d chain=prerouting comment="" connection-mark=odd disabled=no in-interface=Local
add action=mark-routing chain=prerouting comment="" connection-mark=odd disabled=no in-interface=Local new-routing-mark=odd passthrough=no
add action=mark-connection chain=prerouting comment="" connection-state=new disabled=no in-interface=Local new-connection-mark=even nth=2,2 passthrough=yes
add action=add-src-to-address-list address-list=even address-list-timeout=1d chain=prerouting comment="" connection-mark=even disabled=no in-interface=Local
add action=mark-routing chain=prerouting comment="" connection-mark=even disabled=no in-interface=Local new-routing-mark=even passthrough=no
add action=mark-connection chain=prerouting comment="" connection-state=new disabled=no in-interface=Local new-connection-mark=even nth=2,2 passthrough=yes src-address-list=!odd

/ip dns
set allow-remote-requests=no cache-max-ttl=1w cache-size=2048KiB max-udp-packet-size=512 primary-dns=163.121.128.134 secondary-dns=163.121.128.135

so what is wrong ?
any help pls .
*sorry for my bad english*
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8712
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Load Balance doesn't work .

Fri Apr 17, 2009 6:12 pm

ECMP binds 'src-address+dst-address' to gateway. 'Nth' scenario binds a user to gateway, so one user cannot use both uplins during one session. nothing wrong - it's by design. but if you have many users - you will have balance
 
MrIC
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 66
Joined: Tue Jan 13, 2009 11:34 pm

Re: Load Balance doesn't work .

Sat Apr 18, 2009 12:59 am

ECMP binds 'src-address+dst-address' to gateway. 'Nth' scenario binds a user to gateway, so one user cannot use both uplins during one session. nothing wrong - it's by design. but if you have many users - you will have balance

so NTH same as Load Balancing over Multiple Gateways right ?
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8712
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Load Balance doesn't work .

Sat Apr 18, 2009 11:42 am

yes. with the only difference - Nth works with active users, http://wiki.mikrotik.com/wiki/Load_Bala ... e_Gateways works with static groups of users
 
MrIC
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 66
Joined: Tue Jan 13, 2009 11:34 pm

Re: Load Balance doesn't work .

Sat Apr 18, 2009 2:23 pm

yes. with the only difference - Nth works with active users, http://wiki.mikrotik.com/wiki/Load_Bala ... e_Gateways works with static groups of users
another thing pls .
what is the best way of them that i can active hotspot and proxy with it ?
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8712
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Load Balance doesn't work .

Sat Apr 18, 2009 2:29 pm

use Nth, it's more... 'dynamic' :)
ECMP is useless for now due to the kernel feature... =)
 
ojeysky
Frequent Visitor
Frequent Visitor
Posts: 68
Joined: Tue Mar 10, 2009 2:04 pm

Re: Load Balance doesn't work .

Thu Aug 26, 2010 12:39 am

Hi Chupaka and All,
As you recommended that NTH is better with Hotspot....I just setup NTH load balancing using this link
http://wiki.mikrotik.com/wiki/NTH_load_ ... pproach%29

But after the whole setup, i only have one of the link active, i don't think the load balancing is working at all. Please is there something i am doing wrong?
My Network Senerio:

I have 3 wan links (2 with public ip and 1 with private ip) currently moderm of one of the 3 wan link is down so that left me with 2 wan links
I have 1 other ethernet card for the LAN and on it i have 8 VLANS running hotspot.
Please help as currently i am not utilizing my bandwidth....ISPs will soon start knocking for the subscription fee... :)

Regards
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8712
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Load Balance doesn't work .

Mon Aug 30, 2010 3:00 pm

as HotSpot uses transparent proxy by default, you should also add Nth rules to your 'output' chain, not only 'prerouting'
 
rgodoy
just joined
Posts: 14
Joined: Thu Sep 16, 2010 8:31 pm

Re: Load Balance doesn't work .

Thu Sep 23, 2010 4:07 pm

Hello guys. By the way... what should be the order of the chains? In this article: http://wiki.mikrotik.com/wiki/Manual:PCC, Mangle table has its chains in this order:
1. Input.
2. Output.
3. Prerouting.

I was watching some flow charts and the order is different (e.g. http://ornellas.apanela.com/dokuwiki/pu ... dv_routing ; Dataflow diagram).

How can this affect the correct working of the rules?
 
fewi
Forum Guru
Forum Guru
Posts: 7717
Joined: Tue Aug 11, 2009 3:19 am

Re: Load Balance doesn't work .

Thu Sep 23, 2010 4:27 pm

Chains are processed as per the packet flow diagram on the wiki. Only the order of rules within a chain matter. Prerouting is always processed before anything else, for example, but all prerouting rules are processed in the order your ruleset lists them in.