Setting Mikrotik Mengatur Bandwidth melalui Queue Tree

1. Memisahkan & Menandai Connection Paket "Out & In" Secara global
Menandai semua paket koneksi keluar & di lalu lintas mikrotik router, itu relatif tergantung pada interface yang digunakan. Koneksi paket keluar dari antarmuka lokal adalah koneksi paket Dalam dari antarmuka publik, itu adalah koneksi-download paket. Dan Out dari antarmuka lokal Dalam dari antarmuka publik, Ini adalah meng-upload koneksi paket. Hal ini diimplementasikan pada script di bawah ini!


/ip firewall mangle
add action=mark-connection chain=prerouting disabled=no in-interface=ether1 new-connection-mark=All-Inconn passthrough=yes comment="UPSTEAM CONNECTION"
add action=mark-packet chain=prerouting connection-mark=all-inconn disabled=no new-packet-mark=All-inpkt passthrough=yes comment="UPSTEAM"
add action=mark-connection chain=forward disabled=no in-interface=wlan1 new-connection-mark=All-Outconn passthrough=yes comment="DOWNSTEAM CONNECTION"
add action=mark-packet chain=forward connection-mark=all-outconn disabled=no new-packet-mark=All-Outpkt passthrough=yes comment="DOWNSTEAM"

/queue tree
add name=All-Bandwidth parent=global-out packet-mark=All-Outpkt queue=default priority=8 max-limit=2M

Kami akan fokus pada All-Out conn seperti yang Anda lihat sebagai script di atas, paket koneksi menggunakan rantai = maju dan out-interface = wlan1. Dari ini menandai kita mendapatkan All-Outpkt bahwa kita dapat memisahkan lagi untuk berbagai jenis paket koneksi yang kita butuhkan.

2. Memisahkan Paket Ambil Connection per Client IP
Download general packet All-Outpkt, kita akan memisahkan ke dalam paket-paket koneksi per client alamat IP, untuk menangkap download koneksi yang digunakan oleh klien. Hal ini diimplementasikan pada script berikut:
/ip firewall mangle
add action=mark-packet chain=forward dst-address=192.168.1.11 packet-mark=All-Outpkt new-packet-mark=Billing-pkt passthrough=yes comment="BILLING DOWNSTREAM"
add action=mark-packet chain=forward dst-address=192.168.1.17 packet-mark=All-Outpkt new-packet-mark=Client1-pkt passthrough=yes comment="CLIENT1 DOWNSTREAM"
add action=mark-packet chain=forward dst-address=192.168.1.16 packet-mark=All-Outpkt new-packet-mark=Client2-pkt passthrough=yes comment="CLIENT2 DOWNSTREAM"
add action=mark-packet chain=forward dst-address=192.168.1.15 packet-mark=All-Outpkt new-packet-mark=Client3-pkt passthrough=yes comment="CLIENT3 DOWNSTREAM"
add action=mark-packet chain=forward dst-address=192.168.1.14 packet-mark=All-Outpkt new-packet-mark=Client4-pkt passthrough=yes comment="CLIENT4 DOWNSTREAM"
add action=mark-packet chain=forward dst-address=192.168.1.20 packet-mark=All-Outpkt new-packet-mark=Client5-pkt passthrough=yes comment="CLIENT5 DOWNSTREAM"
add action=mark-packet chain=forward dst-address=192.168.1.21 packet-mark=All-Outpkt new-packet-mark=Client6-pkt passthrough=yes comment="CLIENT6 DOWNSTREAM"
add action=mark-packet chain=forward dst-address=192.168.1.8 packet-mark=All-Outpkt new-packet-mark=Master-pkt passthrough=yes comment="MASTER DOWNSTREAM"

