MikroTik Queues refer to traffic management mechanisms that help control and prioritize network traffic. They play a vital role in implementing Quality of Service (QoS) by ensuring fair bandwidth distribution, reducing latency, and managing congestion during peak usage.
Queues work by organizing network packets into specific “lines” or “queues” and processing them based on predefined rules. This ensures that critical traffic, such as VoIP or video calls, is prioritized over less important traffic like file downloads.
For an example configuration for a PCQ click here
Types of MikroTik Queues
- FIFO (First In, First Out):
- Simple queue mechanism that processes packets in the order they arrive.
- Suitable for basic traffic management but lacks prioritization features.
- PCQ (Per Connection Queue):
- Advanced queue type designed to dynamically manage multiple connections with minimal configuration.
- Automatically creates sub-queues for each connection, ensuring fair bandwidth distribution.
- Commonly used by ISPs and network administrators to allocate bandwidth equally among users or devices.
Understanding PCQ
PCQ simplifies QoS by handling numerous users or streams with a single queue type. Instead of manually configuring individual queues for each connection, PCQ dynamically creates and manages them using classifiers.
Key Features of PCQ:
- Dynamic Sub-Queue Creation:
- Each user or connection gets its own sub-queue without manual intervention.
- Example: 100 users downloading files would result in 100 sub-queues.
- Classification:
- Determines how packets are grouped into sub-queues.
- Common classifiers include:
- IP-Based: Divides traffic by source or destination IP.
- Port-Based: Divides traffic by source or destination port.
- Bandwidth Limiting:
- Enforces maximum bandwidth limits (e.g., 1 Mbps per user) on each sub-queue.
- Configurable using
pcq-rate
.
- Burst Support:
- Allows temporary bandwidth spikes for sub-streams when excess bandwidth is available.
IP-Based vs. Port-Based Classification
1. IP-Based Classification:
- Groups traffic by IP address.
- Useful when you want to allocate bandwidth to individual users or devices.
- Example:
- A network with multiple users (each having a unique IP address) will have traffic classified per user.
- Setting
pcq-classifier=src-address
ensures each source IP gets its bandwidth allocation.
2. Port-Based Classification:
- Groups traffic by port number (source or destination).
- Commonly used when managing specific types of traffic, such as HTTP (port 80) or HTTPS (port 443).
- Example:
- If you want to prioritize gaming traffic, you could classify traffic by known gaming ports using
pcq-classifier=src-port
.
- If you want to prioritize gaming traffic, you could classify traffic by known gaming ports using
Comparison:
Feature | IP-Based | Port-Based |
---|---|---|
Use Case | Manage bandwidth per user/device | Manage traffic by application type |
Classifier | src-address , dst-address | src-port , dst-port |
Granularity | Individual IPs | Specific traffic flows |
When to Use PCQ
- Equal Bandwidth Allocation:
- Example: An office network where each user gets 2 Mbps download and 1 Mbps upload.
- Dynamic Traffic Shaping:
- Automatically adjusts to the number of users or connections without requiring constant configuration.
- Prioritizing Traffic Types:
- Combine with mangle rules to classify traffic by type and allocate resources accordingly.
For further details, refer to the official MikroTik documentation on PCQ Examples