MikroTik QoS Priority and Anti-Lag Calculator
Prioritize WhatsApp calls, Zoom/Teams conferences, and gaming latency above bulk downloads using RouterOS v7 FQ-CoDel Queue Trees.
Input Parameters
Calculation Results
- wanIface
- ether1-ISP
- lanCidr
- 192.168.88.0/24
- downMbps
- 100
- upMbps
- 40
- headroomPct
- 95
- totalDownMbps
- 95
- totalUpMbps
- 38
- prioDownMbps
- 28
- prioUpMbps
- 13
- regulerDownMbps
- 67
- regulerUpMbps
- 25
# ===================================================================== # InfraCalc.id - MikroTik RouterOS v7 QoS Priority (Zoom, WA Call, DNS, ICMP) # Total Bandwidth: Download 95M / Upload 38M (Headroom 95%) # ===================================================================== /ip firewall mangle # 1. Prioritas 1 (Tertinggi): ICMP Ping, DNS, & VoIP/Meeting (Zoom, WhatsApp Call, Google Meet, MS Teams) add action=mark-connection chain=prerouting comment="QoS Prio 1 - ICMP & DNS" new-connection-mark=PRIO1_CONN passthrough=yes protocol=icmp add action=mark-connection chain=prerouting dst-port=53,123 new-connection-mark=PRIO1_CONN passthrough=yes protocol=udp add action=mark-connection chain=prerouting comment="QoS Prio 1 - Zoom, WA Call, Meet, Teams UDP" dst-port=3478-3481,8801-8810,19302-19309,50000-50060 new-connection-mark=PRIO1_CONN passthrough=yes protocol=udp add action=mark-packet chain=forward connection-mark=PRIO1_CONN new-packet-mark=PRIO1_PKT passthrough=no # 2. Prioritas 8 (Bulk/Reguler): Trafik Download Besar, Streaming, & Umum add action=mark-connection chain=prerouting comment="QoS Prio 8 - Reguler & Bulk Traffic" connection-mark=no-mark new-connection-mark=REGULER_CONN passthrough=yes src-address=192.168.88.0/24 add action=mark-packet chain=forward connection-mark=REGULER_CONN new-packet-mark=REGULER_PKT passthrough=no /queue type add kind=fq-codel name=ST-QOS-FQCODEL fq-codel-target=5ms fq-codel-interval=100ms /queue tree add max-limit=95M name="1-TOTAL-DOWNLOAD" parent=global queue=ST-QOS-FQCODEL add limit-at=28M max-limit=95M name="1A-PRIO-REALTIME-DOWN" packet-mark=PRIO1_PKT parent="1-TOTAL-DOWNLOAD" priority=1 queue=ST-QOS-FQCODEL add limit-at=67M max-limit=95M name="1B-REGULER-BULK-DOWN" packet-mark=REGULER_PKT parent="1-TOTAL-DOWNLOAD" priority=8 queue=ST-QOS-FQCODEL add max-limit=38M name="2-TOTAL-UPLOAD" parent=ether1-ISP queue=ST-QOS-FQCODEL add limit-at=13M max-limit=38M name="2A-PRIO-REALTIME-UP" packet-mark=PRIO1_PKT parent="2-TOTAL-UPLOAD" priority=1 queue=ST-QOS-FQCODEL add limit-at=25M max-limit=38M name="2B-REGULER-BULK-UP" packet-mark=REGULER_PKT parent="2-TOTAL-UPLOAD" priority=8 queue=ST-QOS-FQCODEL
How to Use This Tool
- Enter your router's WAN interface name (e.g. ether1-ISP) and local LAN subnet CIDR (e.g. 192.168.88.0/24).
- Enter your measured ISP Download and Upload line speeds in Mbps.
- Review the allocated Committed Information Rates for Priority 1 Real-Time and Priority 8 Bulk traffic, then copy the RouterOS v7 script into your terminal.
Worked Example: Standard Office 100/40 Mbps Link
Computed example: An ISP connection of 100/40 Mbps shaped at 95% headroom yields 95M down / 38M up. Priority 1 Real-Time receives a guaranteed floor of 28M down / 13M up, while Priority 8 Bulk receives 67M down / 25M up managed by FQ-CoDel.
{
"downMbps": 100,
"upMbps": 40,
"headroomPct": 95,
"prioDownPct": 30,
"prioUpPct": 35,
"wanIface": "ether1-ISP",
"lanCidr": "192.168.88.0/24"
}- wanIface:
- ether1-ISP
- lanCidr:
- 192.168.88.0/24
- downMbps:
- 100
- upMbps:
- 40
- headroomPct:
- 95
- totalDownMbps:
- 95
- totalUpMbps:
- 38
- prioDownMbps:
- 28
- prioUpMbps:
- 13
- regulerDownMbps:
- 67
- regulerUpMbps:
- 25
Core Concept & Engineering Notes
How It Was Calculated (Formulas & Steps)
Mathematical Formulas
- Total Shaped Download = floor(Download Bandwidth × Headroom %)
- Total Shaped Upload = floor(Upload Bandwidth × Headroom %)
- Priority 1 Limit-At Download = max(2, floor(Total Download × Prio Down %))
- Priority 1 Limit-At Upload = max(1, floor(Total Upload × Prio Up %))
- Priority 8 (Regular) Limit-At = Total Shaped − Priority 1 Limit-At
- FQ-CoDel Queue Type: fq-codel-target=5ms fq-codel-interval=100ms
Step-by-Step Calculation
- Shaped ISP bandwidth with 95% headroom: Download = floor(100 × 95%) = 95 Mbps, Upload = floor(40 × 95%) = 38 Mbps
- Priority 1 Guaranteed Floor (Zoom/WA/VoIP/ICMP): Download = floor(95 × 30%) = 28 Mbps (30%), Upload = floor(38 × 35%) = 13 Mbps (35%)
- Priority 8 Regular/Bulk Floor: Download = 67 Mbps, Upload = 25 Mbps (can burst up to full parent max-limit when Priority 1 is idle)
- Generated RouterOS v7 Queue Tree with modern FQ-CoDel queue type and firewall mangle packet marks
Frequently Asked Questions (FAQ)
Why is FQ-CoDel in RouterOS v7 superior to SFQ or PCQ for eliminating lag?
FQ-CoDel combines fair queuing per flow with the CoDel algorithm, which actively drops or marks packets before buffer dwell time exceeds 5 ms. This keeps gaming ping and voice packets crisp and responsive even under heavy torrent downloads or 4K streams.
Why must the Queue Tree total bandwidth be set slightly below the ISP bandwidth (95% Headroom)?
If you configure 100% of your ISP bandwidth, surplus packets accumulate in the ISP modem or OLT buffer where you have no priority scheduling control. Setting a 5%–10% headroom forces the bottleneck to occur inside the MikroTik router where QoS rules can govern packet order.
Which UDP ports are automatically prioritized by this script?
The script prioritizes ICMP (Ping), UDP 53 (DNS), UDP 123 (NTP), and standard WebRTC/RTP/STUN media port ranges utilized by Zoom, WhatsApp Calling, Google Meet, and MS Teams (ports 3478-3481, 8801-8810, 19302-19309, and 50000-50060).
Does Queue Tree function if FastTrack remains active in the firewall filter?
No. FastTracked packets bypass connection tracking inspection and queue trees completely. You must disable the `action=fasttrack-connection` firewall filter rule for Queue Tree QoS to operate effectively.
Related Calculators
Calculate Limit-At (CIR), Max-Limit (MIR), Burst, PCQ, and FQ-CoDel for RouterOS v7 with automated configuration script generation.
Multi-WAN (2–5 ISP) proportional PCC load balancing and recursive failover configuration script generator for RouterOS v7.
Calculate IPv4 network address, broadcast, usable host range, netmask, wildcard, binary mask, and RFC address type (RFC 1918, /31, CGNAT).
References & Notes
- MikroTik Documentation — Queue Tree & HTB Hierarchical Token Bucket
- RFC 8290 — The FlowQueue-CoDel Packet Scheduler and AQM Algorithm
Note: Results above are mathematical estimates based on standard formulas. Always verify against official vendor documentation and site conditions before production deployment.