Community discussions

MikroTik App
 
gwicon
just joined
Topic Author
Posts: 9
Joined: Tue Nov 03, 2009 8:22 pm

PCC + PCQ Easy setup but not working

Thu May 19, 2011 1:11 pm

Hi all. I'm starting to play with load balance with PCC and QoS with PCQ starting with an easy setup, but i found affter reading some examples and making my configuration that not all is working as expected.
Hardware:
RB532A
R OS mipsle 5.2

Eth1 = LAN = 192.168.0.1/24 with DHCP
wlan = ISP1 = 192.168.1.2/24
Eth2 = ISP2 = 192.168.2.2/24

PCC is working fine, but PCQ only limits downloads from LAN users, uploads goes at full link speed.
I'm trying to limit users on LAN to 512k dowload and 128k upload.
Two questions:
Someone can help me with this?
If i have two links with 10Mb/06Mb max-limit= on queue tree would be 20480k for download and 1228k for upload?

Here is my example setup:
DHCP, DNS... and other config omited
/ ip address
add address=192.168.0.1/24 network=192.168.0.0 broadcast=192.168.0.255 interface=LAN
add address=192.168.1.2/24 network=192.168.1.0 broadcast=192.168.1.255 interface=ISP1
add address=192.168.2.2/24 network=192.168.2.0 broadcast=192.168.2.255 interface=ISP2

/ ip firewall mangle
# Start mark packets for PCQ
add action=mark-packet chain=prerouting new-packet-mark=LAN-packets-up passthrough=yes src-address=192.168.0.0/24 in-interface=LAN
add action=mark-packet chain=postrouting new-packet-mark=LAN-packets-down passthrough=no dst-address=192.168.0.0/24 out-interface=LAN
# End mark packets for PCQ
add chain=prerouting dst-address=192.168.1.0/24  action=accept in-interface=LAN
add chain=prerouting dst-address=192.168.2.0/24  action=accept in-interface=LAN
add chain=prerouting in-interface=ISP1 connection-mark=no-mark action=mark-connection new-connection-mark=ISP1_conn
add chain=prerouting in-interface=ISP2 connection-mark=no-mark action=mark-connection new-connection-mark=ISP2_conn
add chain=prerouting  in-interface=LAN connection-mark=no-mark dst-address-type=!local per-connection-classifier=both-addresses:2/0 action=mark-connection new-connection-mark=ISP1_conn 
add chain=prerouting  in-interface=LAN connection-mark=no-mark dst-address-type=!local per-connection-classifier=both-addresses:2/1 action=mark-connection new-connection-mark=ISP2_conn
add chain=prerouting connection-mark=ISP1_conn in-interface=LAN action=mark-routing new-routing-mark=to_ISP1
add chain=prerouting connection-mark=ISP2_conn in-interface=LAN action=mark-routing new-routing-mark=to_ISP2
add chain=output connection-mark=ISP1_conn action=mark-routing new-routing-mark=to_ISP1     
add chain=output connection-mark=ISP2_conn action=mark-routing new-routing-mark=to_ISP2

/ ip route
add dst-address=0.0.0.0/0 gateway=192.168.1.1 routing-mark=to_ISP1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.2.1 routing-mark=to_ISP2 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.1.1 distance=1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.2.1 distance=2 check-gateway=ping

/ ip firewall nat 
add chain=srcnat out-interface=ISP1 action=masquerade
add chain=srcnat out-interface=ISP2 action=masquerade

/queue type
add kind=pcq name="LAN-up" pcq-classifier=src-address pcq-limit=40 pcq-rate=128000 pcq-total-limit=7000
add kind=pcq name="LAN-down" pcq-classifier=dst-address pcq-limit=40 pcq-rate=512000 pcq-total-limit=7000

/queue tree
add name="Bandwidth Management" parent=LAN priority=8
add max-limit=1024k name="LAN Package-up" packet-mark=LAN-packets-up parent="Bandwidth Management" priority=3 queue=LAN-up
add max-limit=10240k name="LAN Package-down" packet-mark=LAN-packets-down parent="Bandwidth Management" priority=3 queue=LAN-down
Thank's in advance.
 
gwicon
just joined
Topic Author
Posts: 9
Joined: Tue Nov 03, 2009 8:22 pm

Re: PCC + PCQ Easy setup but not working

Thu May 19, 2011 9:20 pm

Affter a little search i think i found a solution. It appears to be working well. So here is.

