Pcq Upload Sa Simple Queue

There are a lot of articles on the Internet devoted to speed limits and traffic dividing on MikroTik equipment, just almost all of them consider only Queue Tree, which requires deep understanding and are redundant in many tasks and can exist replaced by Simple Queues.

Simplified queues - the mechanism of dividing the bandwidth of the aqueduct and prioritizing traffic associated with a specific goal (target). Incoming and outgoing traffic is calculated relative to the target.

At that place are 3 options for goals: ip, subnet, interface. Y'all can add multiple target for one rule.


Theoretical function


Shapers, Planners and Queues

The data transfer rate is measured in relation to the transmitted information in $.25 per 2d of time - bit / sec. Flake unit of measurement is small, then they apply prefixes kilo (kbit / sec), mega (Mbit / sec), giga (Gbit / sec).

The transmission rate of packets over communication networks is always equal to the transmission charge per unit of the medium (for instance, 100Mbit / sec for Ethernet 100BASE-TX). If it is necessary to reduce this speed, an intermediate device, such every bit a router, receiving packets from one interface at maximum speed sends them from the other with a certain delay, if the packets exceed the set speed limit, they are stored in the queue and sent as Offset In, First Out ( FIFO) if the queue is full (missing or has zero size), the router drops packets.

Limit - authoritative speed limit for outgoing traffic from the interface.
Shaper (Shaper) - a software algorithm that delays and discards unnecessary packets.
Scheduler (Sheduler) - an algorithm that decides how to shop and transport packets that get across the limit.
Queues - storage and prioritization algorithms for passing traffic.

Graphic examples of the piece of work of the shaper and the scheduler.

Using the shaper out of turn

Using the shaper with a scheduler


Simple Queues on Packet Flow

Elementary Queues come after Queues Tree, sometimes uncomplicated queues are used to apace limit traffic to one (or several) users, without interfering with Queues Tree.


Simplified Package Menstruum for those interested


The mechanics of the queues: none, pfifo, pcq

none - there is no queue; if the limit is exceeded, all new packets are discarded.

pfifo is a packet oriented fifo algorithm. Stores the number of packages specified in the settings. Used by default in Elementary Queues.

pcq (Per Connection Queuing) - all traffic is broken into sub-queues depending on a ready of weather condition. Part of the traffic is sent alternately from each sub-queue. The vacated space is occupied past the newly arrived traffic. If the place in the sub-queue ends, then the packets destined for it are discarded.

Consider a small role of the settings:
Rate : speed limit for each of the sub-queues.
Limit : sub-queue size in kilobytes.
Total limit : the total size of all sub-queues in kilobytes.
The ratio Limit / Total limit is selected based on the situation. By default, 40 queues (2000/50), discipline to their maximum filling traffic.
Flare-up : nigh him will be lower.
Classifier : based on what to divide traffic into queues.
Classifier to divide various connections by queues, if you enter [IP] -> [Firewall] -> [Connections], then it tin exist noted that nearly of the connections comprise the address and port of the sender (src. Address, src. Port) and recipient ( dst. address, dst. port).

We hash out uncomplicated queues, so for simplicity we volition assume that nosotros filter only traffic coming from the wan interface, in which case relative to target approachable (upload) traffic volition be classified past src. address, and incoming (download) by dst. address.

Classification by port will assist to avoid the state of affairs with blocking a queue of traffic from 1 application, if i awarding breeds many approachable connections (for instance, torrent or web browser with a bunch of tabs), and then they will have different src. port and traffic will also be divided into queues.


Dynamic PCQ Shaping

If the Charge per unit is set rigidly, then each sub-stream will take a specified speed and volition not exist able to exceed it until the total speed of all sub-streams exceeds the upper limit (in Elementary Queues this is Total Limit), in this case the speed of all sub-streams will decrease in proportion.

If Charge per unit is set as 0, then the college limit will be shared betwixt all sub-threads. In fact, this is dynamic shaping.

If Rate is set equally 0 and Total Limit is not specified for Simple Queues, then the speed betwixt sub-threads volition be divided based on the higher limit, if the queues are not nested, so this is the limit of the physical interface. If your tariff program is lower, then role of the traffic will be killed on the equipment of the provider and at that place will exist no do good from the queues.

The remaining types of queues (SFQ, RED) take their own features and applications, and they can be used including for Simple Queues, but now they are not of interest to u.s..


Package marking

Yeah, labeled traffic can exist used in unproblematic queues. This is non a mandatory condition (unlike the Queue Tree), only allows you lot to move abroad from the target restrictions.

