Community discussions

MikroTik App
 
lotnybartek
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 97
Joined: Wed Apr 16, 2014 3:22 pm

Simple PCQ equal bandwidth shaping Upload counting as Download ; /

Wed Aug 10, 2016 2:36 pm

Hi so I created few rules to be able to do simple PCQ equal bandwidth shaping.

Modem (bridge mode) connected to --> ether1 on RB2011 (PPPoE) --> wlan + 2x Virtual Ap's

My code is:
/ip firewall mangle add chain=prerouting action=mark-packet new-packet-mark=all passthrough=no

/queue type add name="PCQ_download" kind=pcq pcq-rate=0 pcq-classifier=dst-address
/queue type add name="PCQ_upload" kind=pcq pcq-rate=0 pcq-classifier=src-address

/queue tree add parent=global queue=PCQ_download packet-mark=all max-limit=60M
/queue tree add parent=global queue=PCQ_upload packet-mark=all max-limit=8M
With this code, I can see in Queue Tree that only Download is increasing. Can someone tell me why?
 
pe1chl
Forum Guru
Forum Guru
Posts: 10629
Joined: Mon Jun 08, 2015 12:09 pm

Re: Simple PCQ equal bandwidth shaping Upload counting as Download ; /

Wed Aug 10, 2016 2:57 pm

There is nothing in your ruleset that identifies upload or download, and once the first match occurs
in a queue entry it takes the traffic and the queues below it get nothing.
 
User avatar
ZeroByte
Forum Guru
Forum Guru
Posts: 4047
Joined: Wed May 11, 2011 6:08 pm

Re: Simple PCQ equal bandwidth shaping Upload counting as Download ; /

Wed Aug 10, 2016 4:58 pm

In the pre-routing chain, add a condition to the rule: in-interface=bridge-local, and change the packet mark from "all" to "upload"

