Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - What's the difference between pcq and HTB speed limits? Thank you.
What's the difference between pcq and HTB speed limits? Thank you.
I've sorted it out online before, so I'll give you a closer look.

Hierarchical token bucket HTB

HTB (Hierarchical Token Bucket) is a classful queuing rule that can be used to

Different processing methods are adopted for different types of traffic. Usually, we can only set.

One interface has one queue, but in RouterOS, the queue is connected to the main interface.

Hierarchical token bucket (HTB), so it has some attributes derived from it.

Parent queue. For example, we can set the maximum data rate for the workgroup.

Then distribute the traffic among the members of the workgroup.

HTB is a classical theory of traffic classification control. Usually, only one interface is controlled, but ROS uses HTB theory.

For example, you can first limit the traffic of a workgroup, and then subdivide the traffic again within that workgroup.

Each class in the hierarchy can prioritize and shape traffic. There are two main ones.

Parameters in RouterOS:

* guaranteed to a certain class of data rate limit (CIR)

* max-limit-the maximum data rate (MIR) allowed for a category.

Two main parameters:

Limit interest rate: stable interest rate

Maximum limit: maximum rate

* CIR (committed information rate)-guaranteed data rate. This means traffic.

Always deliver a rate that does not exceed this value.

* MIR (maximum information rate)-the maximum data rate that the router will provide.

CIR: guaranteed interest rate. It is always allowed not to exceed this ratio.

MIR: maximum rate

Depending on the data rate it consumes, each HTB class can be in one of three states:

Each HTB level has three states: green, yellow and red (queues in winbox can see icons in three colors).

* green-the actual rate is equal to or less than the limit-at level. In this state,

This class is attached to its own slot with the corresponding priority of its level, and is

Allow its restrictions to be met-at the time of restriction, regardless of its parent's restrictions.

Yes. For example, if we have a leaf class with limit-at=5 12000, and its parent class has

Max-limit = limit-at =128000, and this class will get its 5 12kbps!

Green: indicates that the current rate is less than or equal to the stable rate (limit value). In this state, the current level is controlled by itself and is not affected by it.

Superior level control. For example, if the stability rate set at a certain level is 5 12kbps, the stability rate of its superior level is set to

128kbps, then this level enjoys a rate of 5 12kbps in the green state.

* yellow-the level where the actual rate is greater than the limit value and equal to or less than the limit value.

Exceed the maximum limit. In this state, the class is attached to the.

The corresponding priority of its parent's internal feed, which in turn may be appended.

Internal slots of the same priority to their parents (in case the parents are also yellow),

Or its own level self slot with the same priority (if the parent is green). Above in

Transitioning to this state, the class is "disconnected" from the self-feedback of its level,

And "connected" to its parents' internal feed.

Yellow: the current batch rate is greater than the stable rate, but not greater than the maximum rate. In this state, the current level is controlled by its superior level (it

If the superior is also in the yellow state, continue this rule, that is, it is controlled by the superior of the superior).

* Red-Level A where the actual rate exceeds the maximum limit. This class can't borrow books.

The level from its parent class

Red: indicates that the current rate exceeds the maximum rate. This level cannot get any traffic from its superiors.

burst out

Burst rate

Bursts are used to allow higher data rates in a short time. Every second,

The router calculates the average data rate of each class in the last burst time.

Seconds If the average data rate is less than the burst threshold, the burst is enabled.

And the actual data rate reaches the burst limit bps, otherwise the actual data rate drops.

Reach the maximum limit or limit.

Burst rate is used for ultra-high speed data transmission in a short time. The router calculates the level of the previous burst time every second.

Average speed. If the average rate is lower than the set threshold (burst-threshold), the burst rate (burst-

Limit), otherwise it will be reduced to a stable rate or a maximum rate.

Suppose we have a setting in which the maximum limit =256000, the burst time =8, and the burst-

Threshold = 192000, burst limit =5 12000. When the user starts downloading

Through the HTTP file, we can observe the situation that the data is averaged at the beginning.

The rate for the past 8 seconds is 0bps, because before applying the queue rule.

Traffic was passed using this rule. Because this average data rate is less than the burst rate

Threshold (192kbps), allowing bursts. Average data rate after the first second.

Yes (0+0+0+0+0+0+512)/8 = 64 kbps, which is lower than burst-threshold. later

Seconds, the average data rate is (0+0+0+0+012+512)/8 =128kbps. After ...

