Download - Mikrotik router os qos best practice
![Page 1: Mikrotik router os qos best practice](https://reader031.vdocuments.net/reader031/viewer/2022013110/5462b3f0b4af9f671c8b4903/html5/thumbnails/1.jpg)
© MikroTik 2008
M ik r o T i k R o u t e rO S W o r k s h o pQ o S B e s t P r a c t i c e
Chicago,ILMUM USA 2008
![Page 2: Mikrotik router os qos best practice](https://reader031.vdocuments.net/reader031/viewer/2022013110/5462b3f0b4af9f671c8b4903/html5/thumbnails/2.jpg)
© MikroTik 2008 2
PlanDiscuss best QoS practice for
Large scale user speed limitationsPrioritization of traffic based on traffic type
Implement best practice
You will be able to follow the progress – just connect to SSID “QoS” and open up the Winbox to address 10.1.1.254 (default user name and password)
![Page 3: Mikrotik router os qos best practice](https://reader031.vdocuments.net/reader031/viewer/2022013110/5462b3f0b4af9f671c8b4903/html5/thumbnails/3.jpg)
© MikroTik 2008 3
User Limitation
~40 Mbps
T3/E3 line
●You have more than 400 clients●Task:●Divide clients into 3 groups
● Business (4Mbps/1Mbps) connection
● Standard (750kbps/250kbps) connection
● Basic (375kbps/125kbps) connection
![Page 4: Mikrotik router os qos best practice](https://reader031.vdocuments.net/reader031/viewer/2022013110/5462b3f0b4af9f671c8b4903/html5/thumbnails/4.jpg)
© MikroTik 2008 4
Simple Queue For Each ClientEach simple queue creates 3 separate queues:
One in global-in (“direct” part)One in Global-out (“reverse” part)One in Global-total (“total” part)
Simple queues are ordered - similar to firewall rules
further down = longer packet processingfurther down = smaller chance to get traffic
(necessary to reduce number of queues)
![Page 5: Mikrotik router os qos best practice](https://reader031.vdocuments.net/reader031/viewer/2022013110/5462b3f0b4af9f671c8b4903/html5/thumbnails/5.jpg)
© MikroTik 2008 5
Possible SolutionsRouterOS have 4 queue types:
FIFO – First In First Out (for Bytes or for Packets)RED – Random Early Detect (or Drop)SFQ – Stochastic Fairness Queuing PCQ – Per Connection Queuing (MikroTik Proprietary)
Firewall Mangle and Address-listsQueue Tree
![Page 6: Mikrotik router os qos best practice](https://reader031.vdocuments.net/reader031/viewer/2022013110/5462b3f0b4af9f671c8b4903/html5/thumbnails/6.jpg)
© MikroTik 2008 6
Default Queue Types
![Page 7: Mikrotik router os qos best practice](https://reader031.vdocuments.net/reader031/viewer/2022013110/5462b3f0b4af9f671c8b4903/html5/thumbnails/7.jpg)
© MikroTik 2008 7
![Page 8: Mikrotik router os qos best practice](https://reader031.vdocuments.net/reader031/viewer/2022013110/5462b3f0b4af9f671c8b4903/html5/thumbnails/8.jpg)
© MikroTik 2008 8
![Page 9: Mikrotik router os qos best practice](https://reader031.vdocuments.net/reader031/viewer/2022013110/5462b3f0b4af9f671c8b4903/html5/thumbnails/9.jpg)
© MikroTik 2008 9
SFQBehaviour:
Based on hash value from source and destination address SFQ divides traffic into 1024 sub-streams
Then Round Robin algorithm will distribute equal amount of traffic to each sub-stream
![Page 10: Mikrotik router os qos best practice](https://reader031.vdocuments.net/reader031/viewer/2022013110/5462b3f0b4af9f671c8b4903/html5/thumbnails/10.jpg)
© MikroTik 2008 10
![Page 11: Mikrotik router os qos best practice](https://reader031.vdocuments.net/reader031/viewer/2022013110/5462b3f0b4af9f671c8b4903/html5/thumbnails/11.jpg)
© MikroTik 2008 11
PCQBehaviour:
Based on classifier PCQ divides traffic into sub-streams. Each sub-stream can be considered as FIFO queue with queue size specified by “limit” option
After this PCQ can be considered as FIFO queue where queue size is specified by “total-limit” option.
![Page 12: Mikrotik router os qos best practice](https://reader031.vdocuments.net/reader031/viewer/2022013110/5462b3f0b4af9f671c8b4903/html5/thumbnails/12.jpg)
© MikroTik 2008 12
![Page 13: Mikrotik router os qos best practice](https://reader031.vdocuments.net/reader031/viewer/2022013110/5462b3f0b4af9f671c8b4903/html5/thumbnails/13.jpg)
© MikroTik 2008 13
![Page 14: Mikrotik router os qos best practice](https://reader031.vdocuments.net/reader031/viewer/2022013110/5462b3f0b4af9f671c8b4903/html5/thumbnails/14.jpg)
© MikroTik 2008 14
![Page 15: Mikrotik router os qos best practice](https://reader031.vdocuments.net/reader031/viewer/2022013110/5462b3f0b4af9f671c8b4903/html5/thumbnails/15.jpg)
© MikroTik 2008 15
PlanCreate an address list for client classes Use “connection-mark” (mangle) feature to classify all connections based on client classUse “packet-mark” (mangle) feature to classify all traffic based on client classCreate a PCQ queue for each client class with rate option specified
...what about user-user communications???
...what about unmarked traffic ?
![Page 16: Mikrotik router os qos best practice](https://reader031.vdocuments.net/reader031/viewer/2022013110/5462b3f0b4af9f671c8b4903/html5/thumbnails/16.jpg)
© MikroTik 2008 16
Address Lists
![Page 17: Mikrotik router os qos best practice](https://reader031.vdocuments.net/reader031/viewer/2022013110/5462b3f0b4af9f671c8b4903/html5/thumbnails/17.jpg)
© MikroTik 2008 17
Where?There are 5 places to mangleThere are 4 places to limit
![Page 18: Mikrotik router os qos best practice](https://reader031.vdocuments.net/reader031/viewer/2022013110/5462b3f0b4af9f671c8b4903/html5/thumbnails/18.jpg)
© MikroTik 2008 18
Connection-mark rule
![Page 19: Mikrotik router os qos best practice](https://reader031.vdocuments.net/reader031/viewer/2022013110/5462b3f0b4af9f671c8b4903/html5/thumbnails/19.jpg)
© MikroTik 2008 19
Packet-mark rule
![Page 20: Mikrotik router os qos best practice](https://reader031.vdocuments.net/reader031/viewer/2022013110/5462b3f0b4af9f671c8b4903/html5/thumbnails/20.jpg)
© MikroTik 2008 20
Working Mangle- Winbox view
![Page 21: Mikrotik router os qos best practice](https://reader031.vdocuments.net/reader031/viewer/2022013110/5462b3f0b4af9f671c8b4903/html5/thumbnails/21.jpg)
© MikroTik 2008 21
Working Mangle- Export view
![Page 22: Mikrotik router os qos best practice](https://reader031.vdocuments.net/reader031/viewer/2022013110/5462b3f0b4af9f671c8b4903/html5/thumbnails/22.jpg)
© MikroTik 2008 22
Queuing PlacementLimitation for in mangle chain “forward” marked traffic can be placed in the “global-out” or interface queueIf queues will be placed in the interface queues
queues on the public interface will capture only client upload queues on the local interface will capture only client's download
If queues will be placed in global-out download and upload will be limited together (separate marks needed)
![Page 23: Mikrotik router os qos best practice](https://reader031.vdocuments.net/reader031/viewer/2022013110/5462b3f0b4af9f671c8b4903/html5/thumbnails/23.jpg)
© MikroTik 2008 23
PCQ Types – Winbox View
![Page 24: Mikrotik router os qos best practice](https://reader031.vdocuments.net/reader031/viewer/2022013110/5462b3f0b4af9f671c8b4903/html5/thumbnails/24.jpg)
© MikroTik 2008 24
Queue Tree – Winbox View
![Page 25: Mikrotik router os qos best practice](https://reader031.vdocuments.net/reader031/viewer/2022013110/5462b3f0b4af9f671c8b4903/html5/thumbnails/25.jpg)
© MikroTik 2008 25
Queue Tree – Export View
![Page 26: Mikrotik router os qos best practice](https://reader031.vdocuments.net/reader031/viewer/2022013110/5462b3f0b4af9f671c8b4903/html5/thumbnails/26.jpg)
© MikroTik 2008 26
PCQ Queue Size
Total_limit = X can take up toX*(2000 bytes + 200 bytes) of RAM
2000 bytes – buffer for 1 packet 200 bytes – service data for 1 packet
total_limit = 2000 =< 4,2MB RAMtotal_limit = 5000 =< 10,5MB RAM
It can take only 40 users to fill the queue
(because total_limit/limit = 2000/50 = 40)
It is necessary to increase “total_limit” or (and) decrease the “limit” valueThere must be at least 10-20 packet places in queue available per user
![Page 27: Mikrotik router os qos best practice](https://reader031.vdocuments.net/reader031/viewer/2022013110/5462b3f0b4af9f671c8b4903/html5/thumbnails/27.jpg)
© MikroTik 2008 27
PCQ AdjustmentsThere are ~340 Basic class clients so:
pcq_limit = 40 pcq_total_limit = 7000 ( ~20*340) (~15MB)
There are ~40 Standard class clients so: pcq_limit = 30 pcq_total_limit = 1000 ( ~20*40) (~2MB)
There are ~20 Business class clients so: pcq_limit = 20 (!!!) pcq_total_limit = 500 ( ~20*20) (~1MB)
![Page 28: Mikrotik router os qos best practice](https://reader031.vdocuments.net/reader031/viewer/2022013110/5462b3f0b4af9f671c8b4903/html5/thumbnails/28.jpg)
© MikroTik 2008 28
Traffic Prioritization
Business Class Clients
Standard Class Clients
Basic Class Clients
~40 MbpsT3/E3 line
You have problems with on-line communications (video, audio, VOIP, games)
Task:Make necessary traffic prioritization
~5Mbps abroad
![Page 29: Mikrotik router os qos best practice](https://reader031.vdocuments.net/reader031/viewer/2022013110/5462b3f0b4af9f671c8b4903/html5/thumbnails/29.jpg)
© MikroTik 2008 29
Prioritization plan
![Page 30: Mikrotik router os qos best practice](https://reader031.vdocuments.net/reader031/viewer/2022013110/5462b3f0b4af9f671c8b4903/html5/thumbnails/30.jpg)
© MikroTik 2008 30
Where?There are 5 places to mangleThere are 4 places to limit
![Page 31: Mikrotik router os qos best practice](https://reader031.vdocuments.net/reader031/viewer/2022013110/5462b3f0b4af9f671c8b4903/html5/thumbnails/31.jpg)
© MikroTik 2008 31
How?
![Page 32: Mikrotik router os qos best practice](https://reader031.vdocuments.net/reader031/viewer/2022013110/5462b3f0b4af9f671c8b4903/html5/thumbnails/32.jpg)
© MikroTik 2008 32
PrioritiesCreate packet marks in the mangle chain “Prerouting” for traffic prioritization in the global-in queue
Ensign_services (Priority=1)User_requests (Priority=3)Communication_services (Priority=5)Download_services (Priority=7)P2P_services (Priority=8)