Quality of Service
Yaser Rahmati | یاسر رحمتی
Quality of Service (QoS) is a set of techniques used to manage network traffic to reduce latency, jitter, and packet loss, ensuring a higher priority for critical applications. In MikroTik, QoS can be implemented using features like Queue Trees, Simple Queues, and HTB (Hierarchical Token Bucket).
1. Understanding QoS Concepts in MikroTik
Before diving into configuration, it’s important to understand some key concepts:
Bandwidth: The maximum rate at which data can be transferred over a network path.
Latency: The time it takes for data to travel from the source to the destination.
Jitter: The variation in packet arrival times.
Prioritization: Assigning different priorities to different types of traffic, ensuring critical traffic (like VoIP) gets higher priority over less critical traffic (like file downloads).
Queuing: Organizing traffic in queues to manage bandwidth and prioritize certain types of traffic.
2. QoS Features in MikroTik
Simple Queues: Used for managing bandwidth per IP address or per service. It’s easy to set up and useful for small networks.
Queue Trees: More advanced, allowing you to create multiple queues under a single parent, giving you fine-grained control over traffic prioritization and bandwidth allocation.
PCQ (Per Connection Queuing): Useful for managing bandwidth for multiple users or connections, providing equal bandwidth distribution.
3. Practical Example: Setting Up QoS in MikroTik
Scenario:
You want to implement QoS on your MikroTik router to prioritize VoIP traffic, ensuring it gets the bandwidth it needs, while limiting the bandwidth available to less critical services like file downloads.
Step 1: Identify Traffic
First, identify the types of traffic you want to prioritize. For this example:
VoIP Traffic: Use UDP and typically works on ports like 5060 (SIP) and 10000-20000 (RTP).
Web Browsing (HTTP/HTTPS): Uses TCP ports 80 and 443.
File Downloads: Use TCP and can be identified by ports like 20, 21 (FTP), or based on known download servers.
Step 2: Create Mangle Rules to Mark Traffic
Mangle rules in MikroTik are used to mark packets. These marks are then used in Queue Trees to prioritize traffic.
Open Winbox and Connect to Your Router.
Navigate to IP -> Firewall -> Mangle.
Rule 1: Mark VoIP Traffic
Chain:
prerouting
Protocol:
UDP
Dst. Port:
5060
Action:
mark-packet
New Packet Mark:
voip
Comment: "Mark VoIP traffic"
Steps:
Click on the "+" sign to add a new rule.
Set the Chain to
prerouting
.Set the Protocol to
UDP
.Set the Dst. Port to
5060
.Go to the Action tab, set Action to
mark-packet
, and name the new packet markvoip
.Add a comment and click OK.
Rule 2: Mark HTTP/HTTPS Traffic
Chain:
prerouting
Protocol:
TCP
Dst. Port:
80,443
Action:
mark-packet
New Packet Mark:
http
Comment: "Mark HTTP/HTTPS traffic"
Steps:
Click on the "+" sign to add a new rule.
Set the Chain to
prerouting
.Set the Protocol to
TCP
.Set the Dst. Port to
80,443
.Go to the Action tab, set Action to
mark-packet
, and name the new packet markhttp
.Add a comment and click OK.
Rule 3: Mark Other Traffic
For all other traffic, you can create a more general rule.
Chain:
prerouting
Action:
mark-packet
New Packet Mark:
other
Comment: "Mark other traffic"
Steps:
Click on the "+" sign to add a new rule.
Set the Chain to
prerouting
.Go to the Action tab, set Action to
mark-packet
, and name the new packet markother
.Add a comment and click OK.
Step 3: Create Queue Trees
Now that traffic is marked, you can create Queue Trees to allocate bandwidth and prioritize traffic.
Navigate to Queues -> Queue Tree.
Queue 1: Prioritize VoIP Traffic
Name:
VoIP
Parent:
global
Packet Mark:
voip
Priority:
1
(Highest priority)Max Limit:
2M
(2 Mbps)
Steps:
Click on the "+" sign to add a new queue.
Set the Name to
VoIP
.Set the Parent to
global
.Set the Packet Mark to
voip
.Set the Priority to
1
.Set the Max Limit to
2M
.Click OK.
Queue 2: Allocate Bandwidth for HTTP/HTTPS Traffic
Name:
HTTP
Parent:
global
Packet Mark:
http
Priority:
4
Max Limit:
5M
(5 Mbps)
Steps:
Click on the "+" sign to add a new queue.
Set the Name to
HTTP
.Set the Parent to
global
.Set the Packet Mark to
http
.Set the Priority to
4
.Set the Max Limit to
5M
.Click OK.
Queue 3: Limit Bandwidth for Other Traffic
Name:
Other
Parent:
global
Packet Mark:
other
Priority:
8
(Lowest priority)Max Limit:
1M
(1 Mbps)
Steps:
Click on the "+" sign to add a new queue.
Set the Name to
Other
.Set the Parent to
global
.Set the Packet Mark to
other
.Set the Priority to
8
.Set the Max Limit to
1M
.Click OK.
Step 4: Apply and Monitor
Ensure all your mangle rules and queue trees are active.
Monitor the traffic to ensure that VoIP traffic is prioritized, HTTP/HTTPS traffic is handled appropriately, and other traffic is limited as per the configuration.
4. Monitoring QoS
You can monitor the performance of your queues by going to the Queues section in Winbox. Here, you can see real-time data on how much bandwidth is being used by each queue and adjust the settings if necessary.
5. Advanced QoS Techniques
PCQ: If you need to distribute bandwidth equally among multiple users, consider using PCQ.
Burst: You can configure burst settings to allow temporary speed increases for users.
Dynamic Queues: If your network requires more dynamic handling of traffic, you can set up dynamic queues based on active connections.
Summary
Implementing QoS on a MikroTik router involves identifying the critical types of traffic, marking them using Mangle rules, and then using Queue Trees to prioritize and allocate bandwidth accordingly. This ensures that important services like VoIP receive the necessary bandwidth while less critical traffic is controlled to avoid congestion.
Keywords
MikroTik
, RouterOS
, RouterBOARD
, wireless networking
, ISP
, WISP
, networking equipment
, routers
, switches
, Cloud Core Router
, CCR
, SXT
, LTE integration
, 5G
, cybersecurity
, network security
, networking software
, networking hardware
, Latvia
, John Trully
, Arnis Riekstiņš
, MikroTik Academy
, MUM events
, network management
, hotspot
, VLAN
, firewall
, VPN
, QoS
, bandwidth management
, traffic shaping
, wireless access point
, CAPsMAN
, WinBox
, PoE
, mesh networking
, routing protocols
, MPLS
, OSPF
, BGP
, MikroTik training
میکروتیک
, روتر او اس
, روتر برد
, شبکه بیسیم
, آی اس پی
, وایرلس آی اس پی
, تجهیزات شبکه
, روترها
, سوییچها
, کلود کور روتر
, سی سی آر
, اس ایکس تی
, ادغام ال تی ای
, 5G
, امنیت سایبری
, امنیت شبکه
, نرمافزار شبکه
, سختافزار شبکه
, لتونی
, جان ترولی
, آرنیس ریکسینش
, آکادمی میکروتیک
, رویدادهای مام
, مدیریت شبکه
, هات اسپات
, ویلَن
, فایروال
, ویپیان
, کیواُاس
, مدیریت پهنای باند
, شکلدهی ترافیک
, نقطه دسترسی بیسیم
, کپزمن
, وینباکس
, پی او ای
, شبکه مش
, پروتکلهای مسیریابی
, ام پی ال اس
, اُ اس پی اف
, بی جی پی
, آموزش میکروتیک
External Links
🌐 Personal Website 📄 Resume 🎥 Video Archive 💼 Finance Blog 🔐 Network & Security Notebook 🎬 Aparat Channel
Last updated