I will continue playing with this, very good documentation Mikrotik.
/ ip address
add address=192.168.0.1/24 network=192.168.0.0 broadcast=192.168.0.255 interface=LAN
add address=192.168.1.2/24 network=192.168.1.0 broadcast=192.168.1.255 interface=ISP1
add address=192.168.2.2/24 network=192.168.2.0 broadcast=192.168.2.255 interface=ISP2

/ ip firewall mangle
add chain=prerouting dst-address=192.168.1.0/24  action=accept in-interface=LAN
add chain=prerouting dst-address=192.168.2.0/24  action=accept in-interface=LAN
add chain=prerouting in-interface=ISP1 connection-mark=no-mark action=mark-connection new-connection-mark=ISP1_conn
add chain=prerouting in-interface=ISP2 connection-mark=no-mark action=mark-connection new-connection-mark=ISP2_conn
add chain=prerouting in-interface=LAN connection-mark=no-mark dst-address-type=!local per-connection-classifier=both-addresses:2/0 action=mark-connection new-connection-mark=ISP1_conn 
add chain=prerouting in-interface=LAN connection-mark=no-mark dst-address-type=!local per-connection-classifier=both-addresses:2/1 action=mark-connection new-connection-mark=ISP2_conn
#Here the packet marks for PCQ, based on ISP1_conn & ISP2_conn needed for PCC
add chain=prerouting connection-mark=ISP1_conn action=mark-packet new-packet-mark=basic_client_traffic passthrough=yes comment="Packet Mark of conn to ISP1" disabled=no
add chain=prerouting connection-mark=ISP2_conn action=mark-packet new-packet-mark=basic_client_traffic passthrough=yes comment="Packet Mark of conn to ISP2" disabled=no
#End of Packet marks for PCQ
add chain=prerouting connection-mark=ISP1_conn in-interface=LAN action=mark-routing new-routing-mark=to_ISP1
add chain=prerouting connection-mark=ISP2_conn in-interface=LAN action=mark-routing new-routing-mark=to_ISP2
add chain=output connection-mark=ISP1_conn action=mark-routing new-routing-mark=to_ISP1     
add chain=output connection-mark=ISP2_conn action=mark-routing new-routing-mark=to_ISP2

/ ip route
add dst-address=0.0.0.0/0 gateway=192.168.1.1 routing-mark=to_ISP1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.2.1 routing-mark=to_ISP2 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.1.1 distance=1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.2.1 distance=2 check-gateway=ping

/ ip firewall nat 
add chain=srcnat out-interface=ISP1 action=masquerade
add chain=srcnat out-interface=ISP2 action=masquerade

/queue type
add kind=pcq name="PCQ_up_128k" pcq-classifier=src-address pcq-limit=40 pcq-rate=128000 pcq-total-limit=2000
add kind=pcq name="PCQ_down_512k" pcq-classifier=dst-address pcq-limit=40 pcq-rate=512000 pcq-total-limit=2000

/queue tree
#One Queue for LAN
add name="Total_Download" parent=LAN packet-mark="" limit-at=0 queue=default priority=1 max-limit=0 burst-limit=0 burst-threshold=0 burst-time=0s disabled=no
add name="basic_client_download" parent=Total_Download packet-mark=basic_client_traffic limit-at=0 queue=PCQ_down_512k priority=8 max-limit=0 burst-limit=0 burst-threshold=0 burst-time=0s disabled=no

#Two Queue's for the two ISP links
add name="Total_Upload_ISP1" parent=ISP1 packet-mark="" limit-at=0 queue=default priority=1 max-limit=0 burst-limit=0 burst-threshold=0 burst-time=0s disabled=no
add name="basic_client_upload_to_ISP1" parent=Total_Upload_ISP1 packet-mark=basic_client_traffic limit-at=0 queue=PCQ_up_128k priority=8 max-limit=0 burst-limit=0 burst-threshold=0 burst-time=0s disabled=no
add name="Total_Upload_ISP2" parent=ISP2 packet-mark="" limit-at=0 queue=default priority=1 max-limit=0 burst-limit=0 burst-threshold=0 burst-time=0s disabled=no
add name="basic_client_upload_to_ISP2" parent=Total_Upload_ISP2 packet-mark=basic_client_traffic limit-at=0 queue=PCQ_up_128k priority=8 max-limit=0 burst-limit=0 burst-threshold=0 burst-time=0s disabled=no
If someone can review this and can suggest improvements, thanks in advance.