Home

RB750/750G - Dual WAN Load Balancing (NTH method)

 

Recently talk to Riz, he suggest to try out load balancing using NTH method, which he has been using on his home RB750 with multi-ISPs Laughing
Documentation & references :

 

 

 


Thanks to Riz & the reference above Smile

Managed to setup dual WAN load balancing with Nth, tested on my PC to download and play YouTube in 720P mode concurrently.  Noticed it uses both WANs to download concurrently ! Cool

 

Also tested torrenting, able to combine & use both WANs, nice ! Wink

 

 

So far so good, the NTH method seem to be more suitable for me than the PCC method.
Still testing & experimenting ......

 


Mangle Rule

 

<UniFi + P1 with NTH>

add action=mark-connection chain=prerouting connection-state=new disabled=no dst-address-type="" in-interface=ether2-LAN new-connection-mark=P1_conn nth=2,1 passthrough=yes
add action=mark-routing chain=prerouting connection-mark=P1_conn disabled=no in-interface=ether2-LAN new-routing-mark=to_P1 passthrough=no
add action=mark-connection chain=prerouting connection-state=new disabled=no dst-address-type="" in-interface=ether2-LAN new-connection-mark=UniFi_conn nth=2,2 passthrough=yes
add action=mark-routing chain=prerouting connection-mark=UniFi_conn disabled=no in-interface=ether2-LAN new-routing-mark=to_UniFi passthrough=no

 

