Community discussions

MikroTik App
 
User avatar
Akangage
newbie
Topic Author
Posts: 45
Joined: Tue May 29, 2007 2:33 pm
Location: Indonesia
Contact:

LoadBalancing on MikroTik V3

Mon Feb 18, 2008 8:23 am

Is there any manual or tutorial for MikroTik V3 LoadBalancing

thanks for the info!!!
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: LoadBalancing on MikroTik V3

Tue Feb 19, 2008 4:14 am

you may use load balancing for 2.9 - there's no difference in principle
 
User avatar
ashish
Long time Member
Long time Member
Posts: 546
Joined: Mon Feb 12, 2007 5:50 am
Location: Virginia, USA.

Re: LoadBalancing on MikroTik V3

Tue Feb 19, 2008 5:14 am

But which is the best method of loadbalancing from the example of wiki.

I have two Lines.
VSAT : 512 Kbps
Leased Line : 1 Mbps:

Now i dont want round robin, I want to Balance 1:2, How to do that, Coz i have tried with the wiki example, The VSAT is getting full but NOT able to use the bandwidth from Leased line.

Again In LAN we are facing slow speed issue...
 
elderado
newbie
Posts: 27
Joined: Sun Feb 17, 2008 10:02 pm

Re: LoadBalancing on MikroTik V3

Tue Feb 19, 2008 8:16 pm

But which is the best method of loadbalancing from the example of wiki.

Now i dont want round robin, I want to Balance 1:2
yup.. i have the same questions with ashish.

it would be nice if mikrotik release an official tutorial with an example about load balancing :D
 
User avatar
Akangage
newbie
Topic Author
Posts: 45
Joined: Tue May 29, 2007 2:33 pm
Location: Indonesia
Contact:

Re: LoadBalancing on MikroTik V3

Thu Feb 21, 2008 6:38 am

Well, I've already try but it wont works.... Like thiz one http://wiki.mikrotik.com/wiki/Load_Balancing it won't works on MikroTik V3, Is there any additional information that miss for Version 3
 
kthameen
Frequent Visitor
Frequent Visitor
Posts: 87
Joined: Wed Dec 21, 2005 4:22 am
Location: Leuven,Belgium

Re: LoadBalancing on MikroTik V3

Thu Feb 21, 2008 6:48 am

You can try what I am working on right now.

network 214.0.0.0/24 I split in 2 LAN1 214.0.0.0-127 and LAN2 214.0.0.255 config is as follows:

/ip firewall mangle

add action=mark-routing chain=prerouting comment="" disabled=no dst-address=0.0.0.0/0 new-routing-mark=LAN1 \
passthrough=yes src-address=214.0.0.0/25
add action=mark-routing chain=prerouting comment="" disabled=no dst-address=0.0.0.0/0 new-routing-mark=LAN2 \
passthrough=yes src-address=214.0.0.128/25

/ip route

add comment="Clearwire" disabled=no distance=1 dst-address=0.0.0.0/0 gateway=88.147.15.2 routing-mark=LAN2 scope=30 target-scope=10

add comment="Telenet" disabled=no distance=1 dst-address=0.0.0.0/0 gateway=213.0.0.1 routing-mark=LAN1 scope=30 target-scope=10

if you want to see the differnece between the nth parameter try a voice or video conversation u'll find it there espcially at peak time

Regards,
 
User avatar
Akangage
newbie
Topic Author
Posts: 45
Joined: Tue May 29, 2007 2:33 pm
Location: Indonesia
Contact:

Re: LoadBalancing on MikroTik V3

Thu Feb 21, 2008 7:28 am

You can try what I am working on right now.

network 214.0.0.0/24 I split in 2 LAN1 214.0.0.0-127 and LAN2 214.0.0.255 config is as follows:

/ip firewall mangle

add action=mark-routing chain=prerouting comment="" disabled=no dst-address=0.0.0.0/0 new-routing-mark=LAN1 \
passthrough=yes src-address=214.0.0.0/25
add action=mark-routing chain=prerouting comment="" disabled=no dst-address=0.0.0.0/0 new-routing-mark=LAN2 \
passthrough=yes src-address=214.0.0.128/25

/ip route

add comment="Clearwire" disabled=no distance=1 dst-address=0.0.0.0/0 gateway=88.147.15.2 routing-mark=LAN2 scope=30 target-scope=10

add comment="Telenet" disabled=no distance=1 dst-address=0.0.0.0/0 gateway=213.0.0.1 routing-mark=LAN1 scope=30 target-scope=10

if you want to see the differnece between the nth parameter try a voice or video conversation u'll find it there espcially at peak time

Regards,
Well, thank you very much for the config but that's not what i needed, i want the configuration like the one from wiki. mikrotik because i ussually doin some large download, the bandwidth become one while the download process like the wiki state.
 
