Community discussions

 
ners
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 99
Joined: Tue Mar 12, 2013 4:30 pm

PCQ-rate is divided between all users regardless of max-limi

Fri Mar 15, 2013 12:46 pm

I'm trying to set up a PPPoE server on a Mikrotik router, 6.0rc11

I'm using PCQ queues to limit traffic for each separate user.

For example, let's take the queue "TEST_1MB_DOWNLOAD". All users which are processed by this queue should receive 1 Megabit/sec download. However it's not working as expected.

Problem:
If only one user is being processed by this queue he gets 1Mbit/sec, however if me and my colleague connect at the same time and start downloading, we get only 500kb/sec each! The queue does not respect the "pcq-rate=1M" setting for each user, it divides this "pcq-rate=1M" between the two of us, so we get only 500 kbit/s!

Here's my setup:

ros code

/ip firewall mangle
add action=mark-connection chain=forward new-connection-mark=TEST_1MB_CONN src-address-list=TEST_1MB
add action=mark-connection chain=forward new-connection-mark=TEST_4MB_CONN src-address-list=TEST_4MB
add action=mark-connection chain=forward new-connection-mark=TEST_8MB_CONN src-address-list=TEST_8MB
add action=mark-packet chain=forward connection-mark=TEST_1MB_CONN new-packet-mark=TEST_1MB_TRAF passthrough=no
add action=mark-packet chain=forward connection-mark=TEST_4MB_CONN new-packet-mark=TEST_4MB_TRAF passthrough=no
add action=mark-packet chain=forward connection-mark=TEST_8MB_CONN new-packet-mark=TEST_8MB_TRAF passthrough=no

ros code

/queue type
add kind=pcq name=TEST_1MB_DOWNLOAD pcq-classifier=dst-address pcq-rate=1M pcq-total-limit=50000
add kind=pcq name=TEST_4MB_DOWNLOAD pcq-classifier=dst-address pcq-rate=4M pcq-total-limit=50000
add kind=pcq name=TEST_8MB_DOWNLOAD pcq-classifier=dst-address pcq-rate=8M pcq-total-limit=50000
add kind=pcq name=TEST_1MB_UPLOAD pcq-classifier=src-address pcq-rate=1M pcq-total-limit=50000
add kind=pcq name=TEST_4MB_UPLOAD pcq-classifier=src-address pcq-rate=4M pcq-total-limit=50000
add kind=pcq name=TEST_8MB_UPLOAD pcq-classifier=src-address pcq-rate=8M pcq-total-limit=50000

/queue tree
add max-limit=1G name=TOTAL_DOWNLOAD parent=ether2 priority=1 queue=default
add max-limit=1G name=TEST_1MB_DOWNLOAD packet-mark=TEST_1MB_TRAF parent=TOTAL_DOWNLOAD queue=TEST_1MB_DOWNLOAD
add max-limit=1G name=TEST_4MB_DOWNLOAD packet-mark=TEST_4MB_TRAF parent=TOTAL_DOWNLOAD priority=4 queue=\
    TEST_4MB_DOWNLOAD
add name=TEST_8MB_DOWNLOAD packet-mark=TEST_8MB_TRAF parent=TOTAL_DOWNLOAD priority=1 queue=TEST_8MB_DOWNLOAD
add max-limit=1G name=TOTAL_UPLOAD parent=ether1 queue=default
add max-limit=1G name=TEST_1MB_UPLOAD packet-mark=TEST_1MB_TRAF parent=TOTAL_UPLOAD queue=TEST_1MB_UPLOAD
add max-limit=1G name=TEST_4MB_UPLOAD packet-mark=TEST_4MB_TRAF parent=TOTAL_UPLOAD priority=4 queue=TEST_4MB_UPLOAD
add name=TEST_8MB_UPLOAD packet-mark=TEST_8MB_TRAF parent=TOTAL_UPLOAD priority=1 queue=TEST_8MB_UPLOAD
I cannot understand what I am doing wrong. Max-limit is set to 1G, pcq-rate is set to 1M, why is bandwidth of 1M evendly divided between two users? Each user should get his own 1M.
 