<For Simple Queue - basically duplicate for both ISPs>
add action=mark-packet chain=prerouting comment="P1 : QoS_1" disabled=no in-interface=P1 new-packet-mark=P1_Q1 passthrough=no protocol=icmp
add action=mark-packet chain=postrouting disabled=no new-packet-mark=P1_Q1 out-interface=P1 passthrough=no protocol=icmp
add action=mark-packet chain=prerouting disabled=no in-interface=P1 new-packet-mark=P1_Q1 passthrough=no protocol=tcp src-port=53,3074
add action=mark-packet chain=postrouting disabled=no dst-port=53,3074 new-packet-mark=P1_Q1 out-interface=P1 passthrough=no protocol=tcp
add action=mark-packet chain=prerouting disabled=no in-interface=P1 new-packet-mark=P1_Q1 passthrough=no protocol=udp src-port=53,88,3074
add action=mark-packet chain=postrouting disabled=no dst-port=53,88,3074 new-packet-mark=P1_Q1 out-interface=P1 passthrough=no protocol=udp
add action=mark-packet chain=prerouting comment="SIP -by Port" disabled=no in-interface=P1 new-packet-mark=P1_Q1 passthrough=no protocol=udp src-port=5060-5062
add action=mark-packet chain=postrouting disabled=no dst-port=5060-5062 new-packet-mark=P1_Q1 out-interface=P1 passthrough=no protocol=udp
add action=mark-packet chain=prerouting comment=QoS_2 disabled=no in-interface=P1 new-packet-mark=P1_Q2 passthrough=no protocol=tcp src-port=80,8080,443
add action=mark-packet chain=postrouting disabled=no dst-port=80,8080,443 new-packet-mark=P1_Q2 out-interface=P1 passthrough=no protocol=tcp
add action=mark-packet chain=prerouting comment=QoS_3 disabled=no in-interface=P1 new-packet-mark=P1_Q3 passthrough=no protocol=tcp src-port=110,25,995,465,587,21,113
add action=mark-packet chain=postrouting disabled=no dst-port=110,25,995,465,587,21,113 new-packet-mark=P1_Q3 out-interface=P1 passthrough=no protocol=tcp
add action=mark-packet chain=prerouting disabled=no in-interface=P1 new-packet-mark=P1_Q3 passthrough=no protocol=udp src-port=123,113
add action=mark-packet chain=postrouting disabled=no dst-port=123,113 new-packet-mark=P1_Q3 out-interface=P1 passthrough=no protocol=udp
add action=mark-packet chain=prerouting comment=QoS_8 disabled=no in-interface=P1 new-packet-mark=P1_Q8 passthrough=no protocol=tcp src-port=30000-63999
add action=mark-packet chain=postrouting disabled=no dst-port=30000-63999 new-packet-mark=P1_Q8 out-interface=P1 passthrough=no protocol=tcp
add action=mark-packet chain=prerouting disabled=no in-interface=P1 new-packet-mark=P1_Q8 passthrough=no protocol=udp src-port=30000-63999
add action=mark-packet chain=postrouting disabled=no dst-port=30000-63999 new-packet-mark=P1_Q8 out-interface=P1 passthrough=no protocol=udp
add action=mark-packet chain=prerouting disabled=no in-interface=P1 new-packet-mark=P1_Q8 p2p=all-p2p passthrough=no
add action=mark-packet chain=postrouting disabled=no new-packet-mark=P1_Q8 out-interface=P1 p2p=all-p2p passthrough=no
add action=mark-packet chain=prerouting comment=QoS_7 disabled=no in-interface=P1 new-packet-mark=P1_Q7 passthrough=no protocol=tcp
add action=mark-packet chain=postrouting disabled=no new-packet-mark=P1_Q7 out-interface=P1 passthrough=no protocol=tcp
add action=mark-packet chain=prerouting disabled=no in-interface=P1 new-packet-mark=P1_Q7 passthrough=no protocol=udp
add action=mark-packet chain=postrouting disabled=no new-packet-mark=P1_Q7 out-interface=P1 passthrough=no protocol=udp
add action=mark-packet chain=prerouting disabled=no in-interface=P1 new-packet-mark=P1_Q7 passthrough=no
add action=mark-packet chain=postrouting disabled=no new-packet-mark=P1_Q7 out-interface=P1 passthrough=no
add action=mark-packet chain=prerouting comment="UniFi : QoS_1" disabled=no in-interface=UniFi new-packet-mark=UniFi_Q1 passthrough=no protocol=icmp
add action=mark-packet chain=postrouting disabled=no new-packet-mark=UniFi_Q1 out-interface=UniFi passthrough=no protocol=icmp
add action=mark-packet chain=prerouting disabled=no in-interface=UniFi new-packet-mark=UniFi_Q1 passthrough=no protocol=tcp src-port=53,3074
add action=mark-packet chain=postrouting disabled=no dst-port=53,3074 new-packet-mark=UniFi_Q1 out-interface=UniFi passthrough=no protocol=tcp
add action=mark-packet chain=prerouting disabled=no in-interface=UniFi new-packet-mark=UniFi_Q1 passthrough=no protocol=udp src-port=53,88,3074
add action=mark-packet chain=postrouting disabled=no dst-port=53,88,3074 new-packet-mark=UniFi_Q1 out-interface=UniFi passthrough=no protocol=udp
add action=mark-packet chain=prerouting comment="SIP -by Port" disabled=no in-interface=UniFi new-packet-mark=UniFi_Q1 passthrough=no protocol=udp src-port=5060-5062
add action=mark-packet chain=postrouting disabled=no dst-port=5060-5062 new-packet-mark=UniFi_Q1 out-interface=UniFi passthrough=no protocol=udp
add action=mark-packet chain=prerouting comment=QoS_2 disabled=no in-interface=UniFi new-packet-mark=UniFi_Q2 passthrough=no protocol=tcp src-port=80,8080,443
add action=mark-packet chain=postrouting disabled=no dst-port=80,8080,443 new-packet-mark=UniFi_Q2 out-interface=UniFi passthrough=no protocol=tcp
add action=mark-packet chain=prerouting comment=QoS_3 disabled=no in-interface=UniFi new-packet-mark=UniFi_Q3 passthrough=no protocol=tcp src-port=110,25,995,465,587,21,113
add action=mark-packet chain=postrouting disabled=no dst-port=110,25,995,465,587,21,113 new-packet-mark=UniFi_Q3 out-interface=UniFi passthrough=no protocol=tcp
add action=mark-packet chain=prerouting disabled=no in-interface=UniFi new-packet-mark=UniFi_Q3 passthrough=no protocol=udp src-port=123,113
add action=mark-packet chain=postrouting disabled=no dst-port=123,113 new-packet-mark=UniFi_Q3 out-interface=UniFi passthrough=no protocol=udp
add action=mark-packet chain=prerouting comment=QoS_8 disabled=no in-interface=UniFi new-packet-mark=UniFi_Q8 passthrough=no protocol=tcp src-port=30000-63999
add action=mark-packet chain=postrouting disabled=no dst-port=30000-63999 new-packet-mark=UniFi_Q8 out-interface=UniFi passthrough=no protocol=tcp
add action=mark-packet chain=prerouting disabled=no in-interface=UniFi new-packet-mark=UniFi_Q8 passthrough=no protocol=udp src-port=30000-63999
add action=mark-packet chain=postrouting disabled=no dst-port=30000-63999 new-packet-mark=UniFi_Q8 out-interface=UniFi passthrough=no protocol=udp
add action=mark-packet chain=prerouting disabled=no in-interface=UniFi new-packet-mark=UniFi_Q8 p2p=all-p2p passthrough=no
add action=mark-packet chain=postrouting disabled=no new-packet-mark=UniFi_Q8 out-interface=UniFi p2p=all-p2p passthrough=no
add action=mark-packet chain=prerouting comment=QoS_7 disabled=no in-interface=UniFi new-packet-mark=UniFi_Q7 passthrough=no protocol=tcp
add action=mark-packet chain=postrouting disabled=no new-packet-mark=UniFi_Q7 out-interface=UniFi passthrough=no protocol=tcp
add action=mark-packet chain=prerouting disabled=no in-interface=UniFi new-packet-mark=UniFi_Q7 passthrough=no protocol=udp
add action=mark-packet chain=postrouting disabled=no new-packet-mark=UniFi_Q7 out-interface=UniFi passthrough=no protocol=udp
add action=mark-packet chain=prerouting disabled=no in-interface=UniFi new-packet-mark=UniFi_Q7 passthrough=no
add action=mark-packet chain=postrouting disabled=no new-packet-mark=UniFi_Q7 out-interface=UniFi passthrough=no


