Community discussions

MikroTik App
 
BinGoViVi
just joined
Topic Author
Posts: 4
Joined: Thu Jun 01, 2006 2:39 pm
Location: Russia

Load Balancing Persistent,,,,plz help me,,thx

Thu Apr 10, 2008 7:34 am

I use pppoe-server to do local service

my routeOS setting like this,,,my clients can't use internet ,do i have some things wrong ,please help me,,,thanks,,,

sorry i wrote some things wrong ,,i have changed it ,,thx all ,,please help me again ^-^

I have 3 isp want to make load balancing .....

my gateways is

GW-wan1=172.30.40.50
GW-wan2=172.30.30.30
GW-wan3=172.30.60.30

my wan address

wan1=172.30.40.51
wan2=172.30.30.31
wan3=172.30.60.31

my local 172.17.0.0/16
my lan ip 172.17.77.2

before i use this rule,,,for my client,,,
/ip firewall nat
add Chain=srcnat Src-Address 192.168.0.0/16 Action=masquerade

/ip firewall mangle
add chain=prerouting src-address=192.168.0.1/16 Action=mark routing New-Routing-Mark=1
add chain=prerouting src-address=192.168.0.2/16 Action=mark routing New-Routing-Mark=2
add chain=prerouting src-address=192.168.0.3/16 Action=mark routing New-Routing-Mark=3

Now i want to use nth to load balancing ...
from here i learn to set
Nth
From MikroTik Wiki
Jump to: navigation, search
example: nth=Every,Counter,Packet nth=2,3,0. 2,3,1 2,3,2
divide all packets into groups of three (2+1). The packets will be numbered from 0 to 2. So, a sequence of packets the rule matches looks like: (0 1 2)(0 1 2)(0 1 2)(0 1 2)(0 1 2)...
the first rule will match the first packet in each group ("Packet"=0). The second rule will match the second packet in each group ("Packet"=1) and so on. Each successful match increments the counter. When a value of "Every" is reached, the counter is reset to 0. For this to work, the "Counter" should be the same for all rules (you can pick any value from 0 to 15, IIRC).
so i set my Nth=2,3,0..1..2

i still have questions,,,how to set the counter ? it need set like every+1 ?

Egycom said
i didnt read all your configuration, however you should change NTH to ( nth=2,1,0 , nth=2,1,1 , nth=2,1,2)

My configure is:
/ ip address
add address=172.17.77.2/24 network=172.17.77.0 broadcast=172.17.77.255 interface=Lan
add address=172.30.40.51/24 network=172.30.40.0 broadcast=172.30.40.255 interface=Wan1
add address=172.30.30.31/24 network=172.30.30.0 broadcast=172.30.30.255 interface=Wan2
add address=172.30.60.31/24 network=172.30.60.0 broadcast=172.30.60.255 interface=Wan3



/ ip firewall mangle
add chain=prerouting src-address-list=1 in-interface=Lan action=mark-connection new-connection-mark=1 passthrough=yes
add chain=prerouting src-address-list=1 in-interface=Lan action=mark-routing new-routing-mark=1


add chain=prerouting src-address-list=2 in-interface=Lan action=mark-connection new-connection-mark=2 passthrough=yes
add chain=prerouting src-address-list=2 in-interface=Lan action=mark-routing new-routing-mark=2

add chain=prerouting src-address-list=3 in-interface=Lan action=mark-connection new-connection-mark=3 passthrough=yes
add chain=prerouting src-address-list=3 in-interface=Lan action=mark-routing new-routing-mark=3




add chain=prerouting in-interface=Lan connection-state=new nth=2,3,0 action=mark-connection new-connection-mark=1 passthrough=yes
add chain=prerouting in-interface=Lan action=add-src-to-address-list address-list=1 address-list-timeout=1d connection-mark=1 passthrough=yes
add chain=prerouting in-interface=Lan connection-mark=1 action=mark-routing new-routing-mark=1 passthrough=no

add chain=prerouting in-interface=Lan connection-state=new nth=2,3,1 action=mark-connection new-connection-mark=2 passthrough=yes
add chain=prerouting in-interface=Lan action=add-src-to-address-list address-list=2 address-list-timeout=1d connection-mark=2 passthrough=yes
add chain=prerouting in-interface=Lan connection-mark=2 action=mark-routing new-routing-mark=2 passthrough=no

add chain=prerouting in-interface=Lan connection-state=new nth=2,3,2 action=mark-connection new-connection-mark=3 passthrough=yes
add chain=prerouting in-interface=Lan action=add-src-to-address-list address-list=3 address-list-timeout=1d connection-mark=3 passthrough=yes
add chain=prerouting in-interface=Lan connection-mark=3 action=mark-routing new-routing-mark=3 passthrough=no


/ ip firewall nat
add chain=srcnat connection-mark=1 action=src-nat to-addresses=172.30.40.51 to-ports=0-65535

add chain=srcnat connection-mark=2 action=src-nat to-addresses=172.30.30.31 to-ports=0-65535

add chain=srcnat connection-mark=3 action=src-nat to-addresses=172.30.60.31 to-ports=0-65535


/ ip route
add dst-address=0.0.0.0/0 gateway=172.30.40.50 scope=255 target-scope=10 routing-mark=1
add dst-address=0.0.0.0/0 gateway=172.30.30.30 scope=255 target-scope=10 routing-mark=2
add dst-address=0.0.0.0/0 gateway=172.30.60.30 scope=255 target-scope=10 routing-mark=3
add dst-address=0.0.0.0/0 gateway=172.30.40.50 scope=255 target-scope=10
Last edited by BinGoViVi on Thu Apr 10, 2008 6:12 pm, edited 3 times in total.
 
ramankutty
just joined
Posts: 3
Joined: Wed Apr 09, 2008 3:33 pm

Re: Load Balancing Persistent,,,,plz help me,,thx

Thu Apr 10, 2008 9:36 am

can you please make clear on your requirement like what is your gateway which are the network you wants to use to load balance, etc,m
I use pppoe-server to do local service

my routeOS setting like this,,,my clients can't use internet ,do i have some things wrong ,please help me,,,thanks,,,

/ ip address
add address=172.17.77.2/24 network=172.17.77.0 broadcast=172.17.77.255 interface=Lan
add address=172.30.40.51/24 network=172.30.40.0 broadcast=172.30.40.255 interface=Wan1
add address=172.30.30.31/24 network=172.30.30.0 broadcast=172.30.30.255 interface=Wan2
add address=172.30.60.31/24 network=172.30.60.0 broadcast=172.30.60.255 interface=Wan3



/ ip firewall mangle
add chain=prerouting src-address-list=1 in-interface=Lan action=mark-connection new-connection-mark=1 passthrough=yes
add chain=prerouting src-address-list=1 in-interface=Lan action=mark-routing new-routing-mark=1


add chain=prerouting src-address-list=2 in-interface=Lan action=mark-connection new-connection-mark=2 passthrough=yes
add chain=prerouting src-address-list=2 in-interface=Lan action=mark-routing new-routing-mark=2

add chain=prerouting src-address-list=3 in-interface=Lan action=mark-connection new-connection-mark=3 passthrough=yes
add chain=prerouting src-address-list=3 in-interface=Lan action=mark-routing new-routing-mark=3




add chain=prerouting in-interface=Lan connection-state=new nth=2,3,0 action=mark-connection new-connection-mark=1 passthrough=yes
add chain=prerouting in-interface=Lan action=add-src-to-address-list address-list=1 address-list-timeout=1d connection-mark=1 passthrough=yes
add chain=prerouting in-interface=Lan connection-mark=1 action=mark-routing new-routing-mark=1 passthrough=no

add chain=prerouting in-interface=Lan connection-state=new nth=2,3,1 action=mark-connection new-connection-mark=2 passthrough=yes
add chain=prerouting in-interface=Lan action=add-src-to-address-list address-list=2 address-list-timeout=1d connection-mark=2 passthrough=yes
add chain=prerouting in-interface=Lan connection-mark=2 action=mark-routing new-routing-mark=2 passthrough=no

add chain=prerouting in-interface=Lan connection-state=new nth=2,3,2 action=mark-connection new-connection-mark=3 passthrough=yes
add chain=prerouting in-interface=Lan action=add-src-to-address-list address-list=3 address-list-timeout=1d connection-mark=3 passthrough=yes
add chain=prerouting in-interface=Lan connection-mark=3 action=mark-routing new-routing-mark=3 passthrough=no


/ ip firewall nat
add chain=srcnat connection-mark=1 action=src-nat to-addresses=172.30.40.55 to-ports=0-65535

add chain=srcnat connection-mark=2 action=src-nat to-addresses=172.30.30.31 to-ports=0-65535

add chain=srcnat connection-mark=3 action=src-nat to-addresses=172.30.60.36 to-ports=0-65535


/ ip route
add dst-address=0.0.0.0/0 gateway=172.30.40.51 scope=255 target-scope=10 routing-mark=1
add dst-address=0.0.0.0/0 gateway=172.30.30.30 scope=255 target-scope=10 routing-mark=2
add dst-address=0.0.0.0/0 gateway=172.30.60.31 scope=255 target-scope=10 routing-mark=3
add dst-address=0.0.0.0/0 gateway=172.30.40.51 scope=255 target-scope=10
 
EgyCom
Member Candidate
Member Candidate
Posts: 123
Joined: Thu May 31, 2007 9:47 pm

Re: Load Balancing Persistent,,,,plz help me,,thx

Thu Apr 10, 2008 1:49 pm

BinGoViVi

i didnt read all your configuration, however you should change NTH to ( nth=2,1,0 , nth=2,1,1 , nth=2,1,2)
and also you used IPs in NAT roles you didn't put them on any interface !!!!!
also in IP Route you used you router IPs as gateways !!!!!
 
BinGoViVi
just joined
Topic Author
Posts: 4
Joined: Thu Jun 01, 2006 2:39 pm
Location: Russia

Re: Load Balancing Persistent,,,,plz help me,,thx

Thu Apr 10, 2008 5:42 pm

BinGoViVi

i didnt read all your configuration, however you should change NTH to ( nth=2,1,0 , nth=2,1,1 , nth=2,1,2)
and also you used IPs in NAT roles you didn't put them on any interface !!!!!
also in IP Route you used you router IPs as gateways !!!!!

thx a lot ,,,i correct my setting,,,now can every one help me again,,can you explain

nth again?thx