When the average data rate becomes larger, the breakpoint is reached in the third second.

Rather than an outbreak threshold. At this point, the burst is disabled and the current data rate drops.

Reduce to the maximum limit (256kbps).

For example:

Suppose we set the maximum rate (max-limit) to 256k, the burst time to 8 seconds, the threshold to 192k, and the burst rate.

(Burst limit) is 5 12k. When users download files, they can observe:

The rate of 8 seconds before downloading is 0, which is less than the threshold of 192, so the burst rate of 5 12 is allowed;

After 1 s, the average rate in the first 8 seconds is 64 (0+0+0+0+0+512)/8 = 64, which is still less than the threshold of 192. Continue.

Use a burst rate of 5 12;

After 2 seconds, the average speed of the first 8 seconds is (0+0+0+512+512)/8 =128;

After 3 seconds, the average rate is calculated again as (0+0+0+512+512)/8 = 192, reaching the threshold192.

After 3 seconds, the user is no longer allowed to use the burst rate, and can only use the maximum allowable rate, that is, 256kbps.

Set the pulse rate up to 3 seconds.

Limit burst threshold maximum limit burst limit burst time

128 192 256 5 12 8s

128 384k 5 12 2048 16s

Mss and MTU, 2008-03-03 23: 53, say a word first. .

What are MTU and MSS values set to?

Maximum transmission unit.

MSS: maximum segment size maximum segment size

PPPoE: PPP over Ethernet (transmitting PPP protocol over Ethernet)

==============================

PCQ speed limit is really a problem for some Internet cafes with insufficient bandwidth. Your Internet cafe must only have 15M optical fiber. If the PCQ speed limit is 2M (I think 2M is the maximum in Internet cafes with 100), the PCQ start setting is 14M, and the close setting is 6M! If a person downloads something with thunder. 15 when the internet cafe is full, PCQ will be opened, but once it is opened. Your network speed will drop below 6M, so PCQ will be turned off and on again, which will not only fail to achieve the effect of intelligent speed limit. It will also increase the burden on ROS! CPU usage. . So I always wanted to combine intelligence with ordinary speed limit, so that Thunder or other downloads would not trigger PCQ traffic, but in the end I failed! Inspired, I came up with a method that can speed limit both dynamically and statically! For example, it is also an Internet cafe with 15M optical fiber and 100 machines. I set the static setting to 3M. In this case, usually. If four people download things, only accounting for 12M, then there is 3M left, which is enough for other machines to play Q and online games!

But what if five people download it? What do we do? The bandwidth is almost 15M. Hehe, then other people who play online games will definitely get stuck!

Don't be afraid, my intelligence is set to be greater than 14M to trigger another script. The content of the script is probably to turn off the original static speed limit of 3M and turn on the static speed limit of1.5m. In this way, 1.5*5=7.5M, and people who play online games are basically stable at around 10M!

Then set a script. When the total traffic is less than 6M (even if not many people download it, the traffic will come down), then the static speed limit script of 1.5M will be automatically closed and the original 3M speed limit will be restarted!

This is basically the principle. Through this principle, the broadband utilization of Internet cafes will be more and more reasonable!

: for aaa from 1 to 254, do={/queue simple add name=(PC. $ AAA)dst-address =( 192. 168.0。 . $aaa) limit -at=500000/500000 Maximum limit =3000000/3000000}

/ip firewall is damaged.

add chain = pre routing action = mark-packet new-packet-mark = all-mark \

pass through = yes comment = " " disabled = no

/queue type

add name = " PCQ-up " kind = pcq pcq-rate = 1500000 pcq-limit = 50 \

Pcq- classifier = src- address pcq- total-limit =2000

Add name = "PCQ- Tang" kind = pcq pcq-rate =1500000 pcq-limit = 50 \

Pcq- classifier = dst- address pcq- total-limit =2000

/simple queue

add name = " PCQ " target-addresses = 192. 168 . 0 . 0/24 dst-address = 0 . 0 . 0 . 0/0 \

Interface=all parent=none packet tag =all tag direction =both priority = 1 \

Queue =PCQ Upper Limit /PCQ Lower Limit -at=0/0 Maximum Limit =15000000/15000000 \

Total-queue = default-small disabled = yes.

/system script

add name = " PCQON " source = ":if \(\[/queue sim get \[/queue sim find \

name = \ " PCQ \ " \]disable \]= true \)do = {/queue sim enable PCQ } " \