Then copy the rule and change the mark from "upload" to "download" and change the in-interface from bridge-local to ether1-gateway
(or pppoe1-out if you're using pppoe)

Then change the upstream queue to use mark=upload
and change downstream queue to use mark=download
 
lotnybartek
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 97
Joined: Wed Apr 16, 2014 3:22 pm

Re: Simple PCQ equal bandwidth shaping Upload counting as Download ; /

Wed Aug 10, 2016 9:03 pm

This one works fine here: (from polish trzepak.pl forum where I made the same thread)
/ip firewall mangle add chain=forward action=mark-packet new-packet-mark=all_download in-interface=ether1 passthrough=no
/ip firewall mangle add chain=forward action=mark-packet new-packet-mark=all_upload out-interface=pppoe-out1 passthrough=no
/ip firewall mangle add chain=input action=mark-packet new-packet-mark=all_download in-interface=pppoe-out1 passthrough=no
/ip firewall mangle add chain=output action=mark-packet new-packet-mark=all_upload out-interface=pppoe-out1 passthrough=no

/queue type add name="PCQ_download" kind=pcq pcq-rate=0 pcq-classifier=dst-address
/queue type add name="PCQ_upload" kind=pcq pcq-rate=0 pcq-classifier=src-address
/queue tree add parent=global queue=PCQ_download packet-mark=all_download max-limit=60M
/queue tree add parent=global queue=PCQ_upload packet-mark=all_upload max-limit=8M
 
User avatar
Bytezone
newbie
Posts: 41
Joined: Tue Jul 14, 2015 6:01 am

Re: Simple PCQ equal bandwidth shaping Upload counting as Download ; /

Fri Aug 12, 2016 8:06 pm

In the pre-routing chain, add a condition to the rule: in-interface=bridge-local, and change the packet mark from "all" to "upload"

Then copy the rule and change the mark from "upload" to "download" and change the in-interface from bridge-local to ether1-gateway
(or pppoe1-out if you're using pppoe)

Then change the upstream queue to use mark=upload
and change downstream queue to use mark=download

Excuse me ZeroByte beside your clarification, in case of controlling traffic for a specific website based on it's address list IPs ( i already have the address list named social )
Do i have to specify the src-address-list and dst-address-list respectively for both download and upload beside the in-interface for both rules ??
 
User avatar
ZeroByte
Forum Guru
Forum Guru
Posts: 4047
Joined: Wed May 11, 2011 6:08 pm

Re: Simple PCQ equal bandwidth shaping Upload counting as Download ; /

Fri Aug 12, 2016 8:35 pm

If you only want to queue to traffic to/from addresses in a list, then you can omit the interfaces and use only the address list.
 
User avatar
Bytezone
newbie
Posts: 41
Joined: Tue Jul 14, 2015 6:01 am

Re: Simple PCQ equal bandwidth shaping Upload counting as Download ; /

Sun Aug 14, 2016 2:33 pm

If you only want to queue to traffic to/from addresses in a list, then you can omit the interfaces and use only the address list.
Yup it's working :)
would you lead me to the next step if you don't mind because this has been discussed so many times but actually that what confused me !!
just looking at the mangle rules section below that does " Connection marking + packet marks + Traffic shape with queue tree " for client with ip address 10.100.3.252 :

...
/ip firewall mangle
"Mark download connection"
add action=mark-connection chain=forward dst-address=10.100.3.252 new-connection-mark=c_dn_client
add action=mark-packet chain=forward connection-mark=c_dn_client new-packet-mark=pkt_dn_client

"Mark upload connection"
add action=mark-connection chain=prerouting src-address=10.100.3.252 new-connection-mark=c_up_client
add action=mark-packet chain=prerouting connection-mark=c_up_client new-packet-mark=pkt_up_client passthrough=no

"Shaping the traffic based on the mangle rules for client 10.100.3.252"
/queue tree
add limit-at=800k max-limit=1800k name=Client_DN packet-mark=pkt_dn_client parent=global queue=default
add name=Client_UP packet-mark=pkt_up_client parent=global queue=default
...


Now this user has a dynamic simple queue created by hotspot with limits 180k/380k when logs in.
It's a per client bandwidth limitation but how can i exclude the mangle traffic + queue tree above from dynamic simple queue limitation ?

The mangle + queue tree looks simple no classifiers have been added for QoS purpose, but i wanna grasp the idea first of how to do it in the right way first :)
 
User avatar
ZeroByte
Forum Guru
Forum Guru
Posts: 4047
Joined: Wed May 11, 2011 6:08 pm

Re: Simple PCQ equal bandwidth shaping Upload counting as Download ; /

Mon Aug 15, 2016 4:41 pm

It's a per client bandwidth limitation but how can i exclude the mangle traffic + queue tree above from dynamic simple queue limitation ?
I don't think you can. The simple queue works independently of queue trees. The simple queues are targeted at the user's IP address, so they're going to hit 100% of the traffic that user generates. The only way to make a simple queue miss some of a user's traffic is by sending it through a different simple queue.

If it's possible to specify "! mark" on a simple queue (i.e. does not have this mark) and if there's a way to specify that behavior for dynamic per-user simple queues, then that's another way you could accomplish this goal. I'm not an expert in Mikrotik queueing, so I can't say for sure whether this is doable.

In general, a simple + tree queue scheme is used to do per-user-rate-limit + QoS - the simple queues just limit each user to their contract, and the queue trees give priority to important packets as they go out each particular interface. (regardless of WHOSE packets they are).
 
User avatar
Bytezone
newbie
Posts: 41
Joined: Tue Jul 14, 2015 6:01 am

Re: Simple PCQ equal bandwidth shaping Upload counting as Download ; /

Mon Aug 22, 2016 2:41 am


I don't think you can. The simple queue works independently of queue trees. The simple queues are targeted at the user's IP address, so they're going to hit 100% of the traffic that user generates. The only way to make a simple queue miss some of a user's traffic is by sending it through a different simple queue.
This is exactly what eventually i came with.. I created static simple queue to override the bandwidth limitation given by hotspot queues.. but i'm stuck at this point everything is working except how to do the static simple queue with packet marks marking download and upload based on src/dst-address-list. Kindly take a look at the final code i already made a post explaining it at this link http://forum.mikrotik.com/viewtopic.php?f=2&t=111343 .. man i really need your advice to complete my task :)