kthameen
Frequent Visitor
Frequent Visitor
Posts: 87
Joined: Wed Dec 21, 2005 4:22 am
Location: Leuven,Belgium

Re: LoadBalancing on MikroTik V3

Thu Feb 21, 2008 7:36 am

its meant for ppl who want to split bandwidth not combine like your case
 
User avatar
Akangage
newbie
Topic Author
Posts: 45
Joined: Tue May 29, 2007 2:33 pm
Location: Indonesia
Contact:

Re: LoadBalancing on MikroTik V3

Thu Feb 21, 2008 8:09 am

its meant for ppl who want to split bandwidth not combine like your case
Yup!!! Is there anyone can help me, the refer or something else???
 
User avatar
Akangage
newbie
Topic Author
Posts: 45
Joined: Tue May 29, 2007 2:33 pm
Location: Indonesia
Contact:

Re: LoadBalancing on MikroTik V3

Sat Feb 23, 2008 5:27 am

I'm found it!!! and it's really works 100% run..........
 
alex_rhys-hurn
Member
Member
Posts: 352
Joined: Mon Jun 05, 2006 8:26 pm
Location: Kenya
Contact:

Re: LoadBalancing on MikroTik V3

Sat Feb 23, 2008 1:57 pm

Hi guys,

I have been in your position before and have worked through to learn all the lessons the hard way.

You have these options for load balancing:

ECMP
Round Robin
Policy Based Routing

Part of the problem for you and for me is that your internet supplies are not matched. 1 is a high latency vsat of only half the bandwidth of the other lower latency bandwidth.

Eventually you will come to realise that Policy Based Routing is the most suitable solution for you.

This url spells it all out http://wiki.mikrotik.com/wiki/Per-Traff ... _Balancing

Enjoy!

Alex
 
User avatar
Akangage
newbie
Topic Author
Posts: 45
Joined: Tue May 29, 2007 2:33 pm
Location: Indonesia
Contact:

Re: LoadBalancing on MikroTik V3

Sun Feb 24, 2008 3:10 am

Yeah.. it's true what you say!! But for some reason I don't like policy based routing, when one of the connection is down we should manually change it or maybe you put another script to make it run automatic.
Different with full bandwidth, when one connection is down, the another one will backup the connection till the the one has been Up. off course that each configuration has weaknesses.
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: LoadBalancing on MikroTik V3

Sun Feb 24, 2008 4:15 am

Yeah.. it's true what you say!! But for some reason I don't like policy based routing, when one of the connection is down we should manually change it or maybe you put another script to make it run automatic.
Different with full bandwidth, when one connection is down, the another one will backup the connection till the the one has been Up. off course that each configuration has weaknesses.
instead of
add dst-address=0.0.0.0/0 gateway=10.0.1.1 scope=255 target-scope=10 routing-mark="WAN - 01" comment="" disabled=no
add dst-address=0.0.0.0/0 gateway=10.0.2.1 scope=255 target-scope=10 routing-mark="WAN - 02" comment="" disabled=no
use something like
add dst-address=0.0.0.0/0 gateway=10.0.1.1 scope=255 target-scope=10 routing-mark="WAN - 01" comment="" disabled=no
add dst-address=0.0.0.0/0 gateway=10.0.2.1 scope=255 target-scope=10 routing-mark="WAN - 01" comment="" disabled=no distance=100
add dst-address=0.0.0.0/0 gateway=10.0.2.1 scope=255 target-scope=10 routing-mark="WAN - 02" comment="" disabled=no
add dst-address=0.0.0.0/0 gateway=10.0.1.1 scope=255 target-scope=10 routing-mark="WAN - 02" comment="" disabled=no distance=100
and you may use 'check-gateway' option
 
KennyB
newbie
Posts: 46
Joined: Sun Nov 07, 2004 4:57 am
Location: North East Louisiana
Contact:

Re: LoadBalancing on MikroTik V3

Sun Feb 24, 2008 8:20 pm

Akangage
Did you say you got the load balancing working where it will combine bandwidth during download? If so what would you mind posting your config?
thanks
Kenny
 
User avatar
Akangage
newbie
Topic Author
Posts: 45
Joined: Tue May 29, 2007 2:33 pm
Location: Indonesia
Contact:

Re: LoadBalancing on MikroTik V3

Mon Feb 25, 2008 5:58 pm

Config for which one? Firewall, NAT, Mangle or routing? Like the chupaka said that the basic it's not so far but the problem lays on NAT & NTH in Mangle....
If you use hotspot it preferable to use masquerade instead of src-nat and the NTH follow the sum of connection you used!

I used the NTH 2,1 and 2,2 for my connection but i don't know why there still some delay between 2 connection!! Hmmm how can i say.... I'm still don't really understand the NTH especially for the best configuration for each connection!
 
