Skip to main content

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

Try Example:
Mbps
51000
Mbps
21000
%
50100
%
1080
%
1080

Calculation Results

Public WAN Interface
ether1-ISP
LAN Network Subnet
192.168.88.0/24
ISP Download Bandwidth
100 Mbps
ISP Upload Bandwidth
40 Mbps
ISP Shaping Headroom
95 %
Effective Download Bandwidth
95 Mbps
Effective Upload Bandwidth
38 Mbps
Priority Download Bandwidth
28 Mbps
Priority Upload Bandwidth
13 Mbps
Regular / Bulk Download Bandwidth
67 Mbps
Regular / Bulk Upload Bandwidth
25 Mbps
Want to compare 2 design options side-by-side (e.g., Scenario A vs Scenario B)?
⚡ Enterprise SMB Tier (150–800 Mbps)
MikroTik RB5009UG+S+IN / L009UiGS
RouterOS v7 Level 5 • Marvell Armada Quad-Core 1.4 GHz (1GB RAM)

Handles Multi-WAN PCC mangle rules and FQ-CoDel queue trees with low CPU utilization.

Terminal Configuration Script (CLI)
# =====================================================================
# InfraCalc.web.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
Multi-Vendor CLI & Packet Flow

Multi-Vendor Config Translator & Interactive Packet Flow Visualizer

