Mikrotik Advanced Bandwidth Management – A Complete Step-by-Step Guide
Introduction
Bandwidth management is one of the most important aspects of network administration, especially when dealing with multiple users, shared internet connections, and business-critical applications. Without proper control, a single user or application can consume excessive bandwidth, leading to poor performance for others. Mikrotik RouterOS offers powerful tools to manage, shape, and prioritize traffic efficiently. In this comprehensive guide, we will cover advanced bandwidth management techniques step-by-step, ensuring optimal usage across your network.
Why Bandwidth Management is Important
- Fair Usage: Prevents a single user from consuming all available bandwidth.
- Improved Performance: Ensures critical applications run smoothly.
- Cost Optimization: Helps avoid the need for unnecessary bandwidth upgrades.
- Better User Experience: Provides consistent internet speed to all users.
- Security & Control: Blocks unwanted services from consuming bandwidth.
Pre-Requisites
- Mikrotik Router (any model with sufficient RAM/CPU)
- Latest RouterOS firmware
- Winbox, WebFig, or SSH access
- Basic understanding of IP addressing
- Network topology diagram
Step 1 – Planning Your Bandwidth Allocation
Before configuring bandwidth management, it’s important to identify:
- Total available bandwidth from ISP (e.g., 100 Mbps download / 50 Mbps upload).
- Number of active users and devices.
- Priority applications (VoIP, video conferencing, ERP systems).
- Non-essential services to limit (e.g., YouTube, torrent downloads).
Step 2 – Basic Bandwidth Limiting Using Simple Queues
Simple queues are the easiest way to assign bandwidth limits to users or IP ranges.
/queue simple add name="User1" target=192.168.1.10/32 max-limit=5M/2M add name="User2" target=192.168.1.11/32 max-limit=3M/1M
This configuration limits User1 to 5 Mbps download and 2 Mbps upload, while User2 is restricted to 3 Mbps down and 1 Mbps up.
Step 3 – Advanced Bandwidth Shaping with Queue Tree
Queue Tree allows you to manage bandwidth hierarchically and is ideal for shared environments.
/queue tree add name="Download" parent=global max-limit=100M add name="Upload" parent=global max-limit=50M /queue tree add name="VoIP_Download" parent=Download max-limit=10M priority=1 add name="General_Download" parent=Download max-limit=90M priority=8 add name="VoIP_Upload" parent=Upload max-limit=5M priority=1 add name="General_Upload" parent=Upload max-limit=45M priority=8
Here, VoIP traffic is given the highest priority (priority=1), while general traffic is assigned a lower priority (priority=8).
Step 4 – Using PCQ (Per Connection Queue) for Fair Distribution
PCQ dynamically divides available bandwidth among active users.
/queue type add name="pcq-download" kind=pcq pcq-classifier=dst-address pcq-rate=2M add name="pcq-upload" kind=pcq pcq-classifier=src-address pcq-rate=1M /queue tree add name="pcq-download-users" parent=Download queue=pcq-download add name="pcq-upload-users" parent=Upload queue=pcq-upload
Each user gets an equal share of bandwidth automatically.
Step 5 – Bandwidth Prioritization with Mangle Rules
Mangle rules help you mark traffic for prioritization or shaping.
/ip firewall mangle add chain=prerouting protocol=udp port=5060,10000-20000 action=mark-connection new-connection-mark=voip_conn add chain=prerouting connection-mark=voip_conn action=mark-packet new-packet-mark=voip_pkt
These rules identify VoIP traffic and mark it for higher priority in the queue tree.
Step 6 – Blocking or Limiting Heavy Websites
For example, to limit YouTube to 1 Mbps per user:
/ip firewall layer7-protocol add name=youtube regexp="^.+(youtube.com|ytimg.com).*$" /queue simple add name="Limit YouTube" target=192.168.1.0/24 max-limit=1M/1M packet-marks=youtube
Step 7 – Time-Based Bandwidth Control
You can schedule bandwidth restrictions for peak hours.
/system scheduler add name="PeakHours" start-time=08:00:00 interval=1d on-event="/queue simple set [find name=User1] max-limit=2M/1M" /system scheduler add name="OffPeak" start-time=20:00:00 interval=1d on-event="/queue simple set [find name=User1] max-limit=5M/2M"
Step 8 – Monitoring Bandwidth Usage
- Use Winbox → Queues to view real-time bandwidth per user.
- Use /tool graphing for graphical bandwidth monitoring.
- Export logs for long-term analysis.
Step 9 – Best Practices for Bandwidth Management
- Regularly update RouterOS for security and stability.
- Use clear naming conventions for queues and rules.
- Monitor usage weekly to adjust limits.
- Educate users about fair usage policies.
- Backup configuration before making changes.
Conclusion
Mikrotik offers a highly flexible and cost-effective way to manage bandwidth across small and large networks. By using simple queues, queue trees, PCQ, and mangle rules, you can ensure fair distribution, prioritize critical traffic, and prevent bandwidth abuse. Implementing these methods will greatly improve network performance and user satisfaction.