Community discussions

MikroTik App
 
zhup
Member Candidate
Member Candidate
Topic Author
Posts: 112
Joined: Thu Dec 03, 2015 10:10 pm

Equal bandwidth sharing among users - how to change the queue

Mon Dec 14, 2015 10:35 pm

Hello,

How to adapt the queue below to work with two network: 192.168.88.0/24 and 192.168.89/24?
/ip firewall mangle add chain=forward src-address=192.168.88.0/24 \
   action=mark-connection new-connection-mark=users-con
/ip firewall mangle add connection-mark=users-con action=mark-packet \
   new-packet-mark=users chain=forward
Thank you in advance.
 
User avatar
chechito
Forum Guru
Forum Guru
Posts: 3007
Joined: Sun Aug 24, 2014 3:14 am
Location: Bogota Colombia
Contact:

Re: Equal bandwidth sharing among users - how to change the queue

Mon Dec 14, 2015 10:50 pm

change 192.168.88.0/24 by 192.168.88.0/23
 
User avatar
ZeroByte
Forum Guru
Forum Guru
Posts: 4047
Joined: Wed May 11, 2011 6:08 pm

Re: Equal bandwidth sharing among users - how to change the queue

Mon Dec 14, 2015 11:22 pm

How to adapt the queue below to work with two network: 192.168.88.0/24 and 192.168.89/24?
I suppose you mean that you want to make this one marking rule apply the same mark to packets from both the 88 and 89 networks, so they'll have to share the same queue / policy elsewhere?

Easy way:
change 192.168.88.0/24 in the connection mark rule to be 192.168.88.0/23
(change the 24 to a 23)

Easily-scalable way:
change src-address=192.168.88.0/24 to be: src-address-list=LAN Networks

Then create the two networks as addresses in the address-list:
/ip firewall address-list
add list="LAN Networks" address=192.168.88.0/24
add list="LAN Networks" address=192.168.89.0/24

Any time you want to put more networks in the same policy - just add them to this list.
Furthermore, you may want to go to your filter and NAT rules and change src-address=192.168.88.0/24 to use the src-address-list just like in Mangle. Of course, this means that the two networks will get the same policy, etc. If you want them to have different filter rules, then you may not want to make the filter rules use the address list.

Good luck
 
zhup
Member Candidate
Member Candidate
Topic Author
Posts: 112
Joined: Thu Dec 03, 2015 10:10 pm

Re: Equal bandwidth sharing among users - how to change the queue

Tue Dec 15, 2015 8:37 pm

@chechito - thank you.
@ZeroByte - thank you for detailed explanation.

Now I meet the following problem:
[admin@MikroTik] > /queue tree add name=Download parent=Local max-limit=46080000
input does not match any value of parent
The whole rules:
/ip firewall mangle add chain=forward src-address=192.168.88.0/23 \
   action=mark-connection new-connection-mark=users-con
/ip firewall mangle add connection-mark=users-con action=mark-packet \
   new-packet-mark=users chain=forward

/queue type add name=pcq-download kind=pcq pcq-classifier=dst-address
/queue type add name=pcq-upload kind=pcq pcq-classifier=src-address

/queue tree add name=Download parent=Local max-limit=46080000
/queue tree add parent=Download queue=pcq-download packet-mark=users

/queue tree add name=Upload parent=Public max-limit=4915200
/queue tree add parent=Upload queue=pcq-upload packet-mark=users
Thank you in advance.
 
User avatar
ZeroByte
Forum Guru
Forum Guru
Posts: 4047
Joined: Wed May 11, 2011 6:08 pm

Re: Equal bandwidth sharing among users - how to change the queue

Tue Dec 15, 2015 10:04 pm

Thank you in advance.
You can't do it that way. Queue tree only works for the output packets of a particular interface.
(think of a nozzle on a garden hose - water only goes through it one way)

The 'parent' of a queue tree queue is the "faucet"

So - Local should be the name of the interface that faces the users.
To limit upstream bandwidth, you'd need to put a queue on the WAN interface.

The child queues will indeed use the parent queue as their source of "bandwidth points" - and then they will match the packet marks to determine which actual packets belong to which child queue.

Make sure that you have another packet marking rule that marks packets as default, because unmarked packets will not go through your queue tree at all.

If you just want to slap a pcq in front of a couple of LANs, then I suggest using simple queue attached to the global HTB, and just match the IP addresses instead of using the mangle table to mark packets.
 
zhup
Member Candidate
Member Candidate
Topic Author
Posts: 112
Joined: Thu Dec 03, 2015 10:10 pm

Re: Equal bandwidth sharing among users - how to change the queue

Tue Dec 15, 2015 10:33 pm

I took these queues from http://www.mikrotik.com/testdocs/ros/2. ... p#6.54.6.3 (at the bottom of the page).
Image