/queue tree
add name=Billing parent=All-Bandwidth packet-mark=Billing-pkt queue=default priority=8 limit-at=256k max-limit=256k burst-limit=720k burst-threshold=192k burst-time=2s
add name=Client1 parent=All-Bandwidth packet-mark=Client1-pkt queue=default priority=8 limit-at=256k max-limit=256k burst-limit=720k burst-threshold=192k burst-time=2s
add name=Client2 parent=All-Bandwidth packet-mark=Client2-pkt queue=default priority=8 limit-at=256k max-limit=256k burst-limit=720k burst-threshold=192k burst-time=2s
add name=Client3 parent=All-Bandwidth packet-mark=Client3-pkt queue=default priority=8 limit-at=256k max-limit=256k burst-limit=720k burst-threshold=192k burst-time=2s
add name=Client4 parent=All-Bandwidth packet-mark=Client4-pkt queue=default priority=8 limit-at=256k max-limit=256k burst-limit=720k burst-threshold=192k burst-time=2s
add name=Client5 parent=All-Bandwidth packet-mark=Client5-pkt queue=default priority=8 limit-at=256k max-limit=256k burst-limit=720k burst-threshold=192k burst-time=2s
add name=Client6 parent=All-Bandwidth packet-mark=Client6-pkt queue=default priority=8 limit-at=256k max-limit=256k burst-limit=720k burst-threshold=192k burst-time=2s
add name=Master parent=All-Bandwidth packet-mark=Master-pkt queue=default priority=8 limit-at=256k max-limit=256k burst-limit=720k burst-threshold=192k burst-time=2s

Script mangle di atas disertakan dengan aturan pohon antrian. Dari sini kita telah membuat koneksi Download paket per klien, seperti

Paket koneksi Per Klien: Billing-pkt, client1-pkt, client1-pkt, Client2-pkt, client3-pkt, Client4-pkt, Client5-pkt, Client6-pkt, Guru-pkt


3. Memisahkan Ambil Paket Klien untuk Berbagai Paket Connection Kind
Sambungan paket per klien yang baru saja kita buat akan dibagi menjadi empat paket koneksi jenis seperti browsing, game online, download, video streaming. Kami akan membuat 4 jenis paket koneksi. Jika Anda ingin membuat jenis koneksi paket lain, Anda dapat menentukan menggunakan lapisan 7 protokol.

Bagian I: Membuat paket koneksi per client download dan setup prioritas dalam aturan pohon antrian seperti yang Anda inginkan, Anda dapat melihat skrip di bawah ini!


/ip firewall layer7-protocol
add comment="" name=download regexp="^.*get.+\\.(exe|rar|iso|zip|7zip|flv|mkv|avi|mp4|3gp|rmvb|mp3|img|dat|mov).*\$"
 
/ip firewall mangle
add chain=forward layer7-protocol=download action=mark-packet new-packet-mark=billing-dpkt passthrough=no packet-mark=Billing-pkt comment=Billing-Down
add chain=forward layer7-protocol=download action=mark-packet new-packet-mark=client1-dpkt passthrough=no packet-mark=Client1-pkt comment=Client1-Down
add chain=forward layer7-protocol=download action=mark-packet new-packet-mark=client2-dpkt passthrough=no packet-mark=Client2-pkt comment=Client2-Down
add chain=forward layer7-protocol=download action=mark-packet new-packet-mark=client3-dpkt passthrough=no packet-mark=Client3-pkt comment=Client3-Down
add chain=forward layer7-protocol=download action=mark-packet new-packet-mark=client4-dpkt passthrough=no packet-mark=Client4-pkt comment=Client4-Down
add chain=forward layer7-protocol=download action=mark-packet new-packet-mark=client5-dpkt passthrough=no packet-mark=Client5-pkt comment=Client5-Down
add chain=forward layer7-protocol=download action=mark-packet new-packet-mark=client6-dpkt passthrough=no packet-mark=Client6-pkt comment=Client6-Down
add chain=forward layer7-protocol=download action=mark-packet new-packet-mark=master-dpkt passthrough=no packet-mark=Master-pkt comment=Master-Down