WirelessRudy
Forum Guru
Forum Guru
Posts: 3119
Joined: Tue Aug 08, 2006 5:54 pm
Location: Spain

Re: LoadBalancing on MikroTik V3

Tue Feb 26, 2008 3:32 am

Using the NTH parameters (remind this is changed a little in 3.x version) divides only the connections over the two (or more) WAN links. I can happen easily that one WAN gets more data traffic then the other just because one connection group sees more heavy users then the other.
the bigger the LAN network and amount of users, the more even the bandwidth will be spread.

If you have un-equal capacity WAN links then work the nth a bit up. Like 1x4mb WAN ¨A¨and 1x2Mb WAN ¨B¨. you can make every first connection to go to ¨A¨, every second to ¨B¨ and every third to ¨A¨ again.

Load balancing where packages are evenly distributed over two lines will see problems in case of https traffic and possibly others where the user-PC likes to see the packages coming from the same WAN network as the others in the same connection...

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

Re: LoadBalancing on MikroTik V3

Tue Feb 26, 2008 4:45 pm

Well, instead of using 'Nth', I prefer using 'Random': at first, there's no difference if you have a lot of users (if you have a little - just forget about load balancing =) ), and second - you may smoothly change bandwidth ratio over each connection
 
User avatar
Akangage
newbie
Topic Author
Posts: 45
Joined: Tue May 29, 2007 2:33 pm
Location: Indonesia
Contact:

Re: LoadBalancing on MikroTik V3

Thu Feb 28, 2008 6:41 am

use something like
add dst-address=0.0.0.0/0 gateway=10.0.1.1 scope=255 target-scope=10 routing-mark="WAN - 01" comment="" disabled=no
add dst-address=0.0.0.0/0 gateway=10.0.2.1 scope=255 target-scope=10 routing-mark="WAN - 01" comment="" disabled=no distance=100
add dst-address=0.0.0.0/0 gateway=10.0.2.1 scope=255 target-scope=10 routing-mark="WAN - 02" comment="" disabled=no
add dst-address=0.0.0.0/0 gateway=10.0.1.1 scope=255 target-scope=10 routing-mark="WAN - 02" comment="" disabled=no distance=100
What's the effect for the network?
 
WirelessRudy
Forum Guru
Forum Guru
Posts: 3119
Joined: Tue Aug 08, 2006 5:54 pm
Location: Spain

Re: LoadBalancing on MikroTik V3

Thu Feb 28, 2008 12:00 pm

Well, depends on your mangle rules.

And it only works if your gateways are the ADSL modems. (If not, you have a backhaul in between, and the backhaul is up but the modem or WAN is down? Then the gateway stays in force but it is a dead end gateway.)

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

Re: LoadBalancing on MikroTik V3

Fri Feb 29, 2008 1:30 am

Well, depends on your mangle rules.

And it only works if your gateways are the ADSL modems. (If not, you have a backhaul in between, and the backhaul is up but the modem or WAN is down? Then the gateway stays in force but it is a dead end gateway.)

rudy
well, netwatch will help :)
 
esn.toolz
newbie
Posts: 42
Joined: Mon May 28, 2007 6:52 am

Re: LoadBalancing on MikroTik V3

Tue Mar 04, 2008 9:46 am

Hi guys, I need to bypass some traffic... like rapidshare traffic and put it on one specific gateway... Can anybody help me?
 
scy728
just joined
Posts: 7
Joined: Tue Nov 14, 2006 11:24 pm

Re: LoadBalancing on MikroTik V3

Wed Dec 31, 2008 1:35 am

Well, instead of using 'Nth', I prefer using 'Random': at first, there's no difference if you have a lot of users (if you have a little - just forget about load balancing =) ), and second - you may smoothly change bandwidth ratio over each connection
BUT there's no imformation about loadbalancing using "Random" ,would you tell me the detail. I ilhave tried it so long.but it
still have problem. i have 5 ADSL to loadblaning. looking for your help. thank you so much


69 X ;;; random
chain=prerouting action=jump jump-target=1 src-address=192.168.0.0/24 random=20

70 X chain=prerouting action=jump jump-target=2 src-address=192.168.0.0/24 random=20

71 X chain=prerouting action=jump jump-target=3 src-address=192.168.0.0/24 random=20

72 X chain=prerouting action=jump jump-target=4 src-address=192.168.0.0/24 random=20

73 X chain=prerouting action=jump jump-target=5 src-address=192.168.0.0/24 random=20

74 X chain=1 action=mark-connection new-connection-mark=random-1 passthrough=yes src-address=192.168.0.0/24

75 X chain=prerouting action=mark-routing new-routing-mark=1 passthrough=no src-address=192.168.0.0/24 connection-mark=random-1

