Community discussions

MikroTik App
 
TheLordOfTheShells
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 71
Joined: Tue Oct 03, 2017 2:48 am

Best method to load balance 8 Wan for a domitory

Fri Oct 27, 2017 3:42 pm

Hi guys. I have searched google for my issue but it seem hard to find out I'm using 8 wan 60Mbps with PCC load balancing for a dormitory.
After settup loadblacing I used speedtest to test my speed and it worked well, but the problem happened with gaming, the ping is so high and sometime the connection is lost. So i wonder what is the best load blancing approach for my situtuation.I would appreciate if someone had any opinion about it.
Here is my scrip:
/ip firewall mangle
add action=accept chain=prerouting in-interface=WAN1
add action=accept chain=prerouting in-interface=WAN2
add action=accept chain=prerouting in-interface=WAN3
add action=accept chain=prerouting in-interface=WAN4
add action=accept chain=prerouting in-interface=WAN5
add action=accept chain=prerouting in-interface=WAN6
add action=accept chain=prerouting in-interface=WAN7
add action=accept chain=prerouting in-interface=WAN8
add action=mark-connection chain=prerouting in-interface=WAN1 \
new-connection-mark=WAN1_conn passthrough=yes
add action=mark-connection chain=prerouting in-interface=WAN2 \
new-connection-mark=WAN2_conn passthrough=yes
add action=mark-connection chain=prerouting in-interface=WAN3 \
new-connection-mark=WAN3_conn passthrough=yes
add action=mark-connection chain=prerouting in-interface=WAN4 \
new-connection-mark=WAN4_conn passthrough=yes
add action=mark-connection chain=prerouting in-interface=WAN5 \
new-connection-mark=WAN5_conn passthrough=yes
add action=mark-connection chain=prerouting in-interface=WAN6 \
new-connection-mark=WAN6_conn passthrough=yes
add action=mark-connection chain=prerouting in-interface=WAN7 \
new-connection-mark=WAN7_conn passthrough=yes
add action=mark-connection chain=prerouting in-interface=WAN8 \
new-connection-mark=WAN8_conn passthrough=yes
add action=mark-connection chain=prerouting dst-address-type=!local \
in-interface=LAN_Address new-connection-mark=WAN1_conn passthrough=yes \
per-connection-classifier=both-addresses-and-ports:8/0
add action=mark-connection chain=prerouting dst-address-type=!local \
in-interface=LAN_Address new-connection-mark=WAN2_conn passthrough=yes \
per-connection-classifier=both-addresses-and-ports:8/1
add action=mark-connection chain=prerouting dst-address-type=!local \
in-interface=LAN_Address new-connection-mark=WAN3_conn passthrough=yes \
per-connection-classifier=both-addresses-and-ports:8/2
add action=mark-connection chain=prerouting dst-address-type=!local \
in-interface=LAN_Address new-connection-mark=WAN4_conn passthrough=yes \
per-connection-classifier=both-addresses-and-ports:8/3
add action=mark-connection chain=prerouting dst-address-type=!local \
in-interface=LAN_Address new-connection-mark=WAN5_conn passthrough=yes \
per-connection-classifier=both-addresses-and-ports:8/4
add action=mark-connection chain=prerouting dst-address-type=!local \
in-interface=LAN_Address new-connection-mark=WAN6_conn passthrough=yes \
per-connection-classifier=both-addresses-and-ports:8/5
add action=mark-connection chain=prerouting dst-address-type=!local \
in-interface=LAN_Address new-connection-mark=WAN7_conn passthrough=yes \
per-connection-classifier=both-addresses-and-ports:8/6
add action=mark-connection chain=prerouting dst-address-type=!local \
in-interface=LAN_Address new-connection-mark=WAN8_conn passthrough=yes \
per-connection-classifier=both-addresses-and-ports:8/7
add action=mark-routing chain=prerouting connection-mark=WAN1_conn \
in-interface=LAN_Address new-routing-mark=to_WAN1 passthrough=yes
add action=mark-routing chain=prerouting connection-mark=WAN2_conn \
in-interface=LAN_Address new-routing-mark=to_WAN2 passthrough=yes
add action=mark-routing chain=prerouting connection-mark=WAN3_conn \
in-interface=LAN_Address new-routing-mark=to_WAN3 passthrough=yes
add action=mark-routing chain=prerouting connection-mark=WAN4_conn \
in-interface=LAN_Address new-routing-mark=to_WAN4 passthrough=yes
add action=mark-routing chain=prerouting connection-mark=WAN5_conn \
in-interface=LAN_Address new-routing-mark=to_WAN5 passthrough=yes
add action=mark-routing chain=prerouting connection-mark=WAN6_conn \
in-interface=LAN_Address new-routing-mark=to_WAN6 passthrough=yes
add action=mark-routing chain=prerouting connection-mark=WAN7_conn \
in-interface=LAN_Address new-routing-mark=to_WAN7 passthrough=yes
add action=mark-routing chain=prerouting connection-mark=WAN8_conn \
in-interface=LAN_Address new-routing-mark=to_WAN8 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=mark-routing chain=output connection-mark=WAN3_conn \
new-routing-mark=to_WAN3 passthrough=yes
add action=mark-routing chain=output connection-mark=WAN4_conn \
new-routing-mark=to_WAN4 passthrough=yes
add action=mark-routing chain=output connection-mark=WAN5_conn \
new-routing-mark=to_WAN5 passthrough=yes
add action=mark-routing chain=output connection-mark=WAN6_conn \
new-routing-mark=to_WAN6 passthrough=yes
add action=mark-routing chain=output connection-mark=WAN7_conn \
new-routing-mark=to_WAN7 passthrough=yes
add action=mark-routing chain=output connection-mark=WAN8_conn \
new-routing-mark=to_WAN8 passthrough=yes
/ip route
add check-gateway=ping distance=1 gateway=pppoe-out1 routing-mark=to_WAN1
add check-gateway=ping distance=1 gateway=pppoe-out2 routing-mark=to_WAN2
add check-gateway=ping distance=1 gateway=pppoe-out3 routing-mark=to_WAN3
add check-gateway=ping distance=1 gateway=pppoe-out4 routing-mark=to_WAN4
add check-gateway=ping distance=1 gateway=pppoe-out5 routing-mark=to_WAN5
add check-gateway=ping distance=1 gateway=pppoe-out6 routing-mark=to_WAN6
add check-gateway=ping distance=1 gateway=pppoe-out7 routing-mark=to_WAN7
add check-gateway=ping distance=1 gateway=pppoe-out8 routing-mark=to_WAN8
add check-gateway=ping distance=1 gateway=pppoe-out1
add check-gateway=ping distance=2 gateway=pppoe-out2
add check-gateway=ping distance=3 gateway=pppoe-out3
add check-gateway=ping distance=4 gateway=pppoe-out4
add check-gateway=ping distance=5 gateway=pppoe-out5
add check-gateway=ping distance=6 gateway=pppoe-out6
add check-gateway=ping distance=7 gateway=pppoe-out7
add check-gateway=ping distance=8 gateway=pppoe-out8
 
Feklar
Forum Guru
Forum Guru
Posts: 1724
Joined: Tue Dec 01, 2009 11:46 pm

Re: Best method to load balance 8 Wan for a domitory

Fri Oct 27, 2017 6:58 pm

Chances are it's too random, you have the PCC classifier set to both-addresses-and-ports. Try setting it to both-addresses to keep multiple connections to the same IP from the same host on the same link, or try moving it to src-address so that a given host will always use one WAN.

This will help with HTTPS sites and forums as well, since for security reasons they do not link to see connections coming from multiple public IP addresses.
 
engbassamy
just joined
Posts: 2
Joined: Wed Dec 20, 2017 9:25 am

Re: Best method to load balance 8 Wan for a domitory

Fri Dec 29, 2017 1:29 pm

You can try with this script to solve your problem , but it just with two lines ,you can extend it with eight lines.

/ip dhcp-client
add add-default-route=no comment=defconf dhcp-options=hostname,clientid \
disabled=no interface=WAN1
add add-default-route=no dhcp-options=hostname,clientid disabled=no \
interface=WAN2

/ ip firewall mangle
add chain=prerouting dst-address=192.168.0.0/24 action=accept in-interface=bridge
add chain=prerouting dst-address=192.168.11.0/24 action=accept in-interface=bridge

add chain=prerouting in-interface=WAN1 connection-mark=no-mark action=mark-connection new-connection-mark=WAN1_conn
add chain=prerouting in-interface=WAN2 connection-mark=no-mark action=mark-connection new-connection-mark=WAN2_conn

add chain=prerouting in-interface=bridge connection-mark=no-mark dst-address-type=!local per-connection-classifier=both-addresses:2/0 action=mark-connection new-connection-mark=WAN1_conn
add chain=prerouting in-interface=bridge connection-mark=no-mark dst-address-type=!local per-connection-classifier=both-addresses:2/1 action=mark-connection new-connection-mark=WAN2_conn

add chain=prerouting connection-mark=WAN1_conn in-interface=bridge action=mark-routing new-routing-mark=to_WAN1
add chain=prerouting connection-mark=WAN2_conn in-interface=bridge action=mark-routing new-routing-mark=to_WAN2

add chain=output connection-mark=WAN1_conn action=mark-routing new-routing-mark=to_WAN1
add chain=output connection-mark=WAN2_conn action=mark-routing new-routing-mark=to_WAN2

/ ip route
add dst-address=0.0.0.0/0 gateway=192.168.11.1 routing-mark=to_WAN1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.0.1 routing-mark=to_WAN2 check-gateway=ping

add dst-address=0.0.0.0/0 gateway=192.168.11.1 distance=1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.0.1 distance=2 check-gateway=ping

/ ip firewall nat
add chain=srcnat out-interface=WAN1 action=masquerade
add chain=srcnat out-interface=WAN2 action=masquerade
 
User avatar
sebastia
Forum Guru
Forum Guru
Posts: 1782
Joined: Tue Oct 12, 2010 3:23 am
Location: Antwerp, BE

Re: Best method to load balance 8 Wan for a domitory

Fri Dec 29, 2017 4:09 pm

Best solution would be to have QoS implemented, prioritising low latency traffic. BUT I'm not sure if QoS and policy based routing are compatible, as BOTH use connection-marking to do its stuff.

Anyone combined QoS & policy based routing?

Who is online

Users browsing this forum: Amazon [Bot], Josephny, rogerioqueiroz, TeWe and 97 guests