/ip firewall mangle
add action=mark-packet chain=forward connection-bytes=1000000-0 src-port=80,443 passthrough=yes new-packet-mark=billing-dpkt packet-mark=Billing-pkt protocol=tcp comment="Billing-Down"
add action=mark-packet chain=forward connection-bytes=1000000-0 src-port=80,443 passthrough=yes new-packet-mark=client1-dpkt packet-mark=Client1-pkt protocol=tcp comment="Billing-Down"
add action=mark-packet chain=forward connection-bytes=1000000-0 src-port=80,443 passthrough=yes new-packet-mark=client2-dpkt packet-mark=Client1-pkt protocol=tcp comment="Billing-Down"
add action=mark-packet chain=forward connection-bytes=1000000-0 src-port=80,443 passthrough=yes new-packet-mark=client3-dpkt packet-mark=Client1-pkt protocol=tcp comment="Billing-Down"
add action=mark-packet chain=forward connection-bytes=1000000-0 src-port=80,443 passthrough=yes new-packet-mark=client4-dpkt packet-mark=Client1-pkt protocol=tcp comment="Billing-Down"
add action=mark-packet chain=forward connection-bytes=1000000-0 src-port=80,443 passthrough=yes new-packet-mark=client5-dpkt packet-mark=Client1-pkt protocol=tcp comment="Billing-Down"
add action=mark-packet chain=forward connection-bytes=1000000-0 src-port=80,443 passthrough=yes new-packet-mark=client6-dpkt packet-mark=Client1-pkt protocol=tcp comment="Billing-Down"
add action=mark-packet chain=forward connection-bytes=1000000-0 src-port=80,443 passthrough=yes new-packet-mark=master-dpkt packet-mark=Master-pkt protocol=tcp comment="Billing-Down"
  
/queue tree
add name=Billing-Down parent=Billing packet-mark=billing-dpkt queue=default priority=6 limit-at=180k max-limit=180k burst-limit=256k burst-threshold=135k burst-time=2s
add name=Client1-Down parent=Client1 packet-mark=client1-dpkt queue=default priority=6 limit-at=180k max-limit=180k burst-limit=256k burst-threshold=135k burst-time=2s
add name=Client2-Down parent=Client2 packet-mark=client2-dpkt queue=default priority=6 limit-at=180k max-limit=180k burst-limit=256k burst-threshold=135k burst-time=2s
add name=Client3-Down parent=Client3 packet-mark=client3-dpkt queue=default priority=6 limit-at=180k max-limit=180k burst-limit=256k burst-threshold=135k burst-time=2s
add name=Client4-Down parent=Client4 packet-mark=client4-dpkt queue=default priority=6 limit-at=180k max-limit=180k burst-limit=256k burst-threshold=135k burst-time=2s
add name=Client5-Down parent=Client5 packet-mark=client5-dpkt queue=default priority=6 limit-at=180k max-limit=180k burst-limit=256k burst-threshold=135k burst-time=2s
add name=Client6-Down parent=Client6 packet-mark=client6-dpkt queue=default priority=6 limit-at=180k max-limit=180k burst-limit=256k burst-threshold=135k burst-time=2s
add name=Master-Down parent=Master packet-mark=master-dpkt queue=default priority=6 limit-at=180k max-limit=180k burst-limit=256k burst-threshold=135k burst-time=2s

Di sini kita telah menggunakan paket koneksi per client dan membuat file download paket koneksi ekstensi, jadi jika ada file ekstensi yang ingin Anda membatasi, hanya menambahkan file ekstensi lain untuk lapisan ini 7 protokol seperti script di atas.

Bagian II. Membuat paket koneksi video streaming per klien dan aturan pohon antrian yang Anda berikan prioritas yang Anda inginkan. Berikut script yang bisa Anda sisipkan ke jendela terminal baru, yang membuat lebih mudah.

/ip firewall layer7-protocol
add comment="" name=streaming regexp="^.*get.+\\.(c.youtube.com|cdn.dailymotion.com|metacafe.com|mccont.com).*\$"

Jika script di atas tidak bekerja, coba regexp kedua di lapisan naskah 7 protokol seperti di bawah ini!
/ip firewall layer7-protocol
add comment="" name=streaming regexp="videoplayback|video"

