QOS Management in Mikrotik – Bandwidth Pools for Group of Users
As required by an Operator:
We are using Mikrotik Routerboard in lab environment, and have total 384kbps of internet bandwidth from the ISP.
Hotspot with User manager is already configured and working. (no static/dynamic queues are configured)
Requirements:
We want to distribute bandwidth as follows.
Group A = 192.168.10.1-192.168.10.255
Total Bandwidth Pool for Group A = 128 kb
Per User Allowed = 64 kb and xxx kb (but overall all users must not exceed the parent queue that is 128 kb)
Total Bandwidth Pool for Group A = 128 kb
Per User Allowed = 64 kb and xxx kb (but overall all users must not exceed the parent queue that is 128 kb)
Group B = 192.168.20.1-192.168.20.255
Total Bandwidth Pool for Group B = 256 kb
Per User Allowed = 64 k and 128 k for different profile users (but overall all users must not exceed the parent queue that is 256 kb)
Total Bandwidth Pool for Group B = 256 kb
Per User Allowed = 64 k and 128 k for different profile users (but overall all users must not exceed the parent queue that is 256 kb)
This way Group A should get per user bandwidth from the parent queue 128 kb all the time but overall all users must not exceed the parent queue that is 128 kb
and the Group B users should get 128 k per user from the parent queue 256 kb all the time but overall all users must not exceed the parent queue that is 256 kb
This is also a way to give guaranteed bandwidth to group of people. example you have 10mb of link, and want to provide dedicated 5 mb to a single or group of users, and rest of 5 mb to common subscriber. (I am talking in kbs because in lab i have smaller amount of bandwidth, and its easier to do repeated tests in smaller links)
Pseudo Code:
- Mark connections and then packets from the specific IP Pool
- Create PCQ queue in Queue Type (for per user classification)
- Create Bandwidth pool for Groups in Queue Tree (Parent)
- Create per user queue in parent groups for per user distribution for marked packets.
1- Mark connections from the specific IP Pool
For this guide, I am using my local pc’s for demonstration purposes. but you can use groups as showed above.
PC#1, Laptop PC,
PC#2, Zaib PC,
PC#3, Temporarily PC
1
2
3
4
5
6
7
8
9
10
| /ip firewall mangle add action=mark-connection chain=prerouting comment="LAPTOP pc marking connection" new-connection-mark=laptop_pc_conn src-address=101.11.16.159 add action=mark-packet chain=prerouting comment="LAPTOP pc marking packets" connection-mark=laptop_pc_conn new-packet-mark=laptop_pc_pkts add action=mark-connection chain=prerouting comment="zaib pc marking connection" new-connection-mark=zaib_pc_conn src-address=101.11.11.161 add action=mark-packet chain=prerouting comment="zaib PC Marking Packets" connection-mark=zaib_pc_conn new-packet-mark=zaib_pc_packets add action=mark-connection chain=prerouting comment="VM PC marking CONNECTIONS" new-connection-mark=TEMP_pc_conn src-address=101.11.14.19 add action=mark-packet chain=prerouting comment="VM PC Marking Packets" connection-mark=TEMP_pc_conn new-packet-mark=temp_pc_packets |
2- Create PCQ queue in Queue Type (for per user classification)
1
2
3
| /queue type add kind=pcq name=64k-per-user pcq-classifier=dst-address pcq-dst-address6-mask=64 pcq-rate=65536 pcq-src-address6-mask=64 add kind=pcq name=128k-per-user pcq-classifier=dst-address pcq-dst-address6-mask=64 pcq-rate=131072 pcq-src-address6-mask=64 |
3- Create Parent queues
1
2
3
| /queue tree add disabled=yes max-limit=256k name="256k TOTAL for Group B" parent=global queue=default add disabled=yes limit-at=128k max-limit=128k name="128k TOTAL for Group A" parent=global queue=default |
4- Create per user (or group) queue in parent groups for per user distribution for marked packets.
1
2
3
4
5
6
7
8
| /queue tree # Adding user bandwidth rule from 128k pool add name="TEMP PC - 64k - from 128k Pool" packet-mark=temp_pc_packets parent="128k TOTAL for Group A" queue=64k-per-user # Adding users bandwidth rule from 256k pool add name="ZAIB PC 64k - from 256k pool" packet-mark=zaib_pc_packets parent="256k TOTAL for GroupB" queue=64k-per-user add name="LAPTOP PC 128k - from 256k pool" packet-mark=laptop_pc_pkts parent="256k TOTAL for GroupB" queue=128k-per-user |
Watching rules in action
This post requires lot of time to explain things or add other items as well. will do it later.
Posting Komentar untuk "QOS Management in Mikrotik – Bandwidth Pools for Group of Users"