Policy =ftp, restart, read, write, policy, test, winbox, password.

add name = " PCQOFF " source = ":if \(\[/queue sim get \[/queue sim find \

Name = \ "pcq \" \] disable \] = false \) do = {/queuesim disables PCQ}" \

Policy =ftp, restart, read, write, policy, test, winbox, password.

/Tool Flow-Monitor

add name = " PCQON " interface = WAN traffic = received trigger = above \

threshold = 14800000 on-event = PCQON comment = " " disabled = no

add name = " PCQOFF " interface = WAN traffic = received trigger = below \

threshold = 5000000 on-event = PCQOFF comment = " " disabled = no

==================================================

The above is a complete script, just copy each paragraph directly. The following instructions need to be modified!

The following are comments:

Take 15M as an example, the static state is 3M, and when it reaches 14.8M, the dynamic state is 1.5M!

: for aaa from 1 to 254, do={/queue simple add name=(PC. $ AAA)dst-address =( 192. 168.0。 . $aaa) limit -at=500000/500000 Maximum limit =3000000/3000000}

This is to establish a static speed limit, and change 1 to 254 IP of your intranet! Such as 2 to 120! 192. 168.0. Replace this with your IP segment! Limit-at = 500,000/500,000 is the average network speed of 500K, and max-limit = 300 million/3 million is the ordinary speed limit of 3M!

/ip firewall is damaged.

add chain = pre routing action = mark-packet new-packet-mark = all-mark \

pass through = yes comment = " " disabled = no

This is a fixed script!

/queue type

add name = " PCQ-up " kind = pcq pcq-rate = 1500000 pcq-limit = 50 \

Pcq- classifier = src- address pcq- total-limit =2000

Add name = "PCQ- Tang" kind = pcq pcq-rate =1500000 pcq-limit = 50 \

Pcq- classifier = dst- address pcq- total-limit =2000

Here, change 1500000 to the whole network upload speed and download speed when the speed is dynamically limited! Don't change anything else! This is 1.5M!

/simple queue

add name = " PCQ " target-addresses = 192. 168 . 0 . 0/24 dst-address = 0 . 0 . 0 . 0/0 \

Interface=all parent=none packet tag =all tag direction =both priority = 1 \

Queue =PCQ Upper Limit /PCQ Lower Limit -at=0/0 Maximum Limit =15000000/15000000 \

Total-queue = default-small disabled = yes.

The following is the strategy of establishing dynamic speed limit! Replace 192. 168.0.0/24 with your IP segment! Max-limit =1500000/15000000 This is your total broadband. Fill in as much as the telecom gives you! Don't change anything else, because you need to jump to the top

/system script

add name = " PCQON " source = ":if \(\[/queue sim get \[/queue sim find \

name = \ " PCQ \ " \]disable \]= true \)do = {/queue sim enable PCQ } " \

Policy =ftp, restart, read, write, policy, test, winbox, password.

add name = " PCQOFF " source = ":if \(\[/queue sim get \[/queue sim find \

Name = \ "pcq \" \] disable \] = false \) do = {/queuesim disables PCQ}" \

Policy =ftp, restart, read, write, policy, test, winbox, password.

This is an inspirational script, that is, a script that inspires dynamics and closes dynamics! Copy directly!

/Tool Flow-Monitor

add name = " PCQON " interface = WAN traffic = received trigger = above \

threshold = 14800000 on-event = PCQON comment = " " disabled = no

add name = " PCQOFF " interface = WAN traffic = received trigger = below \

threshold = 5000000 on-event = PCQOFF comment = " " disabled = no

This is traffic monitoring, and I have 14.8M inspired 15M setting, which is enough. There will be no delay or anything, and it is not recommended to change too little. Threshold=5000000 is to turn off the dynamic when it is less than 5M! Master this yourself! Try more!

Another note is! Interface=WAN Change the WAN into the network card of your external network!

Every paragraph above is necessary, and no paragraph in this script is incomplete! Otherwise it won't work. Don't talk about me!

It's time to inspire the script, just change the last paragraph and it's OK!

======================================================

/system scheduler add name = time on interval = 24h start-time = 08:00:00 on-event = { PCQON } disabled = no

/system scheduler add name = time off interval = 24h start-time = 23:59:59 on-event = { PCQOFF } disabled = no

==============================================================

Change the last paragraph to this one, and the time period will control the switch PCQ!