/ip firewall mangle
add comment=Billing-Streams chain=forward layer7-protocol=streaming action=mark-packet new-packet-mark=billing-spkt passthrough=no packet-mark=Billing-pkt
add comment=Client1-Streams chain=forward layer7-protocol=streaming action=mark-packet new-packet-mark=client1-spkt passthrough=no packet-mark=Client1-pkt
add comment=Client2-Streams chain=forward layer7-protocol=streaming action=mark-packet new-packet-mark=client2-spkt passthrough=no packet-mark=Client2-pkt
add comment=Client3-Streams chain=forward layer7-protocol=streaming action=mark-packet new-packet-mark=client3-spkt passthrough=no packet-mark=Client3-pkt
add comment=Client4-Streams chain=forward layer7-protocol=streaming action=mark-packet new-packet-mark=client4-spkt passthrough=no packet-mark=Client4-pkt
add comment=Client5-Streams chain=forward layer7-protocol=streaming action=mark-packet new-packet-mark=client5-spkt passthrough=no packet-mark=Client5-pkt
add comment=Client6-Streams chain=forward layer7-protocol=streaming action=mark-packet new-packet-mark=client6-spkt passthrough=no packet-mark=Client6-pkt
add comment=Master-Streams chain=forward layer7-protocol=streaming action=mark-packet new-packet-mark=master-spkt passthrough=no packet-mark=Master-pkt
  
/queue tree
add name=Billing-Streams parent=Billing packet-mark=billing-spkt queue=default priority=7 limit-at=220k max-limit=220k burst-limit=256k burst-threshold=165k burst-time=2s
add name=Client1-Streams parent=Client1 packet-mark=client1-spkt queue=default priority=7 limit-at=220k max-limit=220k burst-limit=256k burst-threshold=165k burst-time=2s
add name=Client2-Streams parent=Client2 packet-mark=client2-spkt queue=default priority=7 limit-at=220k max-limit=220k burst-limit=256k burst-threshold=165k burst-time=2s
add name=Client3-Streams parent=Client3 packet-mark=client3-spkt queue=default priority=7 limit-at=220k max-limit=220k burst-limit=256k burst-threshold=165k burst-time=2s
add name=Client4-Streams parent=Client4 packet-mark=client4-spkt queue=default priority=7 limit-at=220k max-limit=220k burst-limit=256k burst-threshold=165k burst-time=2s
add name=Client5-Streams parent=Client5 packet-mark=client5-spkt queue=default priority=7 limit-at=220k max-limit=220k burst-limit=256k burst-threshold=165k burst-time=2s
add name=Client6-Streams parent=Client6 packet-mark=client6-spkt queue=default priority=7 limit-at=220k max-limit=220k burst-limit=256k burst-threshold=165k burst-time=2s
add name=Master-Streams parent=Master packet-mark=master-spkt queue=default priority=7 limit-at=220k max-limit=220k burst-limit=256k burst-threshold=165k burst-time=2s

Saya rasa ini adalah metode yang sama untuk membuat paket-paket koneksi seperti paket download yang menggunakan lapisan 7 protokol, yang memungkinkan Anda untuk membuat lebih banyak dan lebih paket koneksi yang Anda wan bersama Anda dapat memahami bahasa regexp

Bagian III: game Creatingthe online paket koneksi per client bersama-sama dengan aturan pohon antrian dan prioritas dari paket koneksi, di sini adalah script:
/ip firewall mangle
add action=mark-packet chain=forward packet-mark=All-Outpkt new-packet-mark=gpkt passthrough=yes protocol=tcp dst-port=5340-5352,6000-6152,10001-10011,14009-14030,18901-18909 comment="Online Game Portal"
add action=mark-packet chain=forward packet-mark=All-Outpkt new-packet-mark=gpkt passthrough=yes protocol=tcp dst-port=39190,27780,29000,22100,10009,4300,15001,15002,7341,7451
add action=mark-packet chain=forward packet-mark=All-Outpkt new-packet-mark=gpkt passthrough=yes protocol=tcp dst-port=40000,9300,9400,9700,7342,8005-8010,37466,36567,8822
add action=mark-packet chain=forward packet-mark=All-Outpkt new-packet-mark=gpkt passthrough=yes protocol=tcp dst-port=47611,16666,20000,5105,29000,18901-18909,9015
add action=mark-packet chain=forward packet-mark=All-Outpkt new-packet-mark=gpkt passthrough=yes protocol=udp dst-port=27005,27015
add action=mark-packet chain=forward packet-mark=All-Outpkt new-packet-mark=gpkt passthrough=yes protocol=udp dst-port=27005-27020,13055,7800-7900,12060-12070
add action=mark-packet chain=forward packet-mark=All-Outpkt new-packet-mark=gpkt passthrough=yes protocol=udp dst-port=8005-8010,9068,1293,1479,9401,9600,30000
add action=mark-packet chain=forward packet-mark=All-Outpkt new-packet-mark=gpkt passthrough=yes protocol=udp dst-port=14009-14030,42051-42052,40000-40050,13000-13080
 