Interactive Packet Flow Pipeline (Click Stage to Inspect)WAN ➔ Prerouting/NAT ➔ Filter/QoS ➔ LAN
1. Packet ClassificatioTarget: 192.168.88.0/242. CIR Guarantee (LimitGuaranteed Minimum3. FQ-CoDel / PCQ SchedAnti-Bufferbloat AQM4. MIR Ceiling & Burst13M / 25M
1. Packet Classification: Mangle rules classify packets by DSCP, real-time VoIP/Gaming ports, and per-IP flows.
# =====================================================================
# InfraCalc.web.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
Share to WhatsApp
ℹ️

Technical Accuracy Note: Calculation results are engineering estimates based on standard RFC/IEEE/ITU-T models. Actual field performance may vary due to protocol overhead, hardware specifications, and environmental factors.

🚀 Share Calculation Results or Embed on Your Site

Deep-link automatically preserves your current inputs — ideal for WhatsApp, Telegram, Reddit, or engineering docs.

How to Use This Tool

  1. Enter your router's WAN interface name (e.g. ether1-ISP) and local LAN subnet CIDR (e.g. 192.168.88.0/24).
  2. Enter your measured ISP Download and Upload line speeds in Mbps.
  3. 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.

Example Input
Measured ISP Download Bandwidth (Mbps)
100 Mbps
Measured ISP Upload Bandwidth (Mbps)
40 Mbps
ISP Shaping Headroom (%)
95 %
Priority 1 Real-Time Download Allocation (%)
30 %
Priority 1 Real-Time Upload Allocation (%)
35 %
WAN Interface (ISP)
ether1-ISP
LAN Subnet (CIDR)
192.168.88.0/24
Calculated Output
Public WAN Interface
ether1-ISP
LAN Network Subnet
192.168.88.0/24
ISP Download Bandwidth
100 Mbps
ISP Upload Bandwidth
40 Mbps
ISP Shaping Headroom
95 %
Effective Download Bandwidth
95 Mbps
Effective Upload Bandwidth
38 Mbps
Priority Download Bandwidth
28 Mbps
Priority Upload Bandwidth
13 Mbps
Regular / Bulk Download Bandwidth
67 Mbps
Regular / Bulk Upload Bandwidth
25 Mbps
Terminal Configuration Script (CLI)
# ===================================================================== # InfraCalc.web.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

Core Concept & Engineering Notes

Quality of Service (QoS) and anti-lag traffic scheduling in MikroTik RouterOS prioritize latency-sensitive interactive traffic—such as WhatsApp voice calls, Zoom conferences, Google Meet, Microsoft Teams, DNS lookups, and online gaming ICMP packets—above high-volume, elastic bulk downloads and streaming video. Without active priority queuing, a single client initiating an unconstrained multi-thread download can congest the ISP modem buffer, triggering severe bufferbloat where network round-trip latency surges from 15 ms to over 300 ms, resulting in jitter and dropped audio. This calculator implements a structured RouterOS v7 Queue Tree architecture integrated with the modern FQ-CoDel (Fair Queuing Controlled Delay) active queue management algorithm. Unlike legacy First-In First-Out (FIFO) queues where large bulk packets clog the pipeline and delay smaller voice packets, FQ-CoDel dynamically separates individual conversation flows into sub-queues. It inspects buffer dwell time and drops or marks packets via Explicit Congestion Notification (ECN) as soon as packet transit time exceeds a 5-millisecond target. To maintain traffic sovereignty at the router and prevent queuing in the ISP ONT, total shaping capacity is throttled to 95% headroom of the measured line rate. Firewall mangle rules segregate packets into two primary tiers: Priority 1 (Real-Time interactive communications) backed by a dedicated Committed Information Rate (Limit-At) floor of 30% download and 35% upload, and Priority 8 (Regular/Bulk traffic). When real-time video meetings are inactive, the entire parent bandwidth dynamically remains available to regular users up to the Max-Limit ceiling with zero wasted capacity.

How It Was Calculated (Formulas & Steps)

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.

References & Notes

Last updated: Technically Verified · Industry Standard

Note: Results above are mathematical estimates based on standard formulas. Always verify against official vendor documentation and site conditions before production deployment.

🔗Related Scenarios & Companion Calculators

Browse All 30+ Scenarios →
🔬 Scientific Methodology & Normative Verification

Engineering Sensitivity Analysis, Response Curve & Technical Citation

✓ Calibrated to ISO/IEC/IEEE/TIA Clauses

1. 1. 3-Point Engineering Sensitivity & Tolerance Envelope

Comparative evaluation across theoretical laboratory bounds (0% loss), current nominal operating point, and conservative field safety bounds (±15% thermal/aging derating).

Evaluated Parameter Ideal Theoretical Bound Nominal Operating Point Conservative Safety Bound (±15%) Engineering Derating Rule
ISP Download Bandwidth 90 100 115 Engineering Safety Margin (+15% Overhead)
ISP Upload Bandwidth 36 40 46 Engineering Safety Margin (+15% Overhead)
ISP Shaping Headroom 85.5 95 109 Engineering Safety Margin (+15% Overhead)
Effective Download Bandwidth 85.5 95 109 Engineering Safety Margin (+15% Overhead)
Effective Upload Bandwidth 34.2 38 43.7 Engineering Safety Margin (+15% Overhead)

2. 2. Mathematical Function Curve & Operating Coordinate (x₀, y₀)

MATHEMATICAL RESPONSE CURVE: ISP DOWNLOAD BANDWIDTH VS ISP DOWNLOAD BANDWIDTH Conservative Engineering Bound (+15% Safety Margin) 40 60 80 100 120 140 160 (x₀=100, y₀=100) Variabel Independen (x): ISP Download Bandwidth

3. 3. Physical Constants & Normative Standard Clauses

R_loop(Cat6, 20°C) = 14 Ω/100m ANSI/TIA-568.2-D & IEEE 802.3bt

DC Loop Resistance for 23 AWG Solid Copper Cat6

Clause 6.4.1 / Table 145-1 — Nominal 23 AWG solid copper loop resistance at 20°C is 14.0 Ω/100m (TIA maximum ceiling is 18.8 Ω/100m).

α_opt(1490nm) = 0.25 dB/km ITU-T Rec. G.652.D & G.984.2

Single-Mode Optical Fiber Attenuation Coefficient at 1490 nm

Table 1 / Class B+ & C+ Optical Path — Typical G.652.D attenuation at 1490 nm downstream is 0.22–0.25 dB/km (1310 nm upstream: 0.35 dB/km).

α_Cu(20°C) = 0.00393 °C⁻¹ IEC 60028

Temperature Coefficient of Resistance for Copper

International Annealed Copper Standard — Used in thermal derating equation: R(T) = R_20 × [1 + 0.00393 × (T - 20)].

4. 4. Independent Technical & Academic Citation (IEEE / APA 7th / BibTeX / LaTeX)

Use the standard citation formats below to reference this computational methodology in engineering specifications, audit reports, or academic papers.

Format IEEE & APA 7th Edition

[IEEE] KalkuNet Engineering Team, "MikroTik QoS Priority and Anti-Lag Calculator — Standard Engineering Computational Instrument," KalkuNet Technical Suite, 2026. [Online]. Available: https://kalkunet.com/en/tools/mikrotik-qos-calculator. [Accessed: 2026-11-08].

[APA 7th] KalkuNet Engineering Team. (2026). MikroTik QoS Priority and Anti-Lag Calculator (Production release 2026-11-08) [Engineering computational software]. KalkuNet. https://kalkunet.com/en/tools/mikrotik-qos-calculator

BibTeX & LaTeX Derivation Snippet
@software{kalkunet_mikrotik_qos_calculator_2026,
  author = {{KalkuNet Engineering Team}},
  title = {{MikroTik QoS Priority and Anti-Lag Calculator --- KalkuNet Engineering Suite}},
  year = {2026},
  publisher = {KalkuNet.com},
  url = {https://kalkunet.com/en/tools/mikrotik-qos-calculator},
  urldate = {2026-11-08}
}

% LaTeX Engineering Derivation — Generated via https://kalkunet.com/en/tools/mikrotik-qos-calculator
\begin{equation}
  \text{Model: } Total Shaped Download = floor(Download Bandwidth × Headroom %)
\end{equation}
% Parameter Input Terukur: downMbps = 100, \; upMbps = 40, \; headroomPct = 95, \; prioDownPct = 30
% Hasil Evaluasi Numerik : wanIface = \mathbf{ether1-ISP}, \; lanCidr = \mathbf{192.168.88.0/24}, \; downMbps = \mathbf{100}