So the WAN interface should be ether1-gateway, but what about the "user's" interface? There are few and I use wlan1, wlan2 and ethernet ports. How to handle it?

I would like to implement simple queues for equal bandwidth sharing among users, but unfortunately I am newbe.
 
User avatar
ZeroByte
Forum Guru
Forum Guru
Posts: 4047
Joined: Wed May 11, 2011 6:08 pm

Re: Equal bandwidth sharing among users - how to change the queue

Tue Dec 15, 2015 10:48 pm

I took these queues from http://www.mikrotik.com/testdocs/ros/2. ... p#6.54.6.3 (at the bottom of the page).
Wow - ROS 2.9 eh? That's a pretty old document.
(I wish Mikrotik had a good way to mark old content as "legacy" or "now there's a better way to do this"
No wonder you were using queue trees. I personally like queue trees, but they're a little more involved than you need for what you want.)

Well, since the users are split between bridge1-local and (I'm guessing) bridge2, queue trees definitely cannot give you what you truly want - all bandwidth from ether1-gateway available to any user on any interface if they are the only one using it at the time, but if 10 people are doing things, then they should each get ~1/10 the bandwidth.....

Try making a simple queue, make the target 192.168.88.0/23, in advanced set the queue types to your PCQ-upstream and PCQ-downstream queue types, and then edit the queue types' configurations to set the bandwidth constraints to be the way you like.

That should do what you want, and not require any packet marking in the mangle table, etc.
 
zhup
Member Candidate
Member Candidate
Topic Author
Posts: 112
Joined: Thu Dec 03, 2015 10:10 pm

Re: Equal bandwidth sharing among users - how to change the queue

Tue Dec 15, 2015 11:10 pm

...
Try making a simple queue, make the target 192.168.88.0/23, in advanced set the queue types to your PCQ-upstream and PCQ-downstream queue types, and then edit the queue types' configurations to set the bandwidth constraints to be the way you like. ...
Could you please give me the example?
 
User avatar
ZeroByte
Forum Guru
Forum Guru
Posts: 4047
Joined: Wed May 11, 2011 6:08 pm

Re: Equal bandwidth sharing among users - how to change the queue

Tue Dec 15, 2015 11:38 pm

...
Try making a simple queue, make the target 192.168.88.0/23, in advanced set the queue types to your PCQ-upstream and PCQ-downstream queue types, and then edit the queue types' configurations to set the bandwidth constraints to be the way you like. ...
Could you please give me the example?
It's that simple - that is the example.
/queue simple add name=queue1 queue=pcq-upload-default/pcq-download-default target=\
192.168.88.0/23

Then modify the values in pcq-upload-default and pcq-download-default under queue types.
 
zhup
Member Candidate
Member Candidate
Topic Author
Posts: 112
Joined: Thu Dec 03, 2015 10:10 pm

Re: Equal bandwidth sharing among users - how to change the queue

Wed Dec 16, 2015 4:32 pm

...
/queue simple add name=queue1 queue=pcq-upload-default/pcq-download-default target=\
192.168.88.0/23

Then modify the values in pcq-upload-default and pcq-download-default under queue types.
Are you sure that I should modify the values in queue types? I put for test the values less (in total limit cell) than my real download limit and it does't work. The download speed was not cut.
Image

Or maybe in simple quere?
Image
 
User avatar
ZeroByte
Forum Guru
Forum Guru
Posts: 4047
Joined: Wed May 11, 2011 6:08 pm

Re: Equal bandwidth sharing among users - how to change the queue

Wed Dec 16, 2015 4:50 pm

Are you using fast track? That skips queues.

According to this:
http://wiki.mikrotik.com/index.php?titl ... Q_Examples

and this:
http://wiki.mikrotik.com/wiki/Manual:Queues_-_PCQ

... you seem to be doing it right.

If you want to make sure the queue is even seeing the packets - take PCQ out of the equation for a moment and just set the queue type to ethernet default and put a limit of 1M on upload and download speeds. See if the queue is seeing any traffic then. If so, then it's the PCQ settings. If not, then the queue's not seeing the packets at all.
 
zhup
Member Candidate
Member Candidate
Topic Author
Posts: 112
Joined: Thu Dec 03, 2015 10:10 pm

Re: Equal bandwidth sharing among users - how to change the queue

Wed Dec 16, 2015 5:27 pm

Are you using fast track? That skips queues.
I do not know.
According to this:
http://wiki.mikrotik.com/index.php?titl ... Q_Examples

and this:
http://wiki.mikrotik.com/wiki/Manual:Queues_-_PCQ

... you seem to be doing it right.

If you want to make sure the queue is even seeing the packets - take PCQ out of the equation for a moment and just set the queue type to ethernet default and put a limit of 1M on upload and download speeds. See if the queue is seeing any traffic then. If so, then it's the PCQ settings. If not, then the queue's not seeing the packets at all.
So should I only modify the values in queue types - the "total limit"? and this simple quere will work - adapt the user brandwidth to the current situaction?
/queue simple add name=queue1 queue=pcq-upload-default/pcq-download-default target=\
192.168.88.0/23
 
User avatar
ZeroByte
Forum Guru
Forum Guru
Posts: 4047
Joined: Wed May 11, 2011 6:08 pm

Re: Equal bandwidth sharing among users - how to change the queue

Wed Dec 16, 2015 5:41 pm

Are you using fast track? That skips queues.
I do not know.
Look in your firewall filter / mangle rules and see whether you have any rules with an action = fasttrack-connection
So should I only modify the values in queue types - the "total limit"? and this simple quere will work - adapt the user brandwidth to the current situaction?
/queue simple add name=queue1 queue=pcq-upload-default/pcq-download-default target=\
Yes. It really should be that simple.
 
zhup
Member Candidate
Member Candidate
Topic Author
Posts: 112
Joined: Thu Dec 03, 2015 10:10 pm

Re: Equal bandwidth sharing among users - how to change the queue

Wed Dec 16, 2015 9:03 pm

I only found as below. Has a significant impact? How to change it?
Image


What units should I use? Megabit per second or Bits per second?
 
User avatar
ZeroByte
Forum Guru
Forum Guru
Posts: 4047
Joined: Wed May 11, 2011 6:08 pm

Re: Equal bandwidth sharing among users - how to change the queue

Wed Dec 16, 2015 10:07 pm

I only found as below. Has a significant impact? How to change it?
Disable the rule entirely.

As for the queue units, I think you can specify:
128k 4m etc.... and it's all bits per second / megabits per second / etc....
(no bytes)
 
zhup
Member Candidate
Member Candidate
Topic Author
Posts: 112
Joined: Thu Dec 03, 2015 10:10 pm

Re: Equal bandwidth sharing among users - how to change the queue

Wed Dec 16, 2015 10:35 pm

It doesn't work if the limit is in the queue types - Total limit in pcq-download-default and pcq-uploud-default.

The limit only works in simple queue - queue1 (Max limit). But I am not sure if it will adapt the users brandwidth to the current situaction.
 
User avatar
ZeroByte
Forum Guru
Forum Guru
Posts: 4047
Joined: Wed May 11, 2011 6:08 pm

Re: Equal bandwidth sharing among users - how to change the queue

Wed Dec 16, 2015 10:58 pm

Just so I'm certain - you did disable rule 4, right?

Does the queue show any traffic in the statistics tab?
 
zhup
Member Candidate
Member Candidate
Topic Author
Posts: 112
Joined: Thu Dec 03, 2015 10:10 pm

Re: Equal bandwidth sharing among users - how to change the queue

Wed Dec 16, 2015 11:05 pm

Just so I'm certain - you did disable rule 4, right?

Does the queue show any traffic in the statistics tab?
Rule 4 is off.
Queue1 is showing the statistics.
 
User avatar
ZeroByte
Forum Guru
Forum Guru
Posts: 4047
Joined: Wed May 11, 2011 6:08 pm

Re: Equal bandwidth sharing among users - how to change the queue

Wed Dec 16, 2015 11:49 pm

Just so I'm certain - you did disable rule 4, right?

Does the queue show any traffic in the statistics tab?
Rule 4 is off.
Queue1 is showing the statistics.

It looks like you should leave the Limit and Total Limit set to defaults - the queue type is where you would set the sub-stream's burst capabilities, etc... but I think the master queue limit is going to be set on the queue itself (max limit)

So on the master queue, set max limit for target upload and download, and then watch the statistics on your queue - you'll start seeing the number of streams increase as hosts access the network.

So with those settings, it should "just work."

If you want to verify, you could lab it up with a mikrotik and a btest server:

You should get a few btests going side by side- set them to run at ~80% of the full queue bandwidth. Run them one at a time and verify that each one is capable of receiving the individual rate. Turn off the queue and make sure the network and btest server are capable of delivering full capacity to 3 clients at once.

Once your baseline is set, run all 3 with a standard fifo queue set to your chosen limit and watch the behavior of the 3 btest sessions. Then change the queue type to PCQ and re-test and observe the behavior. If all 3 are about to get roughly the same bandwidth, and smoothly, then you have confirmed it's working.
 
zhup
Member Candidate
Member Candidate
Topic Author
Posts: 112
Joined: Thu Dec 03, 2015 10:10 pm

Re: Equal bandwidth sharing among users - how to change the queue

Fri Dec 18, 2015 9:10 pm

@ZeroByte - I almost forget to thank you for help and a lot of knowledge, and for your time.

On the weekend I will do some queue bandwidth tests.
Now I have again problem with second dhcp server.

Who is online

Users browsing this forum: broderick and 58 guests