/ip firewall mangle
add action=mark-packet chain=forward new-packet-mark=billing-gpkt passthrough=no src-address=192.168.1.11 packet-mark=gpkt comment=Billing-Game
add action=mark-packet chain=forward new-packet-mark=client1-gpkt passthrough=no src-address=192.168.1.17 packet-mark=gpkt comment=Client1-Game
add action=mark-packet chain=forward new-packet-mark=client2-gpkt passthrough=no src-address=192.168.1.16 packet-mark=gpkt comment=Client2-Game
add action=mark-packet chain=forward new-packet-mark=client3-gpkt passthrough=no src-address=192.168.1.15 packet-mark=gpkt comment=Client3-Game
add action=mark-packet chain=forward new-packet-mark=client4-gpkt passthrough=no src-address=192.168.1.14 packet-mark=gpkt comment=Client4-Game
add action=mark-packet chain=forward new-packet-mark=client5-gpkt passthrough=no src-address=192.168.1.20 packet-mark=gpkt comment=Client5-Game
add action=mark-packet chain=forward new-packet-mark=client6-gpkt passthrough=no src-address=192.168.1.21 packet-mark=gpkt comment=Client6-Game
add action=mark-packet chain=forward new-packet-mark=master-gpkt passthrough=no src-address=192.168.1.8 packet-mark=gpkt comment=Master-Game

/queue tree
add name=Billing-Game parent=Billing packet-mark=billing-gpkt queue=default priority=1 limit-at=220k max-limit=220k burst-limit=256k burst-threshold=165k burst-time=2s
add name=Client1-Game parent=Client1 packet-mark=client1-gpkt queue=default priority=1 limit-at=220k max-limit=220k burst-limit=256k burst-threshold=165k burst-time=2s
add name=Client2-Game parent=Client2 packet-mark=client2-gpkt queue=default priority=1 limit-at=220k max-limit=220k burst-limit=256k burst-threshold=165k burst-time=2s
add name=Client3-Game parent=Client3 packet-mark=client3-gpkt queue=default priority=1 limit-at=220k max-limit=220k burst-limit=256k burst-threshold=165k burst-time=2s
add name=Client4-Game parent=Client4 packet-mark=client4-gpkt queue=default priority=1 limit-at=220k max-limit=220k burst-limit=256k burst-threshold=165k burst-time=2s
add name=Client5-Game parent=Client5 packet-mark=client5-gpkt queue=default priority=1 limit-at=220k max-limit=220k burst-limit=256k burst-threshold=165k burst-time=2s
add name=Client6-Game parent=Client6 packet-mark=client6-gpkt queue=default priority=1 limit-at=220k max-limit=220k burst-limit=256k burst-threshold=165k burst-time=2s
add name=Master-Game parent=Master packet-mark=master-gpkt queue=default priority=1 limit-at=220k max-limit=220k burst-limit=256k burst-threshold=165k burst-time=2s

Dalam hal ini kita memiliki menciptakan koneksi online-game, menggunakan tcp pelabuhan dan permainan udp yang telah digunakan oleh game online server. Oleh karena itu Anda harus port game online yang biasanya digunakan. Di sini saya mengumpulkan port menjadi satu sebelum kita dapat memisahkan berdasarkan alamat IP dari klien yang Anda miliki. Lalu akhirnya kita bisa menangkap paket game online dalam aturan pohon antrian untuk prioritas dan mengelola bandwidth untuk ini.

