Optimizing Bandwidth and QoS on MikroTik: Taking Control of Your Network Traffic Print

  • Mikrotik, Networking
  • 37

Howdy, fellow network tinkerers!
This is Emmanuel Corels, your go-to admin from Emmanuel Corels Creatives. We’ve ventured through VLANs, VPNs, CHR, and more. Now it’s time to put on our traffic-cop hats and tame the wild beasts known as bandwidth and Quality of Service (QoS). If you’re ready to make sure Netflix doesn’t hog the entire office internet or that VoIP calls always get VIP treatment, stick around—this is the article for you!


1. Why QoS and Bandwidth Management?

Sometimes the internet in your network feels like a party with no bouncer—everyone’s trying to get in, but there’s chaos at the door. With QoS and bandwidth management, you can:

  • Prioritize Critical Traffic (like VoIP or video calls) over less important traffic (like general web browsing).
  • Prevent Bandwidth Hogs from ruining everyone’s day.
  • Allocate Fair Usage so each user or department gets a piece of the pie.

2. Key MikroTik QoS Concepts

2.1 Queues

A queue is like a waiting line for your packets. MikroTik offers different queue types, from Simple Queues to Queue Trees.

  • Simple Queue: Easiest to configure; great for straightforward tasks like capping a single user’s bandwidth or limiting a subnet.
  • Queue Tree: Allows advanced traffic shaping with hierarchical limits (think “parent” and “child” relationships).

2.2 Queue Types (Algorithms)

MikroTik supports multiple queue algorithms for distributing bandwidth:

  • PCQ (Per Connection Queue): Dynamically splits bandwidth among active users or connections.
  • SFQ (Stochastic Fairness Queue): A simpler way to keep traffic fair across multiple flows.
  • FIFO (First-In, First-Out): Basic approach, no fancy fairness here.

3. Setting Up a Simple Queue

3.1 Scenario: Limiting a Single IP

Let’s say you have a pesky coworker who streams 4K cat videos daily (seriously, Bob?). You want to cap his machine at 2 Mbps download so the rest of the office can function.

  1. Queues -> Simple Queues.
  2. Click “+”.
  3. Name: LimitBob.
  4. Target: Bob’s IP (e.g., 192.168.88.50).
  5. Max Limit: 2M/2M (2 Mbps download, 2 Mbps upload).
  6. Queue Type: You can leave the default or pick pcq if you prefer.
  7. Click OK.

Boom—Bob’s cat videos are now tamed to 2 Mbps, leaving more bandwidth for the rest of the team.

Command Line Example:

/queue simple add name="LimitBob" target=192.168.88.50 max-limit=2M/2M

4. Using Queue Trees for Advanced Shaping

Now, let’s get fancier. Perhaps you want to prioritize VoIP traffic above all else, while still capping general browsing. Queue Trees allow you to set a “parent” limit on the total bandwidth (say, your WAN speed of 20 Mbps) and create child queues for different traffic types.

4.1 Marking Packets (Mangle)

Queue Trees typically work best with packet marking in the Firewall -> Mangle section. This way, you can classify traffic:

  1. IP -> Firewall -> Mangle, add a new rule:
    • Chain: forward
    • Protocol: udp
    • Dst. Port: 5060 (SIP) or your VoIP range, for example
    • Action: mark-packet
    • New Packet Mark: voip-packets
    • Comment: “Mark VoIP traffic”

You can do similar rules for other traffic categories: streaming, browsing, gaming, etc.

4.2 Creating Parent Queue

  1. Queues -> Queue Tree.
  2. Click “+”:
    • Name: Total_WAN
    • Parent: ether1-wan (if that’s your WAN interface) or sometimes global in older RouterOS versions
    • Max Limit: 20M (assuming your ISP gives 20 Mbps)

4.3 Child Queues

  1. VoIP Queue:

    • Name: VoIP_High_Priority
    • Parent: Total_WAN
    • Packet Mark: voip-packets
    • Priority: 1 (1 is the highest priority in MikroTik)
    • Max Limit: (optional, you can define an upper cap, e.g., 5M)
  2. Default Traffic:

    • Name: Default_Traffic
    • Parent: Total_WAN
    • Packet Mark: (no mark if everything else falls under default, or create a mark like other-traffic)
    • Priority: 8 (lower priority)
    • Max Limit: 15M

This way, your total WAN is 20 Mbps, with a chunk always “preferred” for VoIP if needed, and the rest shared among other traffic.


5. PCQ for Per-User Fairness

What if you want each active user to get the same slice of the bandwidth pie, no matter how many devices they have? That’s where PCQ shines.

  1. Queues -> Queue Types.
  2. Create or edit a Queue Type named pcq-upload with kind=pcq, pcq-rate=2M (or whatever you like).
  3. Create a second called pcq-download.
  4. In your Queue Tree or Simple Queue, choose those queue types for upload/download, ensuring that each IP or connection is fairly assigned a share of the bandwidth.

6. Testing and Monitoring

  • Queues -> Simple Queues or Queue Tree: Watch real-time usage.
  • Torch or IP -> Firewall -> Connections: See what traffic is flowing and how it’s being classified.
  • System -> Resources: Ensure CPU usage is okay (QoS can be CPU-intensive if you’re shaping large traffic at high speeds).

Common Issues:

  • Wrong Packet Mark: If your mangle rules aren’t matching the traffic you think they are, your queue logic won’t work.
  • Bandwidth Overestimation: If you set your Max Limit higher than your actual ISP capacity, you might not see the shaping effect.
  • Priority Not Working: Remember to set child queues under a parent, and ensure the parent has a max limit.

7. Real-World Examples

  1. Office with 50 Users: Use Queue Trees + PCQ to ensure each user gets a fair portion of bandwidth, while VoIP or video conferencing gets top priority.
  2. Café Wi-Fi: Simple queues limiting each client to 2 Mbps. No more one user hogging everything.
  3. Small ISP: Advanced classification and queue trees for different service plans (5 Mbps, 10 Mbps, 20 Mbps) across multiple customers.

8. Wrapping Up

With MikroTik’s robust QoS and bandwidth management features, you have fine-grained control over who gets the VIP lane and who waits in line. From simple rate limiting to advanced queue trees, there’s a solution for every network scenario.

Recommended Next Steps:

  • Explore Burst settings in Simple Queues to give short-term speed boosts.
  • Experiment with PCQ Rate for dynamic fairness in multi-user environments.
  • Use Address Lists and Mangle rules to classify specific groups or subnets automatically.

Remember, networking is part science, part art—fine-tuning your QoS might take some trial and error. But once you nail it, your network performance and user satisfaction will skyrocket!


Crafted with care by:
Emmanuel Corels – Admin, Emmanuel Corels Creatives

(Join me next time for even more MikroTik revelations! Until then, keep shaping that traffic like the boss you are.)


Does this help?

« Back