动态(平均)分配流量
PCQ ExamplesFrom MikroTik WikiJump to: navigation, search
Per Connection Queue (PCQ) is a queuing discipline that can be used to dynamically equalize or shape traffic for multiple users, using little administration.
[edit] Equal Bandwidth for a Number of Users Use PCQ type queue when you need to equalize the bandwidth for a number of users. We will set the 64kbps download and 32kbps upload limits.
http://wiki.mikrotik.com/images/3/38/Fir.JPG
There are two ways how to make this: using mangle and queue trees, or, using simple queues.
1. Mark all packets with packet-mark all:
/ip firewall mangle add chain=prerouting action=mark-packet new-packet-mark=all passthrough=no
2. Setup two PCQ queue types - one for download and one for upload. dst-address is classifier for user's download traffic, src-address for upload traffic:
/queue type add name="PCQ_download" kind=pcq pcq-rate=64000 pcq-classifier=dst-address/queue type add name="PCQ_upload" kind=pcq pcq-rate=32000 pcq-classifier=src-address
3. Finally, two queue rules are required, one for download and one for upload:
/queue tree add parent=global-in queue=PCQ_download packet-mark=all/queue tree add parent=global-out queue=PCQ_upload packet-mark=allIf you don't like using mangle and queue trees, you can skip step 1, do step 2, and step 3 would be to create one simple queue as shown here:
/queue simple add queue=PCQ_upload/PCQ_download target-addresses=192.168.0.0/24That's it!!! PCQ的两种使用方法:
1、使用queue tree
/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=64000 pcq-classifier=dst-address
/queue type add name="PCQ_upload" kind=pcq pcq-rate=32000 pcq-classifier=src-address
/queue tree add parent=global-in queue=PCQ_download packet-mark=all
/queue tree add parent=global-out queue=PCQ_upload packet-mark=all
2、使用queue simple
/queue type add name="PCQ_download" kind=pcq pcq-rate=64000 pcq-classifier=dst-address
/queue type add name="PCQ_upload" kind=pcq pcq-rate=32000 pcq-classifier=src-address
/queue simple add queue=PCQ_upload/PCQ_download target-addresses=192.168.0.0/24
这两种方法成都网页上推荐的是第二种吧,有高手说说他们之间的区别吗? 我也概念不清淅,帮你顶顶 这个为什么说是动态分配啊。。看起来像是给某个网段固定速率的 PCQ是根据源地址或者目标地址来进行分组的一种限速,比如,限制上行带宽的时候,内网的IP地址就是所有数据包的源地址,这样,ROS就把所有要出去的数据包收集起来,按照源地址进行分组,比如有10个源地址,那就分10个组(翻译的时候应该叫队列),每个组的上行速度是相同的,所以就是平均分配带宽了!
至于动态的意思,就象上面举例的那样,这个时候是10个源地址,一共是100K的带宽,那大家分的10K的带宽,而下个时候只有5个源地址了,那就每家多分了10K,也就是20K的带宽了 若要动态,只要改成
/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 type add name="PCQ_download" kind=pcq pcq-classifier=dst-address
/queue type add name="PCQ_upload" kind=pcq pcq-classifier=src-address 看了眼晕,不知道什么时候能学会. 又1个抄书的人
页:
[1]