Bagian IV. Membuat paket koneksi penjelajahan per klien lengkap dengan aturan pohon antrian dan memberikan Anda dapat melihat pada script di bawah ini:
/ip firewall mangle
add action=mark-packet chain=forward connection-bytes=0-1000000 src-port=80,443 passthrough=no packet-mark=Billing-pkt new-packet-mark=billing-bpkt protocol=tcp comment="BILLING BROWSING"
add action=mark-packet chain=forward connection-bytes=0-1000000 src-port=80,443 passthrough=no packet-mark=Client1-pkt new-packet-mark=client1-bpkt protocol=tcp comment="CLIENT1 BROWSING"
add action=mark-packet chain=forward connection-bytes=0-1000000 src-port=80,443 passthrough=no packet-mark=Client2-pkt new-packet-mark=client2-bpkt protocol=tcp comment="CLIENT2 BROWSING"
add action=mark-packet chain=forward connection-bytes=0-1000000 src-port=80,443 passthrough=no packet-mark=Client3-pkt new-packet-mark=client3-bpkt protocol=tcp comment="CLIENT3 BROWSING"
add action=mark-packet chain=forward connection-bytes=0-1000000 src-port=80,443 passthrough=no packet-mark=Client4-pkt new-packet-mark=client4-bpkt protocol=tcp comment="CLIENT4 BROWSING"
add action=mark-packet chain=forward connection-bytes=0-1000000 src-port=80,443 passthrough=no packet-mark=Client5-pkt new-packet-mark=client5-bpkt protocol=tcp comment="CLIENT5 BROWSING"
add action=mark-packet chain=forward connection-bytes=0-1000000 src-port=80,443 passthrough=no packet-mark=Client6-pkt new-packet-mark=client6-bpkt protocol=tcp comment="CLIENT6 BROWSING"
add action=mark-packet chain=forward connection-bytes=0-1000000 src-port=80,443 passthrough=no packet-mark=Master-pkt new-packet-mark=master-bpkt protocol=tcp comment="MASTER BROWSING"
 
/queue tree
add name="Billing-Browsing" parent=Billing packet-mark=billing-bpkt queue=default priority=2 limit-at=256k max-limit=256k burst-limit=720k burst-threshold=192k burst-time=2s
add name="Client1-Browsing" parent=Client1 packet-mark=client1-bpkt queue=default priority=2 limit-at=256k max-limit=256k burst-limit=720k burst-threshold=192k burst-time=2s
add name="Client2-Browsing" parent=Client2 packet-mark=client2-bpkt queue=default priority=2 limit-at=256k max-limit=256k burst-limit=720k burst-threshold=192k burst-time=2s
add name="Client3-Browsing" parent=Client3 packet-mark=client3-bpkt queue=default priority=2 limit-at=256k max-limit=256k burst-limit=720k burst-threshold=192k burst-time=2s
add name="Client4-Browsing" parent=Client4 packet-mark=client4-bpkt queue=default priority=2 limit-at=256k max-limit=256k burst-limit=720k burst-threshold=192k burst-time=2s
add name="Client5-Browsing" parent=Client5 packet-mark=client5-bpkt queue=default priority=2 limit-at=256k max-limit=256k burst-limit=720k burst-threshold=192k burst-time=2s
add name="Client6-Browsing" parent=Client6 packet-mark=client6-bpkt queue=default priority=2 limit-at=256k max-limit=256k burst-limit=720k burst-threshold=192k burst-time=2s
add name="Master-Browsing" parent=Master packet-mark=master-bpkt queue=default priority=2 limit-at=256k max-limit=256k burst-limit=720k burst-threshold=192k burst-time=2s

Kami masih menggunakan paket koneksi per client untuk membuat paket koneksi browsing. Di sini kita menggunakan port 80 dan 443 (HTTP dan HTTPS), kita mendefinisikan byte kecil koneksi-bytes = 0-1000000, yang menggunakan port biasanya digunakan ketika klien isi setiap url dari website.

Di sini kita hanya menerapkan "Parent penuh Bandwidth Manajemen Queue Tree", maka Anda dapat menyesuaikan script dengan interface mikrotik router yang Anda miliki digunakan, Alamat IP dari klien yang Anda miliki, sehingga Anda dapat mengelola aturan pohon antrian sebagai hasil akhir. Untuk lebih cepat Anda hanya perlu menyalin semua skrip ke jendela terminal baru winbox tersebut. Jadi ini adalah Paket sehubungan dengan dibagi menjadi empat utama dari paket koneksi seperti download, browsing, video streaming, dan game online), aturan pohon antrian akan menangkap menandai bahwa kita telah dibuat pada aturan mangle dan pohon antrian akan mengatur bahwa tanda paket. Hasil dari metode eksperimen seperti yang ditunjukkan seperti gambar pohon di atas! Untuk lebih jelasnya anda bisa lihat artikel video ini bahwa saya telah disertakan!