76 X chain=2 action=mark-connection new-connection-mark=random-2 passthrough=yes src-address=192.168.0.0/24

77 X chain=prerouting action=mark-routing new-routing-mark=2 passthrough=no src-address=192.168.0.0/24 connection-mark=random-2

78 X chain=3 action=mark-connection new-connection-mark=random-3 passthrough=yes src-address=192.168.0.0/24

79 X chain=prerouting action=mark-routing new-routing-mark=3 passthrough=no src-address=192.168.0.0/24 connection-mark=random-3

80 X chain=4 action=mark-connection new-connection-mark=random-4 passthrough=yes src-address=192.168.0.0/24

81 X chain=prerouting action=mark-routing new-routing-mark=4 passthrough=no src-address=192.168.0.0/24 connection-mark=random-4

82 X chain=5 action=mark-connection new-connection-mark=random-5 passthrough=yes src-address=192.168.0.0/24

83 X chain=prerouting action=mark-routing new-routing-mark=5 passthrough=no src-address=192.168.0.0/24 connection-mark=random-5
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: LoadBalancing on MikroTik V3

Wed Dec 31, 2008 1:57 am

for 5 lines, 'random=' values (to spread all equally) should be: 20, 25, 33, 50, and in the last rule there should not be 'random' - it will match all residual packets. also all rules, that distribute your packets via uplink lines, should have passthrough=no, and connection-type=new, and above you should add rules, that will forward already marked connections to corresponding lines
 
scy728
just joined
Posts: 7
Joined: Tue Nov 14, 2006 11:24 pm

Re: LoadBalancing on MikroTik V3

Wed Dec 31, 2008 11:12 pm

for 5 lines, 'random=' values (to spread all equally) should be: 20, 25, 33, 50, and in the last rule there should not be 'random' - it will match all residual packets. also all rules, that distribute your packets via uplink lines, should have passthrough=no, and connection-type=new, and above you should add rules, that will forward already marked connections to corresponding lines
thank you for your help, Now I know how to make the "random" values . but i'm a rookie in MT. would you mind show me the all the rules or correct my rules above in (/ip firewall mangle) using random to loadbalancing 5 ADSL ?I still don't know which rule should have passthrough=no or add connecton= new also I want to know what rules should be add. I tried for many times but it still not to work. :( i also want to know is it necessary to mark "dst-port 443" in order to login in Network Bank.

thank you so much
 
cartes
newbie
Posts: 41
Joined: Fri Oct 12, 2007 12:23 am

Re: LoadBalancing on MikroTik V3

Thu Jan 01, 2009 10:17 pm

Thx Chupaka, that was a great hint on how Random works! We use Nth extensively for src-nat'ting. We have 4000+ users, who are distributed to 252 different groups using Nth. Each group is the src-nat'ted through different Real IPs. The problem we face is, the 252 groups are not evenly loaded, meaning the number of IPs in each group keep decreasing as Nth values keep ascending, say first 10% groups have 10 - 12 each, where the last 10% has 1 - 2 each.

An excerpt from my config is (for the 12th group):

add action=mark-connection chain=prerouting comment="" disabled=no \
new-connection-mark=cn012 passthrough=yes src-address-list=cn012
add action=mark-routing chain=prerouting comment="" disabled=no \
new-routing-mark=cn012 passthrough=no src-address-list=cn012
add action=mark-connection chain=prerouting comment="" connection-state=new \
disabled=no new-connection-mark=cn012 nth=252,12 passthrough=yes \
src-address=192.168.0.0/18
add action=add-src-to-address-list address-list=cn012 address-list-timeout=8h \
chain=prerouting comment="" connection-mark=cn012 disabled=no \
src-address=192.168.0.0/18
add action=mark-routing chain=prerouting comment="" connection-mark=cn012 \
disabled=no new-routing-mark=cn012 passthrough=no \
src-address=192.168.0.0/18
add action=mark-connection chain=prerouting comment="" connection-state=new \
disabled=no new-connection-mark=cn012 nth=252,12 passthrough=yes \
src-address=10.0.0.0/14
add action=add-src-to-address-list address-list=cn012 address-list-timeout=8h \
chain=prerouting comment="" connection-mark=cn012 disabled=no \
src-address=10.0.0.0/14
add action=mark-routing chain=prerouting comment="" connection-mark=cn012 \
disabled=no new-routing-mark=cn012 passthrough=no src-address=10.0.0.0/14

My guess is that the part of the problem could be we use two different IP address blocks in the private IP range (one /18 and one /14), which is throwing off the Nth counter. But, this assumes that there is only One Nth counter for the whole router.

Can someone shed some light on this? Is it even advisable to use such a large number of Nth rules?

Who is online

Users browsing this forum: CHUPAPEE, faxxe, holla29 and 194 guests