Traffic marking occurs in [IP] -> [Firewall] -> [Mangle], there are three types of labels in total: Connection, Packet, Route. Each bundle can contain one tag of each type. Getting into the mangle, the package passes in plow co-ordinate to all the rules, if there are two lines that ready the label, and then the lower dominion will overwrite the label from the higher one. To foreclose overwriting, you tin can turn off the packet down the chain in the beginning rule ( passtrought=no).

When configuring queues, y'all can only use packet labels ( action=mark-bundle). Just to improve performance (connection labels are checked faster than examining the atmospheric condition in each of the packages) it is recommended to first marking the connections ( action=mark-connection), and so the packages in the connexion ( action=mark-bundle). The rule with pre-marking of connections is non always truthful, only if you have reached this understanding when edifice queues, then it's time for you lot to use Queue Tree.

You tin mark transit traffic in any of the Packet Catamenia chains, but in virtually cases I prefer to use forward, because at this phase, the recipient addresses with the sender and the names of the incoming and outgoing interfaces are known.


Traffic marking example


              /ip firewall mangle  add action=mark-connection chain=forward connexion-state=new dst-port=5060,10000-20000 new-connection-mark=output-sip-and-rtp passthrough=yes protocol=udp src-address=192.168.100.0/24 add action=mark-packet chain=forwards connection-mark=output-sip-and-rtp new-packet-marking=output-parcel-sip-and-rtp passthrough=no            

What is Burst

Usually, a speed limit refers to a certain static value of the limit per 2d upon reaching which packets are dropped or queued. Outburst operates with an average value per unit of time, this makes it possible to use higher (summit) speeds in brusque periods of fourth dimension and limits the speed at a constant load on the aqueduct.

Max Limit - the master limitation.
Outburst Limit - superlative speed, takes precedence over Max Limit, subject to the specified average speed.
Burst Threshold - speed limit.
Burst Time - time.

Target gets speed from Burst Limit, simply every 2nd the average speed for Burst time will exist calculated. If the average speed in a given time exceeds the Burst Threshold, then the user will be express to Max Limit, if the average speed returns to normal, and so the target will once more receive Flare-up Limit.


A practiced case of the piece of work of Burst

Dominion Burst:

The cake diagram showing the change in speed target:

And what the speed change for target looks like:

If you are interested in the topic of Burst, then I recommend reading the information on the wiki , there are graphs and tables based on which it will be meliorate understood how the Threshold and Fourth dimension values ​​touch the speed limit.


Difference Limit at and Max Limit

Limit at - guaranteed speed for the rule. It is desirable that the sum of all Limit at does non exceed the bandwidth of the channel. Always less than the maximum.
Max Limit - the maximum speed for the rule. If the "upkeep" queue allows, so the maximum bandwidth will be allocated.

Usually, only Max Limit is specified in simplified queues and it works normally, but in a configuration with cascading queues, both limits should exist specified.


Practical office

Elementary queues are configured in [Queues] -> [Simple Queues].
Rules are processed alternately from top to lesser, the offset matching rule is applied to the passing packet. In fact, from any rule you can brand an "exception" by placing a more specific dominion to a higher place.


Speed ​​limit for a specific host / subnet / interface

Unremarkably used when you need to slaughter the speed of a item user.
Name: any
Target proper noun : address, subnet, or interface.
Target Upload: outbound speed limit.
Targer Download: incoming speed limit.

Speed ​​limit to 1Mbit / sec:


          /queue simple add max-limit=1M/1M proper noun=Limit-For-100.200 queue=default/default target=192.168.100.200/32        

In Statistics, you can look at the current speed for the target, the number of packets in the queue and the number of dropped packets.


Speed ​​limit for remote resources

Option unlabeled packages.

In the dst field like target, the following can be specified: ip, subnet, interface. In the weather condition of the modern Internet this is not enough, merely it can be useful for small companies and speed limits between offices.


          /queue simple add dst=192.168.200.10/32 max-limit=10M/10M name=Limit-For-Fileserver target=192.168.100.0/24        

Equal division of the channel between members of the subnet (pcq)

One rule that volition save your domicile or office subnet from exclusive channel capture (in the example 50Mb / sec, fine-tune for your channel) past one user.