Simple Queue

Simple queue for both UniFi & P1

 

add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s direction=both disabled=no interface=P1 limit-at=0/0 max-limit=5300k/5300k name=P1 packet-marks="" parent=none priority=1 queue=default/default target-addresses="" total-queue=default
add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s direction=both disabled=no interface=P1 limit-at=0/0 max-limit=0/0 name=P1-Q1 packet-marks=P1_Q1 parent=P1 priority=1 queue=default/default target-addresses="" total-queue=default
add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s direction=both disabled=no interface=P1 limit-at=0/0 max-limit=0/0 name=P1-Q2 packet-marks=P1_Q2 parent=P1 priority=2 queue=default/default target-addresses="" total-queue=default
add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s direction=both disabled=no interface=P1 limit-at=0/0 max-limit=0/0 name=P1-Q3 packet-marks=P1_Q3 parent=P1 priority=3 queue=default/default target-addresses="" total-queue=default
add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s direction=both disabled=no interface=P1 limit-at=0/0 max-limit=0/0 name=P1-Q7 packet-marks=P1_Q7 parent=P1 priority=7 queue=default/default target-addresses="" total-queue=default
add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s direction=both disabled=no interface=P1 limit-at=0/0 max-limit=0/0 name=P1-Q8 packet-marks=P1_Q8 parent=P1 priority=8 queue=default/default target-addresses="" total-queue=default
add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s direction=both disabled=no interface=UniFi limit-at=0/0 max-limit=5300k/5300k name=UniFi packet-marks="" parent=none priority=1 queue=default/default target-addresses="" total-queue=default
add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s direction=both disabled=no interface=UniFi limit-at=0/0 max-limit=0/0 name=UniFi-Q1 packet-marks=UniFi_Q1 parent=UniFi priority=1 queue=default/default target-addresses="" total-queue=default
add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s direction=both disabled=no interface=UniFi limit-at=0/0 max-limit=0/0 name=UniFi-Q2 packet-marks=UniFi_Q2 parent=UniFi priority=2 queue=default/default target-addresses="" total-queue=default
add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s direction=both disabled=no interface=UniFi limit-at=0/0 max-limit=0/0 name=UniFi-Q3 packet-marks=UniFi_Q3 parent=UniFi priority=3 queue=default/default target-addresses="" total-queue=default
add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s direction=both disabled=no interface=UniFi limit-at=0/0 max-limit=0/0 name=UniFi-Q7 packet-marks=UniFi_Q7 parent=UniFi priority=7 queue=default/default target-addresses="" total-queue=default
add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s direction=both disabled=no interface=UniFi limit-at=0/0 max-limit=0/0 name=UniFi-Q8 packet-marks=UniFi_Q8 parent=UniFi priority=8 queue=default/default target-addresses="" total-queue=default


.