derr12
Member
Member
Posts: 411
Joined: Fri May 01, 2009 11:32 pm

Re: PCQ-rate is divided between all users regardless of max-

Fri Mar 15, 2013 5:14 pm

You want to add a simple queue to specify an ip or ip range you want to apply the pcq limit to like this;

/queue simple
add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s comment=\
"wireless router 2meg/512k" direction=both disabled=no dst-address=0.0.0.0/0 \
interface=all limit-at=0/0 max-limit=0/0 name=queue1 parent=none priority=1 queue=\
router_up/router_dn target-addresses=10.0.0.3/32 total-queue=default-small
add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s comment="hotel 512k/256k" \
direction=both disabled=no dst-address=0.0.0.0/0 interface=all limit-at=0/0 max-limit=\
0/0 name=hotel parent=none priority=2 queue=up-local/dnl-local target-addresses=\
10.0.0.0/22 total-queue=default-small

/queue type
set default kind=pfifo name=default pfifo-limit=50
set ethernet-default kind=pfifo name=ethernet-default pfifo-limit=50
set wireless-default kind=sfq name=wireless-default sfq-allot=1514 sfq-perturb=5
set synchronous-default kind=red name=synchronous-default red-avg-packet=1000 red-burst=20 \
red-limit=60 red-max-threshold=50 red-min-threshold=10
set hotspot-default kind=sfq name=hotspot-default sfq-allot=1514 sfq-perturb=5
add kind=pcq name=uploads_pcq pcq-classifier=src-address pcq-limit=50 pcq-rate=0 \
pcq-total-limit=2000
add kind=pcq name=downloads_pcq pcq-classifier=dst-address pcq-limit=50 pcq-rate=0 \
pcq-total-limit=2000
add kind=pcq name=dnl-local pcq-classifier=dst-address pcq-limit=50 pcq-rate=512000 \
pcq-total-limit=2000
add kind=pcq name=up-local pcq-classifier=dst-address pcq-limit=50 pcq-rate=256000 \
pcq-total-limit=2000
add kind=pcq name=router_up pcq-classifier=dst-address pcq-limit=50 pcq-rate=512000 \
pcq-total-limit=2000
add kind=pcq name=router_dn pcq-classifier=dst-address pcq-limit=50 pcq-rate=2048000 \
pcq-total-limit=2000

See how ive assigned my pcq queues to simple queues like that? you can still manage your total wan allocation via the queue tree like you have too.
 
ners
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 99
Joined: Tue Mar 12, 2013 4:30 pm

Re: PCQ-rate is divided between all users regardless of max-

Sat Mar 16, 2013 10:05 am

Thank you, derr12. I've altered my configuration and now it seems to be working as needed (two users get 1Mbit each). I have eliminated connection marking completely, still not sure why it was needed in the first place, and also in the queue tree I changed parent interface from "ether2" to "global".
Is this how it's supposed to be configured, didn't I miss anything? I still don't get the whole picture how all these queues and packet marking work, so it's more like trial and error to me at the moment.:

ros code

/ip firewall mangle
add action=mark-packet chain=postrouting new-packet-mark=UNRESTRICTED_UPLOAD src-address-list=VIP
add action=mark-packet chain=postrouting new-packet-mark=UNRESTRICTED_DOWNLOAD dst-address-list=VIP

add action=mark-packet chain=forward new-packet-mark=1M-upload src-address-list=TEST_1MB
add action=mark-packet chain=forward new-packet-mark=1M-download dst-address-list=TEST_1MB

ros code

/queue type
add kind=pcq name=1M-DOWNLOAD pcq-classifier=dst-address pcq-rate=1024k pcq-total-limit=50000
add kind=pcq name=1M-UPLOAD pcq-classifier=src-address pcq-rate=1024k pcq-total-limit=50000

ros code