The specified pcq queues are present in the basic configuration, but I attach screenshots in example of changes.


          #Очереди /queue type add kind=pcq name=pcq-upload-default pcq-burst-rate=0 pcq-burst-threshold=0 pcq-burst-time=10s pcq-classifier=src-address pcq-dst-accost-mask=32 pcq-dst-address6-mask=128 pcq-limit=50KiB pcq-rate=0 pcq-src-address-mask=32 pcq-src-address6-mask=128 pcq-full-limit=2000KiB add kind=pcq name=pcq-download-default pcq-burst-rate=0 pcq-flare-up-threshold=0 pcq-outburst-time=10s pcq-classifier=dst-address pcq-dst-address-mask=32 pcq-dst-address6-mask=128 pcq-limit=50KiB pcq-rate=0 pcq-src-address-mask=32 pcq-src-address6-mask=128 pcq-total-limit=2000KiB #Правило Simple queues /queue uncomplicated add max-limit=50M/50M name=Limit-Equivalent queue=pcq-upload-default/pcq-download-default target=192.168.100.0/24        

On the Statistics tab, you tin can see how many pcq threads are currently in the queue.


Tagged traffic

The dst pick is quite limited and if yous desire to employ domain names or accost lists, y'all will have to resort to marking the traffic. For example, nosotros will cancel the restrictions for the yandex.ru domain (yes, a bunch of cdn'ok and other things are connected in that location and y'all will demand to add together them for normal operation).

In a contempo version, information technology was possible to add domain names to accost lists, mikrotik automatically resolves them and adds dynamic entries.

Traffic marking http / https (connection and packets in connexion) for the specified addresses:

Dominion in Uncomplicated Queue:


          #Заполнение списка адресов /ip firewall accost-list add address=yandex.ru list=ForQueues add accost=yastatic.net list=ForQueues #Маркировка соединений и пакетов /ip firewall mangle  add together action=mark-connection concatenation=forrad connexion-land=new dst-accost-list=ForQueues dst-port=lxxx,443 new-connection-mark=Mark-ForQueues passthrough=yes protocol=tcp src-address=192.168.100.0/24 add activity=mark-parcel chain=forward connexion-mark=Mark-ForQueues new-packet-mark=Marker-Packet-ForQueues passthrough=no #Правило в Simple Queue /queue elementary add max-limit=1M/1M proper noun=Limit-For-Yandex bundle-marks=Marking-Packet-ForQueues target=192.168.100.0/24        

Cascading queues

All that is said higher up relates to limiting and dividing the speed betwixt network participants, the fourth dimension has come to touch the topic of prioritizing traffic. It is usually required for interactive traffic (voip, vcs, ssh, rdp, ...) in a limited and loaded channel.

For cascading queues, the Parent parameter is responsible, which refers to the "parent" queue. To work, all traffic from the "child" queues must be captured past the parent.

The Priority parameter is responsible for what kind of traffic volition be previously added to the queue, information technology works only in kid queues (or in "parent" if they take no "child"), can take values ​​from 1 (highest priority) to 8 and has nothing mutual with QoS (DSCP; TOS) tags.

Traffic pre-marking:


          /ip firewall mangle add activity=marker-connection chain=frontwards connection-state=related,new dst-port=5060,10000-20000 in-interface=br-lan new-connection-marking=marking-conn-voip passthrough=yes protocol=udp add activeness=marking-packet chain=forward connectedness-mark=mark-conn-voip new-packet-mark=mark-pkg-voip passthrough=no add together action=marker-connexion chain=forward connection-state=new dst-port=eighty,443 in-interface=br-lan new-connection-marking=mark-conn-web passthrough=yes protocol=tcp        

Queue in SimpleQueue:


          /queue elementary add together limit-at=24M/24M max-limit=25M/25M name=main target=10.10.10.0/24 add limit-at=5M/5M max-limit=8M/8M name=voip packet-marks=mark-pkg-voip parent=main priority=1/1 queue=pcq-upload-default/pcq-download-default target="" add limit-at=10M/10M max-limit=20M/20M name=web packet-marks=mark-pkg-spider web parent=main priority=two/ii queue=pcq-upload-default/pcq-download-default target="" add limit-at=10M/10M max-limit=20M/20M name=other parcel-marks=mark-pkg-other parent=main priority=3/3 queue=pcq-upload-default/pcq-download-default target=""        

Now, if y'all demand to make a brake for one IP, merely put a rule in front of a cascade of queues.


Afterword

Uncomplicated Queues is a rather interesting and functional tool for home and SOHO configurations; by a single rule (without labeling traffic), you can solve the problem of capturing a aqueduct with 1 device. But, if y'all are using FastTrack, so forget nigh the queues - the traffic will pass past them.

For more complex configurations, there are Queues tree (HTB trees).

levinwhilks.blogspot.com

Source: https://sudonull.com/post/12537-Guide-on-Simple-Queues-in-Mikrotik

0 Response to "Pcq Upload Sa Simple Queue"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel