ABDURROZAK
HOME ABOUT ME MICROSITE KONTAK PERSEMBAHAN HELP
ABDURROZAK.MY.ID // MIKROTIK TUTORIAL

QUEUE TREE

RB941 hAP LITE - PANDUAN LENGKAP ADVANCED QOS

Membangun QoS advanced dengan Queue Tree: mangle marking (connection & packet), hierarki parent-child, PCQ per-connection, burst, time-based, dynamic per-IP, integrasi hotspot, monitoring, dan troubleshooting.

SPESIFIKASI HARDWARE RB941-2nD

Queue Tree lebih berat dari Simple Queue karena butuh Mangle + Queue Tree + PCQ. RB941 dengan CPU AR9344 650MHz dan RAM 32MB cocok untuk QoS skala kecil dengan 10-20 rule mangle + 10-20 queue tree.

CPU
AR9344 - 650MHz
RAM
32 MB DDR2
STORAGE
16 MB FLASH
ETHERNET
4x 10/100 Mbps
WIRELESS
2.4GHz b/g/n
MANGLE RULE
~20-30 MAX
QUEUE TREE
~20-30 MAX
MAX BW QOS
~20-30 Mbps
POWER
5V DC / USB
OS DEFAULT
RouterOS v6 L4
DIMENSI
113 x 89 x 28mm
BERAT
160 gram
PERINGATAN: Queue Tree + Mangle + PCQ + L7 = SANGAT BERAT untuk RB941. Jika kombinasi semua aktif, CPU bisa 80-100%. Batasi rule mangle maksimal 20-30, queue tree 10-20. Untuk QoS skala besar, upgrade ke hAP ac^2 (717MHz, 128MB RAM) atau CCR series.
TOPOLOGI QUEUE TREE SCHEMA
// SKEMA JARINGAN DENGAN QUEUE TREE + MANGLE // [ INTERNET / ISP ] -- 50 Mbps | v +--------------------------------------+ | MikroTik RB941 | | QUEUE TREE + MANGLE QOS | | | | ether1 = WAN | | | | [ MANGLE ENGINE ] | | |- mark-connection (game,stream) | | |- mark-packet (upload/download) | | | | [ QUEUE TREE ] | | |- global-total (50M/50M) | | | |- game-queue (P1, 5M/10M) | | | |- stream-queue (P5, 10M/20M) | | | |- browsing-queue (P3, 15M/30M)| | | `- download-queue (P8, 5M/10M)| | `- upload-total (50M) | | | | bridge1 (LAN) | | |- ether2-4 + wlan1 | +--------------------------------------+ | v [ CLIENT ] -- traffic di-mark & di-queue
ALUR QUEUE TREE: (1) Packet masuk, (2) Mangle inspect & mark connection, (3) Mangle mark packet berdasarkan connection-mark, (4) Queue Tree ambil packet berdasarkan packet-mark, (5) Queue Tree apply limit & priority sesuai hierarki parent-child.
VISUALISASI MANGLE + QUEUE TREE LIVE FLOW

Visualisasi alur QoS: packet dari client di-inspect oleh Mangle, di-mark berdasarkan aplikasi (game/stream/browsing/download), lalu masuk ke Queue Tree hierarki dengan priority berbeda.

INTERNET 50 Mbps TOTAL MIKROTIK RB941 QUEUE TREE + MANGLE QOS ENGINE WAN ether1 MANGLE ENGINE mark-connection mark-packet QUEUE TREE parent-child hierarchy P1 GAME P3 BROWSING P5 STREAM P8 DOWNLOAD e2 game e3 browse e4 stream WIFI all MANGLE MARK -> QUEUE TREE -> PCQ -> PRIORITY -> CLIENT GAME conn-game P1 | 5M/10M BROWSING conn-browse P3 | 15M/30M STREAM conn-stream P5 | 10M/20M DOWNLOAD conn-download P8 | 5M/10M // MANGLE -> QUEUE TREE FLOW // MARK: conn-game, conn-browse, conn-stream, conn-download | PRIORITY: 1,3,5,8
Game (P1 - Fast)
Browsing (P3 - Med)
Streaming (P5 - Slow)
Download (P8 - Lowest)
Upload Packet
Download Packet
KEUNGGULAN QUEUE TREE: Hierarki parent-child memungkinkan pembagian bandwidth yang fleksibel. Parent = total bandwidth, child = sub-bagian. PCQ membagi rata per connection. Priority menentukan siapa dapat jatah saat bandwidth penuh.
RESET & AKSES AWAL STEP 01

Pastikan router dalam kondisi bersih sebelum konfigurasi. Hubungkan PC ke ether2 dengan kabel UTP.

RESET KE FACTORY DEFAULT
RESET
# CARA 1: Tombol fisik # 1. Cabut power router # 2. Tekan tombol RESET dengan pin # 3. Colok power sambil tetap tekan RESET # 4. Tunggu LED berkedip (~5 detik), lepas # 5. Router reboot dengan config default # CARA 2: Via terminal [admin@MikroTik] > /system reset-configuration Do you really want to reset configuration? [y/N] y # CARA 3: Reset tanpa default config (kosong total) [admin@MikroTik] > /system reset-configuration no-defaults=yes skip-backup=yes ! WARNING: semua konfigurasi akan terhapus
AKSES ROUTER
METODEALATALAMAT
WinBoxAplikasi WindowsMAC Address / 192.168.88.1
WebFigBrowserhttp://192.168.88.1
SSHTerminal / PuTTYssh admin@192.168.88.1
MAC TelnetWinBoxMAC Address
NEIGHBORS
# di WinBox, klik tab "Neighbors" MAC ADDRESS IDENTITY IP VERSION D4:01:C3:XX:XX:XX MikroTik 192.168.88.1 6.48.6 # klik dua kali -> Connect via MAC (paling aman) # login: admin | password: (kosong)
IDENTITY & USER MANAGEMENT STEP 02

Beri nama router dan ganti password admin. WAJIB sebelum router terhubung internet.

SET IDENTITY
IDENTITY
[admin@MikroTik] > /system identity set name="QT-GATEWAY" [admin@QT-GATEWAY] > # prompt berubah otomatis
GANTI PASSWORD
USER
[admin@QT-GATEWAY] > /user set admin password="Admin@QT-2024!" # buat user operator (read-only) [admin@QT-GATEWAY] > /user add name="monitor" password="monitor@2024" group="read" [admin@QT-GATEWAY] > /user print
INTERFACE & BRIDGE STEP 03

Setup interface: ether1 untuk WAN, ether2-4 dan wlan1 digabung dalam bridge untuk LAN.

CEK INTERFACE
INTERFACE
[admin@QT-GATEWAY] > /interface print # NAME TYPE ACTUAL-MTU 0 R1 ether1 ether 1500 1 R2 ether2 ether 1500 2 R3 ether3 ether 1500 3 R4 ether4 ether 1500 4 R wlan1 wlan 1500 5 R bridge1 bridge 1500
BRIDGE SETUP
BRIDGE
[admin@QT-GATEWAY] > /interface bridge port print # INTERFACE BRIDGE HW PVID 0 ether2 bridge1 yes 1 1 ether3 bridge1 yes 1 2 ether4 bridge1 yes 1 3 wlan1 bridge1 yes 1 [admin@QT-GATEWAY] > /interface bridge set bridge1 protocol-mode=rstp fast-forward=yes
IP ADDRESS STEP 04

Setup IP gateway untuk LAN.

GANTI IP GATEWAY
IP ADDRESS
[admin@QT-GATEWAY] > /ip address print # ADDRESS NETWORK INTERFACE 0 192.168.88.1/24 192.168.88.0 bridge # ganti IP gateway [admin@QT-GATEWAY] > /ip address set [find interface=bridge] address="10.10.10.1/24" # skema IP: # Gateway : 10.10.10.1/24 # DHCP Pool : 10.10.10.100 - 10.10.10.200
DHCP CLIENT (WAN) STEP 05

Setup DHCP client di WAN (ether1) agar router dapat IP otomatis dari ISP.

SETUP DHCP CLIENT
DHCP CLIENT
[admin@QT-GATEWAY] > /ip dhcp-client add interface=ether1 disabled=no use-peer-dns=yes use-peer-ntp=yes add-default-route=yes [admin@QT-GATEWAY] > /ip dhcp-client print # INTERFACE STATUS ADDRESS 0 ether1 bound 10.10.10.5/24
DHCP SERVER (LAN) STEP 06

DHCP Server memberikan IP otomatis ke semua client.

SETUP DHCP SERVER
DHCP SERVER
[admin@QT-GATEWAY] > /ip pool add name="pool-lan" ranges=10.10.10.100-10.10.10.200 [admin@QT-GATEWAY] > /ip dhcp-server add name="dhcp-lan" interface=bridge address-pool="pool-lan" lease-time=10m authoritative=yes [admin@QT-GATEWAY] > /ip dhcp-server network add address=10.10.10.0/24 gateway=10.10.10.1 dns-server=10.10.10.1,8.8.8.8 domain="rumah.local" [admin@QT-GATEWAY] > /ip dhcp-server lease print
NAT MASQUERADE STEP 07

NAT masquerade WAJIB agar client bisa akses internet.

SETUP MASQUERADE
NAT
[admin@QT-GATEWAY] > /ip firewall nat add chain=srcnat action=masquerade out-interface=ether1 [admin@QT-GATEWAY] > /ip firewall nat print
DNS FORWARDING STEP 08

Setup DNS agar client bisa resolve domain.

SETUP DNS
DNS
[admin@QT-GATEWAY] > /ip dns set servers=1.1.1.1,8.8.8.8 allow-remote-requests=yes cache-size=2048KiB [admin@QT-GATEWAY] > /ping google.com count=4
NTP & TIMEZONE STEP 09

Waktu akurat penting untuk time-based queue.

SETUP NTP
NTP
[admin@QT-GATEWAY] > /system ntp client set enabled=yes mode=unicast primary-ntp=132.163.96.1 secondary-ntp=8.8.8.8 [admin@QT-GATEWAY] > /system clock set time-zone-name="Asia/Jakarta" [admin@QT-GATEWAY] > /system clock print
FIREWALL DASAR STEP 10

Firewall dasar untuk melindungi router.

FIREWALL FILTER
FIREWALL
[admin@QT-GATEWAY] > /ip firewall filter add chain=input connection-state=established,related action=accept in-interface=ether1 [admin@QT-GATEWAY] > /ip firewall filter add chain=input connection-state=invalid action=drop in-interface=ether1 [admin@QT-GATEWAY] > /ip firewall filter add chain=input action=drop in-interface=ether1 [admin@QT-GATEWAY] > /ip firewall filter add chain=forward connection-state=established,related action=accept [admin@QT-GATEWAY] > /ip firewall filter add chain=forward connection-state=invalid action=drop
WIRELESS SETUP STEP 11

Setup WiFi untuk client wireless.

SETUP WIRELESS
WIRELESS
[admin@QT-GATEWAY] > /interface wireless set wlan1 mode=ap-bridge ssid="QT-NET" country=indonesia frequency-mode=regulatory-domain [admin@QT-GATEWAY] > /interface wireless set wlan1 channel=6 band=2ghz-b/g/n [admin@QT-GATEWAY] > /interface wireless security-profiles set [find default=yes] mode=dynamic-keys authentication-types=wpa2-psk wpa2-pre-shared-key="wifi@qt2024!" [admin@QT-GATEWAY] > /interface wireless set wlan1 tx-power-mode=all-rates-fixed tx-power=17
KONSEP QUEUE TREE CORE

Queue Tree adalah sistem QoS advanced di RouterOS yang bekerja berdasarkan packet-mark dari Mangle. Berbeda dengan Simple Queue yang bekerja berdasarkan target IP, Queue Tree bisa mengelompokkan traffic berdasarkan aplikasi, protokol, port, konten, dll.

ARSITEKTUR QUEUE TREE
STEP 1
PACKET MASUK
Dari client / internet
STEP 2
MANGLE
Inspect & mark connection
STEP 3
MARK PACKET
Berdasarkan connection-mark
STEP 4
QUEUE TREE
Apply limit & priority
STEP 5
KELUAR
Ke tujuan
STRUKTUR HIERARKI
global-in [total bandwidth masuk dari ISP] | +-- upload-total [limit upload global] | | | +-- game-upload [packet-mark=pkt-game-up] | +-- browse-upload [packet-mark=pkt-browse-up] | +-- stream-upload [packet-mark=pkt-stream-up] | `-- download-upload [packet-mark=pkt-download-up] | `-- download-total [limit download global] | +-- game-download [packet-mark=pkt-game-down] +-- browse-download [packet-mark=pkt-browse-down] +-- stream-download [packet-mark=pkt-stream-down] +-- download-download [packet-mark=pkt-download-down] | | | +-- per-ip-1 [PCQ per src-address] | +-- per-ip-2 [PCQ per src-address] | `-- per-ip-N [PCQ per src-address] `-- other-download [packet-mark tidak ter-mark]
KEUNGGULAN QUEUE TREE
HIERARKI FLEKSIBEL
Parent-child structure. Parent = total bandwidth, child = sub-bagian. Bisa nested sampai dalam.
MARKING FLEKSIBEL
Bisa mark berdasarkan: port, protocol, address, Layer7, content, connection state, dll.
PCQ PER CONNECTION
PCQ membagi bandwidth per connection, bukan per IP. Fair sharing otomatis untuk banyak user.
PRIORITY DETAIL
Priority per queue tree node. Bisa set priority berbeda untuk upload dan download.
KEKURANGAN: Queue Tree kompleks dan butuh pemahaman Mangle. Salah konfigurasi = traffic tidak ter-limit. Konsumsi CPU lebih tinggi dari Simple Queue. Tidak cocok untuk pemula tanpa pemahaman dasar.
QUEUE TREE vs SIMPLE QUEUE CORE

Perbandingan detail antara Queue Tree dan Simple Queue untuk menentukan mana yang cocok untuk kebutuhan Anda.

TABEL PERBANDINGAN
ASPEKSIMPLE QUEUEQUEUE TREE
KompleksitasMudahKompleks
Kebutuhan MangleTIDAKWAJIB
TargetIP / Subnet / InterfacePacket-mark (dari Mangle)
StrukturFlat (tidak ada parent)Hierarki (parent-child)
MarkingBerdasarkan IPBerdasarkan aplikasi/protokol/konten
PCQBisaBisa + lebih fleksibel
PriorityBisaBisa per node
BurstBisaBisa
Performa CPULebih ringanLebih berat
Cocok untukRumah, kantor kecilISP, kantor besar, hotspot advanced
Limit per aplikasiTidak bisaBisa (via L7/port)
Dynamic per-IPManualBisa dengan PCQ
KAPAN PAKAI QUEUE TREE?
PAKAI QUEUE TREE JIKA
Butuh limit per aplikasi (game, streaming, download). Butuh PCQ per connection. Butuh hierarki bandwidth.
PAKAI SIMPLE QUEUE JIKA
Cukup limit per IP/subnet. Tidak butuh marking aplikasi. Hardware terbatas (RB941 dengan banyak client).
KOMBINASI KEDUA
Simple Queue untuk total bandwidth, Queue Tree untuk detail per aplikasi. Best of both worlds.
RB941 CONSIDERATION
RB941 bisa handle Queue Tree untuk 10-20 client dengan 10-20 rule mangle. Lebih dari itu, pertimbangkan upgrade hardware.
MANGLE - DASAR MARKING CORE

Mangle adalah fitur RouterOS untuk marking packet berdasarkan berbagai kriteria. Mangle adalah fondasi Queue Tree - tanpa Mangle, Queue Tree tidak tahu traffic mana yang harus di-limit.

ALUR MARKING
PACKET
UNMARKED
Belum ada mark
MANGLE
MARK CONNECTION
Mark connection (group)
MANGLE
MARK PACKET
Mark packet (individual)
QUEUE
QUEUE TREE
Apply limit & priority
JENIS MARKING
MARK TYPEFUNGSIKEGUNAAN
connection-markMark group koneksi (1 connection = banyak packet)Step 1 - mark koneksi
packet-markMark individual packetStep 2 - mark packet berdasarkan connection-mark
routing-markMark untuk routing policyPBR (Policy Based Routing)
CHAIN MANGLE
CHAINARAHKEGUNAAN
preroutingSebelum routing decisionPaling umum untuk QoS (mark semua traffic)
outputTraffic dari routerMark traffic yang dihasilkan router
postroutingSetelah routingMark setelah routing decision
inputTraffic ke routerMark traffic yang dituju router
KRITERIA MARKING
BERDASARKAN PORT
dst-port=80 (HTTP), dst-port=443 (HTTPS), dst-port=53 (DNS). Simple tapi tidak akurat untuk aplikasi modern.
BERDASARKAN PROTOCOL
protocol=tcp, udp, icmp. Untuk traffic berdasarkan transport protocol.
BERDASARKAN LAYER 7
layer7-protocol=pattern. Deteksi aplikasi berdasarkan konten packet. Berat CPU tapi akurat.
BERDASARKAN CONNECTION
connection-mark=xxx. Mark packet berdasarkan connection-mark yang sudah di-set sebelumnya.
PASSTHROUGH: YES vs NO
PASSTHROUGH
# passthrough=yes -> packet lanjut ke rule mangle berikutnya # passthrough=no -> packet STOP di rule ini # CONTOH: # Rule 1: mark connection game (passthrough=yes) # -> packet di-mark, lanjut ke rule 2 # Rule 2: mark packet game (passthrough=no) # -> packet di-mark, STOP # URUTAN PENTING: # 1. Mark connection DULU (passthrough=yes) # 2. Mark packet BERDASARKAN connection-mark (passthrough=no)
TIPS: Mangle rule diproses dari atas ke bawah. Rule pertama yang match akan dieksekusi. Taruh rule yang paling spesifik di atas, yang paling general di bawah.
MARK CONNECTION CORE

Mark Connection adalah step pertama dalam marking. Connection = group packet dari source ke destination yang sama. 1 connection bisa terdiri dari banyak packet. Mark connection lebih efisien daripada mark packet langsung.

CONTOH MARK CONNECTION
MARK CONNECTION
# 1. Mark connection untuk GAME (port game online) [admin@QT-GATEWAY] > /ip firewall mangle add chain=prerouting action=mark-connection new-connection-mark="conn-game" protocol=udp dst-port="30000-40000" passthrough=yes comment="Game UDP" [admin@QT-GATEWAY] > /ip firewall mangle add chain=prerouting action=mark-connection new-connection-mark="conn-game" protocol=tcp dst-port="10000-20000" passthrough=yes # 2. Mark connection untuk BROWSING (HTTP/HTTPS) [admin@QT-GATEWAY] > /ip firewall mangle add chain=prerouting action=mark-connection new-connection-mark="conn-browse" protocol=tcp dst-port="80,443" passthrough=yes # 3. Mark connection untuk STREAMING (YouTube, Netflix) [admin@QT-GATEWAY] > /ip firewall mangle add chain=prerouting action=mark-connection new-connection-mark="conn-stream" protocol=tcp dst-port="443" dst-address-list="streaming-servers" passthrough=yes # 4. Mark connection untuk DOWNLOAD (port umum download) [admin@QT-GATEWAY] > /ip firewall mangle add chain=prerouting action=mark-connection new-connection-mark="conn-download" protocol=tcp dst-port="20,21,8080" passthrough=yes # cek connection mark [admin@QT-GATEWAY] > /ip firewall mangle print where action="mark-connection" # CHAIN ACTION NEW-CONNECTION-MARK PASSTHROUGH 0 prerouting mark-connection conn-game yes 1 prerouting mark-connection conn-game yes 2 prerouting mark-connection conn-browse yes 3 prerouting mark-connection conn-stream yes 4 prerouting mark-connection conn-download yes
TIPS MARK CONNECTION
SELALU passthrough=yes
Mark connection harus passthrough=yes agar packet lanjut ke rule mark-packet berikutnya.
URUTAN SPESIFIK DULU
Taruh rule paling spesifik di atas. Contoh: mark game (port spesifik) sebelum mark browsing (port umum).
NAMA YANG JELAS
Pakai nama connection-mark yang jelas: conn-game, conn-browse, conn-stream. Mudah di-debug.
PAKAI COMMENT
Selalu beri comment untuk setiap rule. Memudahkan troubleshooting dan dokumentasi.
JANGAN: mark connection dan mark packet dalam 1 rule. Harus 2 rule terpisah. Mark connection dulu, baru mark packet berdasarkan connection-mark.
MARK PACKET CORE

Mark Packet adalah step kedua. Mark packet berdasarkan connection-mark yang sudah di-set sebelumnya. Packet-mark inilah yang akan dipakai oleh Queue Tree.

CONTOH MARK PACKET
MARK PACKET
# Mark packet berdasarkan connection-mark # Upload (dari LAN ke WAN) [admin@QT-GATEWAY] > /ip firewall mangle add chain=prerouting action=mark-packet new-packet-mark="pkt-game-up" connection-mark="conn-game" in-interface=bridge passthrough=no [admin@QT-GATEWAY] > /ip firewall mangle add chain=prerouting action=mark-packet new-packet-mark="pkt-browse-up" connection-mark="conn-browse" in-interface=bridge passthrough=no [admin@QT-GATEWAY] > /ip firewall mangle add chain=prerouting action=mark-packet new-packet-mark="pkt-stream-up" connection-mark="conn-stream" in-interface=bridge passthrough=no [admin@QT-GATEWAY] > /ip firewall mangle add chain=prerouting action=mark-packet new-packet-mark="pkt-download-up" connection-mark="conn-download" in-interface=bridge passthrough=no # Download (dari WAN ke LAN) [admin@QT-GATEWAY] > /ip firewall mangle add chain=prerouting action=mark-packet new-packet-mark="pkt-game-down" connection-mark="conn-game" in-interface=ether1 passthrough=no [admin@QT-GATEWAY] > /ip firewall mangle add chain=prerouting action=mark-packet new-packet-mark="pkt-browse-down" connection-mark="conn-browse" in-interface=ether1 passthrough=no [admin@QT-GATEWAY] > /ip firewall mangle add chain=prerouting action=mark-packet new-packet-mark="pkt-stream-down" connection-mark="conn-stream" in-interface=ether1 passthrough=no [admin@QT-GATEWAY] > /ip firewall mangle add chain=prerouting action=mark-packet new-packet-mark="pkt-download-down" connection-mark="conn-download" in-interface=ether1 passthrough=no # cek packet mark [admin@QT-GATEWAY] > /ip firewall mangle print where action="mark-packet" # CHAIN ACTION NEW-PACKET-MARK CONNECTION-MARK 0 prerouting mark-packet pkt-game-up conn-game 1 prerouting mark-packet pkt-browse-up conn-browse 2 prerouting mark-packet pkt-stream-up conn-stream 3 prerouting mark-packet pkt-download-up conn-download 4 prerouting mark-packet pkt-game-down conn-game 5 prerouting mark-packet pkt-browse-down conn-browse 6 prerouting mark-packet pkt-stream-down conn-stream 7 prerouting mark-packet pkt-download-down conn-download
TIPS MARK PACKET
SELALU passthrough=no
Mark packet harus passthrough=no agar packet tidak diproses rule mangle lain (hemat CPU).
PAKAI connection-mark
Mark packet berdasarkan connection-mark, bukan inspect ulang. Lebih efisien.
PISAH UPLOAD & DOWNLOAD
Buat packet-mark terpisah untuk upload dan download. Queue Tree bisa handle berbeda.
PAKAI in-interface
in-interface=bridge untuk upload, in-interface=ether1 untuk download. Memisahkan arah traffic.
STRUKTUR LENGKAP MANGLE
MANGLE RULES (urutan penting!) | +-- 1. mark-connection conn-game [passthrough=yes] +-- 2. mark-connection conn-browse [passthrough=yes] +-- 3. mark-connection conn-stream [passthrough=yes] +-- 4. mark-connection conn-download [passthrough=yes] | +-- 5. mark-packet pkt-game-up [conn-game, in=bridge, passthrough=no] +-- 6. mark-packet pkt-browse-up [conn-browse, in=bridge, passthrough=no] +-- 7. mark-packet pkt-stream-up [conn-stream, in=bridge, passthrough=no] +-- 8. mark-packet pkt-download-up [conn-download, in=bridge, passthrough=no] | +-- 9. mark-packet pkt-game-down [conn-game, in=ether1, passthrough=no] +-- 10. mark-packet pkt-browse-down [conn-browse, in=ether1, passthrough=no] +-- 11. mark-packet pkt-stream-down [conn-stream, in=ether1, passthrough=no] `-- 12. mark-packet pkt-download-down [conn-download, in=ether1, passthrough=no]
URUTAN KRITIS: Mark connection HARUS di atas mark packet. Jika mark packet di atas, connection-mark belum ada, packet tidak akan ter-mark.
MANGLE + LAYER 7 PROTOCOL ADVANCED

Untuk deteksi aplikasi yang lebih akurat (YouTube, TikTok, Instagram, dll), gunakan Layer 7 Protocol di Mangle. Layer 7 inspect isi packet (payload) untuk identifikasi aplikasi, bukan hanya port.

BUAT LAYER 7 PROTOCOL
LAYER 7
# buat L7 pattern untuk YouTube [admin@QT-GATEWAY] > /ip firewall layer7-protocol add name="youtube" regexp="(^|\.)(youtube|youtu\.be|googlevideo)\.com" # buat L7 pattern untuk TikTok [admin@QT-GATEWAY] > /ip firewall layer7-protocol add name="tiktok" regexp="(^|\.)(tiktok|tiktokcdn|bytecdn)\.com" # buat L7 pattern untuk Facebook [admin@QT-GATEWAY] > /ip firewall layer7-protocol add name="facebook" regexp="(^|\.)(facebook|fbcdn|fbsbx)\.com" # buat L7 pattern untuk Instagram [admin@QT-GATEWAY] > /ip firewall layer7-protocol add name="instagram" regexp="(^|\.)(instagram|cdninstagram)\.com" # buat L7 pattern untuk streaming umum [admin@QT-GATEWAY] > /ip firewall layer7-protocol add name="streaming" regexp="(^|\.)(youtube|netflix|spotify|twitch|tiktok)\.com"
MARK CONNECTION DENGAN L7
MANGLE + L7
# mark connection YouTube [admin@QT-GATEWAY] > /ip firewall mangle add chain=prerouting action=mark-connection new-connection-mark="conn-youtube" layer7-protocol="youtube" passthrough=yes # mark connection TikTok [admin@QT-GATEWAY] > /ip firewall mangle add chain=prerouting action=mark-connection new-connection-mark="conn-tiktok" layer7-protocol="tiktok" passthrough=yes # mark connection Facebook [admin@QT-GATEWAY] > /ip firewall mangle add chain=prerouting action=mark-connection new-connection-mark="conn-facebook" layer7-protocol="facebook" passthrough=yes # mark connection Instagram [admin@QT-GATEWAY] > /ip firewall mangle add chain=prerouting action=mark-connection new-connection-mark="conn-instagram" layer7-protocol="instagram" passthrough=yes # mark packet berdasarkan connection-mark [admin@QT-GATEWAY] > /ip firewall mangle add chain=prerouting action=mark-packet new-packet-mark="pkt-youtube-up" connection-mark="conn-youtube" in-interface=bridge passthrough=no [admin@QT-GATEWAY] > /ip firewall mangle add chain=prerouting action=mark-packet new-packet-mark="pkt-youtube-down" connection-mark="conn-youtube" in-interface=ether1 passthrough=no # ulangi untuk TikTok, Facebook, Instagram, dll
LIMITASI LAYER 7
PERINGATAN KERAS:
1. Layer 7 TIDAK BISA baca isi HTTPS (terenkripsi). Hanya match di SNI header.
2. Layer 7 SANGAT BERAT CPU. RB941 bisa 80-100% CPU dengan 5+ L7 pattern aktif.
3. Untuk HTTPS modern, lebih baik pakai DNS filtering atau IP address-list.
4. Batasi maksimal 3-5 L7 pattern di RB941.
ALTERNATIF L7 YANG LEBIH RINGAN
DNS FILTERING
Block domain di DNS level. Ringan, efektif untuk HTTPS. Pakai /ip dns static.
ADDRESS LIST
Block IP server aplikasi. Ringan, efektif. Update rutin karena IP bisa berubah.
PORT BASED
Mark berdasarkan port. Ringan, tapi tidak akurat untuk aplikasi modern yang pakai port dinamis.
UPGRADE HARDWARE
Jika butuh L7 + banyak pattern, upgrade ke hAP ac^2 atau CCR series.
QUEUE TREE BASIC CORE

Setup Queue Tree dasar berdasarkan packet-mark dari Mangle. Queue Tree akan apply limit dan priority sesuai hierarki.

QUEUE TREE UPLOAD
UPLOAD QUEUE
# 1. Parent upload total (limit upload global) [admin@QT-GATEWAY] > /queue tree add name="upload-total" parent=global max-limit="10M" priority="5" comment="Total Upload" # 2. Child upload per aplikasi [admin@QT-GATEWAY] > /queue tree add name="game-upload" parent="upload-total" packet-mark="pkt-game-up" limit-at="2M" max-limit="5M" priority="1" [admin@QT-GATEWAY] > /queue tree add name="browse-upload" parent="upload-total" packet-mark="pkt-browse-up" limit-at="2M" max-limit="5M" priority="3" [admin@QT-GATEWAY] > /queue tree add name="stream-upload" parent="upload-total" packet-mark="pkt-stream-up" limit-at="1M" max-limit="3M" priority="5" [admin@QT-GATEWAY] > /queue tree add name="download-upload" parent="upload-total" packet-mark="pkt-download-up" limit-at="1M" max-limit="2M" priority="8"
QUEUE TREE DOWNLOAD
DOWNLOAD QUEUE
# 1. Parent download total (limit download global) [admin@QT-GATEWAY] > /queue tree add name="download-total" parent=global max-limit="45M" priority="5" comment="Total Download" # 2. Child download per aplikasi [admin@QT-GATEWAY] > /queue tree add name="game-download" parent="download-total" packet-mark="pkt-game-down" limit-at="5M" max-limit="10M" priority="1" [admin@QT-GATEWAY] > /queue tree add name="browse-download" parent="download-total" packet-mark="pkt-browse-down" limit-at="10M" max-limit="20M" priority="3" [admin@QT-GATEWAY] > /queue tree add name="stream-download" parent="download-total" packet-mark="pkt-stream-down" limit-at="10M" max-limit="20M" priority="5" [admin@QT-GATEWAY] > /queue tree add name="download-download" parent="download-total" packet-mark="pkt-download-down" limit-at="5M" max-limit="10M" priority="8" # cek queue tree [admin@QT-GATEWAY] > /queue tree print # NAME PARENT PACKET-MARK MAX-LIMIT 0 upload-total global 10M 1 game-upload upload-total pkt-game-up 5M 2 browse-upload upload-total pkt-browse-up 5M 3 stream-upload upload-total pkt-stream-up 3M 4 download-upload upload-total pkt-download-up 2M 5 download-total global 45M 6 game-download download-total pkt-game-down 10M 7 browse-download download-total pkt-browse-down 20M 8 stream-download download-total pkt-stream-down 20M 9 download-download download-total pkt-download-down 10M
VISUALISASI HIERARCHY
global | +-- upload-total [10M] | +-- game-upload [5M, P1] | +-- browse-upload [5M, P3] | +-- stream-upload [3M, P5] | `-- download-upload [2M, P8] | `-- download-total [45M] +-- game-download [10M, P1] +-- browse-download [20M, P3] +-- stream-download [20M, P5] `-- download-download [10M, P8]
CATATAN: Total max-limit child TIDAK HARUS sama dengan parent. RouterOS akan bagi bandwidth parent ke child sesuai limit-at (guaranteed). Jika bandwidth parent cukup, child dapat sesuai max-limit.
HIERARCHY PARENT-CHILD CORE

Hierarki parent-child adalah kekuatan utama Queue Tree. Parent = total bandwidth, child = sub-bagian. Child bisa punya child lagi (nested hierarchy).

BAGAIMANA HIERARCHY BEKERJA?
HOW IT WORKS
# SKENARIO: # Parent: download-total = 45M # Child 1: game-download = max 10M, limit-at 5M # Child 2: browse-download = max 20M, limit-at 10M # Child 3: stream-download = max 20M, limit-at 10M # Child 4: download-download = max 10M, limit-at 5M # KASUS 1: Bandwidth parent PENUH (45M terpakai) # - Tiap child dapat sesuai limit-at (guaranteed): # game: 5M, browse: 10M, stream: 10M, download: 5M # Total: 30M (sisanya 15M idle atau dibagi sesuai priority) # KASUS 2: Bandwidth parent TIDAK penuh (misal 30M terpakai) # - Tiap child dapat sesuai max-limit: # game: 10M, browse: 20M, stream: 20M, download: 10M # Total: 60M (tapi parent hanya 45M, jadi dibagi) # - Priority menentukan siapa dapat duluan # KASUS 3: Hanya game aktif # - Game dapat sampai max-limit 10M # - Child lain idle, bandwidth tidak terpakai
LIMIT-AT vs MAX-LIMIT
PARAMETERFUNGSIKAPAN DIPAKAI
limit-atBandwidth DIJAMIN (guaranteed)Saat bandwidth parent penuh
max-limitBandwidth MAKSIMAL (ceiling)Saat bandwidth parent cukup
NESTED HIERARCHY
NESTED
# contoh nested hierarchy: download -> social media -> per app # parent: download-total [admin@QT-GATEWAY] > /queue tree add name="download-total" parent=global max-limit="45M" # child: social-media [admin@QT-GATEWAY] > /queue tree add name="social-media" parent="download-total" max-limit="20M" # grandchild: per aplikasi [admin@QT-GATEWAY] > /queue tree add name="youtube" parent="social-media" packet-mark="pkt-youtube-down" max-limit="10M" priority="5" [admin@QT-GATEWAY] > /queue tree add name="tiktok" parent="social-media" packet-mark="pkt-tiktok-down" max-limit="5M" priority="6" [admin@QT-GATEWAY] > /queue tree add name="facebook" parent="social-media" packet-mark="pkt-facebook-down" max-limit="3M" priority="7" [admin@QT-GATEWAY] > /queue tree add name="instagram" parent="social-media" packet-mark="pkt-instagram-down" max-limit="2M" priority="7" # total social-media = 20M # youtube: 10M, tiktok: 5M, facebook: 3M, instagram: 2M
VISUALISASI NESTED
global | `-- download-total [45M] | +-- game-download [10M, P1] | +-- social-media [20M] | +-- youtube [10M, P5] | +-- tiktok [5M, P6] | +-- facebook [3M, P7] | `-- instagram [2M, P7] | +-- browse-download [15M, P3] `-- other-download [10M, P8]
TIPS: Nested hierarchy bagus untuk grouping. Contoh: social-media -> youtube/tiktok/facebook. Tapi jangan terlalu dalam (max 3-4 level) agar tidak rumit dan tidak berat CPU.
PCQ (PER CONNECTION QUEUE) CORE

PCQ adalah algoritma queue yang membagi bandwidth secara fair per connection. Jika ada 1 user download, dia dapat semua bandwidth. Saat user lain mulai, bandwidth otomatis dibagi rata.

SETUP PCQ DI QUEUE TREE
PCQ SETUP
# 1. buat queue type PCQ [admin@QT-GATEWAY] > /queue type add name="pcq-download" kind=pcq pcq-classifier=dst-address pcq-rate="5M" pcq-limit-at="2M" pcq-total-limit="45M" [admin@QT-GATEWAY] > /queue type add name="pcq-upload" kind=pcq pcq-classifier=src-address pcq-rate="2M" pcq-limit-at="1M" pcq-total-limit="10M" # 2. gunakan PCQ di queue tree [admin@QT-GATEWAY] > /queue tree set [find name="download-download"] queue="pcq-download" [admin@QT-GATEWAY] > /queue tree set [find name="download-upload"] queue="pcq-upload" # cek queue type [admin@QT-GATEWAY] > /queue type print # NAME KIND CLASSIFIER RATE LIMIT-AT 0 default sfq 1 ethernet-default sfq 2 wireless-default sfq 3 pcq-download pcq dst-address 5M 2M 4 pcq-upload pcq src-address 2M 1M
PCQ CLASSIFIER
CLASSIFIERARTIKEGUNAAN
src-addressPer IP sumberFair sharing per upload client
dst-addressPer IP tujuanFair sharing per download client
src-address:portPer IP + port sumberLebih granular
dst-address:portPer IP + port tujuanLebih granular
src-address,dst-addressPer pair IPFair sharing per connection pair
BAGAIMANA PCQ BEKERJA?
HOW PCQ WORKS
# SKENARIO: download-download dengan PCQ (pcq-rate=5M, total=45M) # 1 user download (1 connection) # -> dapat 5M (sesuai pcq-rate) # 2 user download (2 connection) # -> masing-masing dapat 5M # -> total: 10M # 5 user download (5 connection) # -> masing-masing dapat 5M # -> total: 25M # 9 user download (9 connection) # -> masing-masing dapat 5M # -> total: 45M (max total) # 10 user download (10 connection) # -> total max 45M, dibagi rata # -> masing-masing dapat 4.5M # KEUNTUNGAN PCQ: # - Fair sharing otomatis # - Tidak perlu buat queue per user # - Bandwidth terpakai maksimal # - User baru otomatis dapat jatah
KAPAN PAKAI PCQ?
BANYAK USER
Hotspot, kantor dengan banyak user. PCQ otomatis bagi rata tanpa perlu set limit per user.
FAIR SHARING
Ingin semua user dapat jatah adil. Tidak ada yang bisa boros bandwidth.
MAKSIMALKAN BANDWIDTH
Bandwidth ISP selalu terpakai maksimal. Tidak ada bandwidth idle.
JANGAN PAKAI UNTUK
User dengan kebutuhan berbeda (boss vs staff). PCQ bagi rata, tidak ada prioritas.
TIPS: Kombinasi PCQ + Priority = QoS optimal. PCQ untuk fair sharing dalam kategori, Priority untuk prioritas antar kategori. Contoh: game (P1) + PCQ, browsing (P3) + PCQ, download (P8) + PCQ.
PRIORITY QUEUE CORE

Priority menentukan siapa dapat jatah bandwidth dulu saat bandwidth penuh. Priority 1 = paling prioritas, 8 = paling rendah.

SETUP PRIORITY
PRIORITY
# priority di queue tree [admin@QT-GATEWAY] > /queue tree set [find name="game-download"] priority=1 [admin@QT-GATEWAY] > /queue tree set [find name="browse-download"] priority=3 [admin@QT-GATEWAY] > /queue tree set [find name="stream-download"] priority=5 [admin@QT-GATEWAY] > /queue tree set [find name="download-download"] priority=8 # priority bisa berbeda untuk upload dan download # format: priority=upload/download [admin@QT-GATEWAY] > /queue tree set [find name="game-upload"] priority=1/1 [admin@QT-GATEWAY] > /queue tree set [find name="browse-upload"] priority=3/3
REKOMENDASI PRIORITY
PRIORITYLEVELAPLIKASI
1TERTINGGIGame online, VoIP, video call
2-3TINGGIBrowsing, email, aplikasi bisnis
4-5SEDANGStreaming video, music
6-7RENDAHSocial media, update otomatis
8TERENDAHDownload, torrent, backup, P2P
BAGAIMANA PRIORITY BEKERJA?
HOW PRIORITY WORKS
# SKENARIO: Bandwidth parent PENUH (45M) # game (P1): limit-at 5M, max 10M # browse (P3): limit-at 10M, max 20M # stream (P5): limit-at 10M, max 20M # download (P8): limit-at 5M, max 10M # Step 1: Bagi limit-at (guaranteed) # game: 5M, browse: 10M, stream: 10M, download: 5M # Total: 30M (sisanya 15M) # Step 2: Sisa bandwidth dibagi berdasarkan priority # Priority 1 (game) dapat duluan # -> game dapat tambahan sampai max 10M # -> sisa: 15 - 5 = 10M # Priority 3 (browse) dapat berikutnya # -> browse dapat tambahan sampai max 20M # -> sisa: 10 - 10 = 0M # Priority 5, 8 tidak dapat tambahan # -> tetap di limit-at # HASIL AKHIR: # game: 10M (max) # browse: 20M (max) # stream: 10M (limit-at) # download: 5M (limit-at) # Total: 45M
TIPS: Priority hanya bekerja saat bandwidth PENUH. Saat bandwidth cukup, semua child dapat sesuai max-limit. Priority menentukan siapa dapat jatah DULUAN saat bandwidth kurang.
BURST CONFIGURATION ADVANCED

Burst memungkinkan queue dapat bandwidth lebih besar dari max-limit untuk waktu singkat. Berguna untuk loading page, download file kecil.

SETUP BURST
BURST
# burst di queue tree [admin@QT-GATEWAY] > /queue tree set [find name="browse-download"] burst-max-limit="30M" burst-threshold="15M" burst-time="10s" bucket-size="0.1" # PENJELASAN: # burst-max-limit = bandwidth saat burst (30M) # burst-threshold = threshold untuk aktifkan burst (15M) # jika traffic < threshold, burst aktif # burst-time = durasi burst (10 detik) # bucket-size = ukuran bucket (0.1 = 10% dari burst-time) # CARA KERJA: # 1. Client mulai browsing # 2. Traffic < 15M (threshold) -> burst aktif # 3. Client dapat 30M (burst-max-limit) # 4. Setelah 10 detik, burst habis # 5. Client turun ke 20M (max-limit)
KAPAN PAKAI BURST?
LOADING WEB PAGE
Burst membantu loading page cepat. Setelah page loaded, traffic turun ke max-limit.
DOWNLOAD FILE KECIL
File <10MB dapat download cepat dengan burst. File besar tetap di-limit max-limit.
BUFFERING VIDEO
Burst membantu buffering awal video. Setelah buffer penuh, streaming lancar di max-limit.
JANGAN PAKAI UNTUK
Download besar (torrent, backup). Burst akan habis cepat, lalu turun ke max-limit. Tidak efektif.
TIPS: Burst tidak menambah bandwidth total. Jika bandwidth ISP penuh, burst tidak akan aktif. Burst hanya berguna jika ada bandwidth idle yang bisa "dipinjam" sementara.
PER-IP DYNAMIC QUEUE ADVANCED

Untuk hotspot atau network dengan banyak client dynamic, bisa generate queue tree per IP otomatis menggunakan script + PCQ.

PCQ PER-IP (OTOMATIS)
PCQ PER-IP
# PCQ otomatis membuat queue per IP # tidak perlu script manual # 1. buat queue type PCQ [admin@QT-GATEWAY] > /queue type add name="pcq-per-ip-down" kind=pcq pcq-classifier=dst-address pcq-rate="5M" pcq-limit-at="2M" pcq-total-limit="45M" [admin@QT-GATEWAY] > /queue type add name="pcq-per-ip-up" kind=pcq pcq-classifier=src-address pcq-rate="2M" pcq-limit-at="1M" pcq-total-limit="10M" # 2. buat queue tree dengan PCQ [admin@QT-GATEWAY] > /queue tree add name="all-download" parent=global max-limit="45M" queue="pcq-per-ip-down" [admin@QT-GATEWAY] > /queue tree add name="all-upload" parent=global max-limit="10M" queue="pcq-per-ip-up" # PCQ akan otomatis: # - buat queue per IP saat client connect # - bagi bandwidth rata ke semua IP # - hapus queue saat client disconnect # cek queue aktif [admin@QT-GATEWAY] > /queue tree print # NAME PARENT MAX-LIMIT QUEUE 0 all-download global 45M pcq-per-ip-down 1 all-upload global 10M pcq-per-ip-up # saat ada client, PCQ otomatis buat sub-queue [admin@QT-GATEWAY] > /queue tree print # NAME PARENT MAX-LIMIT QUEUE 0 all-download global 45M pcq-per-ip-down 1 pcq_dst-10.10.10.101 all-download 5M pcq-download-default 2 pcq_dst-10.10.10.102 all-download 5M pcq-download-default 3 pcq_dst-10.10.10.103 all-download 5M pcq-download-default 4 all-upload global 10M pcq-per-ip-up 5 pcq_src-10.10.10.101 all-upload 2M pcq-upload-default 6 pcq_src-10.10.10.102 all-upload 2M pcq-upload-default 7 pcq_src-10.10.10.103 all-upload 2M pcq-upload-default
SCRIPT AUTO GENERATE (OPSIONAL)
SCRIPT
# jika butuh lebih kontrol, pakai script [admin@QT-GATEWAY] > /system script add name="gen-qt-per-ip" source=":foreach lease in=[/ip dhcp-server lease find where status=bound] do={ :local ip [/ip dhcp-server lease get $lease address]; :local mac [/ip dhcp-server lease get $lease mac-address]; :local host [/ip dhcp-server lease get $lease host-name]; :if ([/queue tree find where name=\"qt-$ip\"] = \"\") do={ /queue tree add name=(\"qt-\" . $ip) parent=download-total packet-mark=\"\" max-limit=\"5M\" priority=5 comment=(\"Auto: \" . $host) } }" # jalankan script [admin@QT-GATEWAY] > /system script run gen-qt-per-ip # jadwalkan otomatis tiap 5 menit [admin@QT-GATEWAY] > /system scheduler add name="auto-qt" interval=5m on-event="gen-qt-per-ip"
REKOMENDASI: Untuk kebanyakan kasus, PCQ per-IP sudah cukup. Tidak perlu script manual. PCQ lebih efisien dan otomatis handle dynamic client.
TIME-BASED QUEUE TREE ADVANCED

Aktifkan/nonaktifkan queue tree berdasarkan waktu. Berguna untuk limit bandwidth di jam tertentu saja.

SETUP TIME-BASED
TIME-BASED
# queue tree aktif hanya jam kerja (08:00 - 17:00) [admin@QT-GATEWAY] > /queue tree set [find name="download-total"] time="8h-17h,sun,mon,tue,wed,thu,fri" # queue tree aktif hanya malam (19:00 - 23:00) [admin@QT-GATEWAY] > /queue tree add name="malam-only" parent=global max-limit="20M" time="19h-23h" # queue tree aktif hanya weekend [admin@QT-GATEWAY] > /queue tree add name="weekend-only" parent=global max-limit="40M" time="sat,sun" # format time: # Xh-Yh = jam X sampai jam Y # sun,mon,tue,wed,thu,fri,sat = hari # bisa kombinasi: "8h-17h,mon-fri"
SCHEDULER ALTERNATIF
SCHEDULER
# alternatif: pakai scheduler untuk enable/disable queue tree # scheduler untuk enable jam 19:00 [admin@QT-GATEWAY] > /system scheduler add name="enable-malam" start-time="19:00:00" interval=1d on-event="/queue tree enable [find name=\"malam-only\"]" # scheduler untuk disable jam 07:00 [admin@QT-GATEWAY] > /system scheduler add name="disable-malam" start-time="07:00:00" interval=1d on-event="/queue tree disable [find name=\"malam-only\"]"
KASUS PENGGUNAAN
JAM KERJA KANTOR
Limit bandwidth ketat jam 08:00-17:00 untuk produktivitas. Longgar di luar jam kerja.
MALAM HARI
Limit download/torrent malam hari untuk hemat bandwidth. Pagi hari bebas.
WEEKEND VS WEEKDAY
Limit berbeda untuk weekday (ketat) dan weekend (longgar). Sesuai pola penggunaan.
JAM SEKOLAH
Limit social media/game jam sekolah. Bebas di luar jam sekolah untuk anak.
TIPS: Pastikan NTP sinkron sebelum pakai time-based queue. Jika waktu router salah, queue tidak aktif sesuai jadwal. Cek dengan /system clock print.
QUEUE TREE UNTUK HOTSPOT ADVANCED

Integrasi Queue Tree dengan Hotspot untuk limit bandwidth per user/voucher dengan QoS advanced.

HOTSPOT USER PROFILE
HOTSPOT PROFILE
# buat user profile dengan rate-limit [admin@QT-GATEWAY] > /ip hotspot user profile add name="1jam-2Mbps" rate-limit="2M/5M" idle-timeout="10m" shared-users=1 [admin@QT-GATEWAY] > /ip hotspot user profile add name="3jam-5Mbps" rate-limit="5M/10M" idle-timeout="15m" shared-users=1 [admin@QT-GATEWAY] > /ip hotspot user profile add name="1hari-10Mbps" rate-limit="10M/20M" idle-timeout="30m" shared-users=2 # saat user login hotspot: # - queue otomatis dibuat sesuai profile # - user dapat bandwidth sesuai rate-limit # saat user logout: # - queue otomatis dihapus
QUEUE TREE GLOBAL HOTSPOT
GLOBAL HOTSPOT
# buat queue tree global untuk semua hotspot user [admin@QT-GATEWAY] > /queue tree add name="hotspot-total" parent=global max-limit="45M" queue="pcq-per-ip-down" # queue ini membatasi total bandwidth semua hotspot user # masing-masing user tetap di-limit oleh profile rate-limit # PCQ membagi rata ke semua user # cek queue hotspot [admin@QT-GATEWAY] > /queue tree print # NAME PARENT MAX-LIMIT QUEUE 0 hotspot-total global 45M pcq-per-ip-down 1 hs-v001 hotspot-total 5M/2M <- auto 2 hs-v002 hotspot-total 10M/5M <- auto 3 hs-v003 hotspot-total 20M/10M <- auto
MANGLE UNTUK HOTSPOT
HOTSPOT MANGLE
# mark connection untuk hotspot user [admin@QT-GATEWAY] > /ip firewall mangle add chain=prerouting action=mark-connection new-connection-mark="conn-hotspot" in-interface=bridge hotspot=auth passthrough=yes # mark packet untuk hotspot [admin@QT-GATEWAY] > /ip firewall mangle add chain=prerouting action=mark-packet new-packet-mark="pkt-hotspot-up" connection-mark="conn-hotspot" in-interface=bridge passthrough=no [admin@QT-GATEWAY] > /ip firewall mangle add chain=prerouting action=mark-packet new-packet-mark="pkt-hotspot-down" connection-mark="conn-hotspot" in-interface=ether1 passthrough=no # queue tree untuk hotspot [admin@QT-GATEWAY] > /queue tree add name="hotspot-download" parent="hotspot-total" packet-mark="pkt-hotspot-down" max-limit="45M" queue="pcq-per-ip-down" [admin@QT-GATEWAY] > /queue tree add name="hotspot-upload" parent=global packet-mark="pkt-hotspot-up" max-limit="10M" queue="pcq-per-ip-up"
TIPS: Untuk hotspot, pakai user profile rate-limit + queue tree global dengan PCQ. Hotspot otomatis handle queue per user. Queue tree global untuk total bandwidth semua user.
QUEUE TREE UNTUK GAME & STREAMING SCENARIO

Setup Queue Tree khusus untuk game online dan streaming video dengan priority dan limit yang optimal.

GAME ONLINE (PRIORITY 1)
GAME QUEUE
# mark connection game (port game online) # Mobile Legends, PUBG, Free Fire, dll [admin@QT-GATEWAY] > /ip firewall mangle add chain=prerouting action=mark-connection new-connection-mark="conn-game" protocol=udp dst-port="30000-40000" passthrough=yes [admin@QT-GATEWAY] > /ip firewall mangle add chain=prerouting action=mark-connection new-connection-mark="conn-game" protocol=tcp dst-port="10000-20000" passthrough=yes # mark packet game [admin@QT-GATEWAY] > /ip firewall mangle add chain=prerouting action=mark-packet new-packet-mark="pkt-game-up" connection-mark="conn-game" in-interface=bridge passthrough=no [admin@QT-GATEWAY] > /ip firewall mangle add chain=prerouting action=mark-packet new-packet-mark="pkt-game-down" connection-mark="conn-game" in-interface=ether1 passthrough=no # queue tree game (priority 1 - tertinggi) [admin@QT-GATEWAY] > /queue tree add name="game-download" parent="download-total" packet-mark="pkt-game-down" limit-at="5M" max-limit="10M" priority=1 queue="pcq-per-ip-down" [admin@QT-GATEWAY] > /queue tree add name="game-upload" parent="upload-total" packet-mark="pkt-game-up" limit-at="2M" max-limit="5M" priority=1 queue="pcq-per-ip-up" # Game butuh: # - Latency rendah (priority 1) # - Bandwidth kecil tapi stabil (limit-at) # - PCQ untuk fair sharing antar player
STREAMING VIDEO (PRIORITY 5)
STREAM QUEUE
# mark connection streaming (YouTube, Netflix, dll) [admin@QT-GATEWAY] > /ip firewall mangle add chain=prerouting action=mark-connection new-connection-mark="conn-stream" protocol=tcp dst-port="443" dst-address-list="streaming-servers" passthrough=yes # atau pakai Layer 7 (berat CPU) [admin@QT-GATEWAY] > /ip firewall mangle add chain=prerouting action=mark-connection new-connection-mark="conn-stream" layer7-protocol="streaming" passthrough=yes # mark packet streaming [admin@QT-GATEWAY] > /ip firewall mangle add chain=prerouting action=mark-packet new-packet-mark="pkt-stream-up" connection-mark="conn-stream" in-interface=bridge passthrough=no [admin@QT-GATEWAY] > /ip firewall mangle add chain=prerouting action=mark-packet new-packet-mark="pkt-stream-down" connection-mark="conn-stream" in-interface=ether1 passthrough=no # queue tree streaming (priority 5 - medium) [admin@QT-GATEWAY] > /queue tree add name="stream-download" parent="download-total" packet-mark="pkt-stream-down" limit-at="10M" max-limit="20M" priority=5 queue="pcq-per-ip-down" [admin@QT-GATEWAY] > /queue tree add name="stream-upload" parent="upload-total" packet-mark="pkt-stream-up" limit-at="2M" max-limit="5M" priority=5 queue="pcq-per-ip-up" # Streaming butuh: # - Bandwidth besar (untuk video HD) # - Priority medium (bukan kritis) # - PCQ untuk fair sharing antar viewer
BROWSING (PRIORITY 3)
BROWSE QUEUE
# mark connection browsing (HTTP/HTTPS) [admin@QT-GATEWAY] > /ip firewall mangle add chain=prerouting action=mark-connection new-connection-mark="conn-browse" protocol=tcp dst-port="80,443" passthrough=yes # mark packet browsing [admin@QT-GATEWAY] > /ip firewall mangle add chain=prerouting action=mark-packet new-packet-mark="pkt-browse-up" connection-mark="conn-browse" in-interface=bridge passthrough=no [admin@QT-GATEWAY] > /ip firewall mangle add chain=prerouting action=mark-packet new-packet-mark="pkt-browse-down" connection-mark="conn-browse" in-interface=ether1 passthrough=no # queue tree browsing (priority 3 - high) [admin@QT-GATEWAY] > /queue tree add name="browse-download" parent="download-total" packet-mark="pkt-browse-down" limit-at="10M" max-limit="20M" priority=3 queue="pcq-per-ip-down" burst-max-limit="30M" burst-threshold="15M" burst-time="10s" [admin@QT-GATEWAY] > /queue tree add name="browse-upload" parent="upload-total" packet-mark="pkt-browse-up" limit-at="2M" max-limit="5M" priority=3 queue="pcq-per-ip-up" # Browsing butuh: # - Priority tinggi (untuk loading page cepat) # - Burst untuk loading page # - PCQ untuk fair sharing
DOWNLOAD (PRIORITY 8)
DOWNLOAD QUEUE
# mark connection download (port umum) [admin@QT-GATEWAY] > /ip firewall mangle add chain=prerouting action=mark-connection new-connection-mark="conn-download" protocol=tcp dst-port="20,21,8080" passthrough=yes # mark packet download [admin@QT-GATEWAY] > /ip firewall mangle add chain=prerouting action=mark-packet new-packet-mark="pkt-download-up" connection-mark="conn-download" in-interface=bridge passthrough=no [admin@QT-GATEWAY] > /ip firewall mangle add chain=prerouting action=mark-packet new-packet-mark="pkt-download-down" connection-mark="conn-download" in-interface=ether1 passthrough=no # queue tree download (priority 8 - lowest) [admin@QT-GATEWAY] > /queue tree add name="download-download" parent="download-total" packet-mark="pkt-download-down" limit-at="5M" max-limit="10M" priority=8 queue="pcq-per-ip-down" [admin@QT-GATEWAY] > /queue tree add name="download-upload" parent="upload-total" packet-mark="pkt-download-up" limit-at="1M" max-limit="2M" priority=8 queue="pcq-per-ip-up" # Download butuh: # - Priority rendah (bisa ditunda) # - Bandwidth cukup untuk download cepat # - PCQ untuk fair sharing
RINGKASAN PRIORITY
APLIKASIPRIORITYLIMIT-ATMAX-LIMITKETERANGAN
Game15M/2M10M/5MLatency rendah, bandwidth kecil
Browsing310M/2M20M/5MLoading page cepat, burst
Streaming510M/2M20M/5MBandwidth besar untuk video
Download85M/1M10M/2MBisa ditunda, priority rendah
TIPS: Kombinasi priority + limit-at + PCQ = QoS optimal. Priority menentukan siapa dapat duluan, limit-at menjamin minimum, PCQ membagi rata dalam kategori.
MONITORING QUEUE TREE ADVANCED

Monitor penggunaan bandwidth per queue tree untuk troubleshooting dan optimasi.

CEK QUEUE TREE AKTIF
MONITOR
# list semua queue tree dengan usage [admin@QT-GATEWAY] > /queue tree print # NAME PARENT PACKET-MARK RATE 0 upload-total global 3M/8M 1 game-upload upload-total pkt-game-up 1M/2M 2 browse-upload upload-total pkt-browse-up 1M/3M 3 stream-upload upload-total pkt-stream-up 512k/1M 4 download-upload upload-total pkt-download-up 256k/512k 5 download-total global 25M/35M 6 game-download download-total pkt-game-down 5M/8M 7 browse-download download-total pkt-browse-down 10M/15M 8 stream-download download-total pkt-stream-down 8M/10M 9 download-download download-total pkt-download-down 2M/5M # RATE = bandwidth saat ini (real-time) # jika RATE = MAX-LIMIT, berarti queue penuh # detail per queue [admin@QT-GATEWAY] > /queue tree print detail 0 name="game-download" parent=download-total packet-mark=pkt-game-down limit-at=5M max-limit=10M priority=1 rate=5M/8M packets=154320/121000 bytes=1.2GB/450MB dropped=120/50
TRAFFIC MONITOR
TRAFFIC
# traffic monitor real-time per interface [admin@QT-GATEWAY] > /tool traffic-monitor interface=ether1 # torch - lihat traffic per IP [admin@QT-GATEWAY] > /tool torch interface=bridge # SRC-ADDRESS DST-ADDRESS PROTO BYTES 0 10.10.10.101 142.250.x.x tcp 1.2MB 1 10.10.10.102 157.240.x.x tcp 450KB 2 10.10.10.103 31.13.x.x tcp 230KB # graphing (historical) [admin@QT-GATEWAY] > /tool graphing interface add interface=ether1 # akses via http://10.10.10.1/graph/
CEK MANGLE MARK
MANGLE
# cek mangle rules [admin@QT-GATEWAY] > /ip firewall mangle print # cek connection-mark aktif [admin@QT-GATEWAY] > /ip firewall connection print where connection-mark!="" # cek packet-mark aktif [admin@QT-GATEWAY] > /ip firewall connection print where packet-mark!="" # hit count (berapa kali rule match) [admin@QT-GATEWAY] > /ip firewall mangle print stats
LOG QUEUE
LOG
# aktifkan logging untuk queue [admin@QT-GATEWAY] > /system logging add topics="queue" action=memory # lihat log [admin@QT-GATEWAY] > /log print where topics="queue" # log akan mencatat: # - queue created/removed # - queue limit reached # - packet dropped
TIPS: Monitor queue tree rutin untuk deteksi masalah. Jika RATE = MAX-LIMIT terus, berarti client butuh bandwidth lebih. Jika dropped tinggi, pertimbangkan naikkan limit atau tambah bandwidth ISP.
TROUBLESHOOTING QUEUE TREE SUPPORT

Masalah umum Queue Tree dan solusinya.

QUEUE TREE TIDAK BEKERJA (CLIENT TETAP DAPAT FULL BANDWIDTH)
KEMUNGKINAN PENYEBAB:
1. Packet-mark tidak ter-mark - cek Mangle rule
2. Connection-mark tidak ada - cek urutan Mangle
3. Queue tree parent salah - cek parent queue
4. Queue tree disabled - cek status enabled
5. Packet-mark nama salah (typo) - cek spelling
SOLUSI: Cek Mangle mark connection & mark packet. Pastikan urutan benar. Cek queue tree parent & packet-mark match.
MANGLE TIDAK MARK PACKET
KEMUNGKINAN PENYEBAB:
1. Mark connection di bawah mark packet - urutan salah
2. Mark connection passthrough=no - packet tidak lanjut
3. Mark packet passthrough=yes - packet lanjut ke rule lain
4. Kriteria mark salah (port, protocol, address)
SOLUSI: Mark connection HARUS di atas mark packet. Mark connection passthrough=yes, mark packet passthrough=no.
CPU LOAD TINGGI (>80%) SAAT QUEUE TREE AKTIF
KEMUNGKINAN PENYEBAB:
1. Terlalu banyak Mangle rule
2. Terlalu banyak Queue Tree rule
3. Layer 7 protocol aktif (berat CPU)
4. Bandwidth terlalu tinggi untuk RB941
SOLUSI: Kurangi jumlah rule Mangle & Queue Tree. Disable Layer 7. Turunkan bandwidth. Upgrade hardware jika perlu.
PCQ TIDAK BAGI RATA
KEMUNGKINAN PENYEBAB:
1. PCQ classifier salah (src-address vs dst-address)
2. pcq-rate terlalu besar
3. pcq-total-limit terlalu kecil
4. Parent queue limit terlalu kecil
SOLUSI: Cek PCQ classifier. Untuk download pakai dst-address, untuk upload pakai src-address. Set pcq-rate sesuai kebutuhan.
PRIORITY TIDAK BEKERJA (SEMUA CLIENT DAPAT SAMA)
KEMUNGKINAN PENYEBAB:
1. Bandwidth tidak penuh - priority hanya bekerja saat bandwidth penuh
2. Semua queue priority sama
3. limit-at terlalu besar (melebihi parent)
SOLUSI: Test saat bandwidth penuh. Pastikan priority berbeda. Cek limit-at tidak melebihi parent.
QUEUE TREE HIERARCHY SALAH
KEMUNGKINAN PENYEBAB:
1. Parent queue tidak ada - cek parent name
2. Parent queue disabled - enable parent dulu
3. Circular reference (child jadi parent dirinya)
4. Total limit child melebihi parent
SOLUSI: Cek parent queue ada & enabled. Pastikan tidak circular. Total limit child tidak harus sama parent, tapi limit-at child tidak boleh melebihi parent.
DIAGNOSTIC COMMANDS
DIAGNOSTIC
# cek queue tree [admin@QT-GATEWAY] > /queue tree print [admin@QT-GATEWAY] > /queue tree print detail # cek mangle [admin@QT-GATEWAY] > /ip firewall mangle print # cek connection mark [admin@QT-GATEWAY] > /ip firewall connection print where connection-mark!="" # cek CPU load [admin@QT-GATEWAY] > /system resource print # traffic monitor [admin@QT-GATEWAY] > /tool traffic-monitor interface=ether1 # torch per IP [admin@QT-GATEWAY] > /tool torch interface=bridge # test speed [admin@QT-GATEWAY] > /tool bandwidth-test 10.10.10.101 duration=10s direction=both
BEST PRACTICE QUEUE TREE TIPS
URUTAN MANGLE
Mark connection di atas mark packet. Rule spesifik di atas rule general. Passthrough=yes untuk mark connection, no untuk mark packet.
HIERARCHY JELAS
Parent = total bandwidth, child = sub-bagian. Jangan terlalu dalam (max 3-4 level). Dokumentasikan hierarki.
PRIORITY BERBEDA
Set priority berbeda sesuai kebutuhan. Game (P1), browsing (P3), streaming (P5), download (P8).
PAKAI PCQ
PCQ untuk fair sharing otomatis. Tidak perlu buat queue per user. Lebih efisien dan scalable.
BURST HEMAT
Pakai burst untuk browsing, bukan download besar. Burst-time 5-15 detik cukup.
HINDARI LAYER 7
Layer 7 berat CPU. Untuk RB941, batasi max 3-5 pattern. Lebih baik pakai DNS filtering atau address-list.
MONITOR RUTIN
Cek queue usage, CPU load, dropped packet. Deteksi dini jika ada masalah.
BACKUP CONFIG
Backup config sebelum ubah queue tree. Jika salah, bisa restore dengan cepat.
DOKUMENTASI
Dokumentasikan: Mangle rules, Queue Tree hierarchy, priority, limit. Update saat ada perubahan.
UPDATE ROUTEROS
Update ke versi stable terbaru untuk patch keamanan dan perbaikan bug queue.
UPGRADE JIKA PERLU
Jika RB941 overload, upgrade ke hAP ac^2 atau CCR. Jangan paksakan hardware di luar limit.
TEST DULU
Test queue tree di lab environment sebelum production. Pastikan Mangle mark & Queue Tree bekerja sesuai harapan.
INDIKATOR LED REFERENCE

LED di panel depan RB941 memberi informasi status router.

PWR
ON
Power normal
ACT
BLINK
Ada traffic
ETHER1
LINK
WAN OK
ETHER2-4
LINK
LAN OK
WLAN
BLINK
WiFi aktif
KONDISI LEDARTITINDAKAN
PWR ONPower normalOK
PWR OFFTidak ada powerCek adaptor/kabel
ACT BLINK CEPATTraffic tinggiNormal saat banyak client
ACT OFFTidak ada trafficCek koneksi
WLAN BLINKWiFi ada trafficNormal
WLAN OFFWiFi disabledAktifkan wireless
QUEUE TREE CHEATSHEET QUICK REF
QUEUE TREE COMMANDS
# MANGLE - MARK CONNECTION > /ip firewall mangle add chain=prerouting action=mark-connection new-connection-mark=conn-game protocol=udp dst-port=30000-40000 passthrough=yes # MANGLE - MARK PACKET > /ip firewall mangle add chain=prerouting action=mark-packet new-packet-mark=pkt-game-down connection-mark=conn-game in-interface=ether1 passthrough=no # QUEUE TREE - PARENT > /queue tree add name=download-total parent=global max-limit=45M # QUEUE TREE - CHILD > /queue tree add name=game-download parent=download-total packet-mark=pkt-game-down limit-at=5M max-limit=10M priority=1 # QUEUE TYPE - PCQ > /queue type add name=pcq-down kind=pcq pcq-classifier=dst-address pcq-rate=5M pcq-total-limit=45M # LAYER 7 PROTOCOL > /ip firewall layer7-protocol add name=youtube regexp="(^|\.)(youtube|googlevideo)\.com" # MONITORING > /queue tree print > /ip firewall mangle print > /ip firewall connection print where connection-mark!="" > /tool traffic-monitor interface=ether1 > /tool torch interface=bridge > /system resource print
ABDURROZAK.MY.ID // JARINGAN SOSIAL

s.id

Link Tree Utama

GitHub

Repositori Kode

Instagram

Galeri Visual

Threads

Diskusi Ringkas

Facebook

Jaringan Sosial

TikTok

Konten Video Pendek

YT Teacher

Edukasi & Tutorial

YT Course

Materi Pembelajaran

YT Studio

Produksi Konten

Hashnode

Artikel Teknis

WhatsApp

Komunikasi Langsung

Email

abdurrozak.skom@gmail.com