/queue tree
add name=1M_DOWNLOAD packet-mark=1M-download parent=global queue=1M-DOWNLOAD
add name=1M_UPLOAD packet-mark=1M-upload parent=global queue=1M-UPLOAD

add name=VIP_DOWN packet-mark=UNRESTRICTED_DOWNLOAD parent=global queue=default
add name=VIP_UP packet-mark=UNRESTRICTED_UPLOAD parent=global queue=default
Users from the VIP list should not get any traffic rate restrictions at present.
 
derr12
Member
Member
Posts: 411
Joined: Fri May 01, 2009 11:32 pm

Re: PCQ-rate is divided between all users regardless of max-

Sat Mar 16, 2013 10:31 pm

Connection marking is only required if you are going to use Queue tree's.

The easiest way to do this would be by sorting your speed classes into different IP subnets:
If your unlimited users are all on the same subnet you can simply not include them at all in your rules. so all you really need is;
/queue type
add kind=pcq name=1M-DOWNLOAD pcq-classifier=dst-address pcq-rate=1024k pcq-total-limit=50000
add kind=pcq name=1M-UPLOAD pcq-classifier=src-address pcq-rate=1024k pcq-total-limit=50000
And your simple queue for the 1m/1m limited guys assuming the 1/1m limited users are being assigned ip's from 192.168.1.0/24 and your unlimited guys are on a different subnet:
add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s comment="Limited Users" \
    direction=both disabled=no dst-address=0.0.0.0/0 interface=all limit-at=0/0 max-limit=\
    0/0 name=hotel parent=none priority=2 queue=1M-UPLOAD/1M-DOWNLOAD target-addresses=\
    192.168.1.0/24 total-queue=default-small
So this way you only need create rules for the users who need limiting. Those who dont have no mention. you will of couse have to have your IP scheme set up to work this way...

Queue tree's are best used for when you want to specify how much avaialble bandwidth you want to share amung users, for example.

A queue tree to QOS a 20mbit Half duplex WAN link might look like this;

Download Total 15mbits
- "http/mail/voip" Limit-at 10mbits max-total 15mbits.
- "everything else" Limit-at 5mbits max total 15mbits
Upload total 5mbits
- "http/mail/voip" Limit-at 4mbits max-total 5mbits.
- "everything else" Limit-at 1mbits max total 5mbits

You would use firewall mangle rules to identify traffic types, for example:
add action=mark-packet chain=prerouting comment="HTTP Uploads" disabled=no \
    dst-port=80 new-packet-mark=http/mail/voip_up passthrough=no protocol=tcp
add action=mark-packet chain=prerouting comment="HTTP Downloads" disabled=no \
    new-packet-mark=http/mail/voip_down passthrough=no protocol=tcp src-port=80
This is a really good read, it helps explain a lot of the questions you are asking. http://mum.mikrotik.com/presentations/C ... _Megis.pdf
 
derr12
Member
Member
Posts: 411
Joined: Fri May 01, 2009 11:32 pm

Re: PCQ-rate is divided between all users regardless of max-

Sat Mar 16, 2013 10:36 pm

PS

If you dont have your subnets organized like suggested above then you will have to use packet marks and your address list in order to place them in the correct simple queue.
/queue simple
add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s comment="" \
    direction=both disabled=yes dst-address=0.0.0.0/0 interface=all limit-at=\
    0/0 max-limit=0/0 name=queue1 packet-marks=p1_up parent=none priority=8 \
    queue=1M-DOWNLOAD/1M-UPLOAD total-queue=default-small

/ip firewall mangle
add action=mark-packet chain=forward new-packet-mark=1M-upload src-address-list=TEST_1MB
add action=mark-packet chain=forward new-packet-mark=1M-download dst-address-list=TEST_1MB
 
ners
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 99
Joined: Tue Mar 12, 2013 4:30 pm

Re: PCQ-rate is divided between all users regardless of max-

Mon Mar 18, 2013 9:06 am

Thnks, derr12 :) I got it sorted out. However there's still one problem left. I guess a new thread is needed.

Who is online

Users browsing this forum: No registered users and 99 guests