--/--/---- --:--:-- WIB
Ahmad Fauzi (Head of NOC)
+ Baru
Kembali ke Hub Tools•MikroTik Generator (16 Tools)

MikroTik Script Generator Suite

46 Network ToolsQUEUE // QOS // HOTSPOT // PPPOE // DNS // NETWATCH // MANGLE // NAT // VPN

Koleksi generator skrip RouterOS lengkap: Burst Limit, PCQ Buffer Size, Simple Queue & Queue Tree Shared Up-To, QoS Priority 8 Level, Load Balancing, Anti-Tethering Hotspot, DoH, Netwatch, hingga Firewall Protection.

Target RouterOS:
Petunjuk Eksekusi di Router MikroTik:
  1. Pilih tool dan sesuaikan parameter pada formulir di sebelah kanan.
  2. Klik tombol Salin Skrip CLI atau Download .rsc.
  3. Buka aplikasi Winbox → Menu New Terminal.
  4. Klik kanan → Paste, lalu tekan Enter hingga selesai.

Load Balancing PCC

Per Connection Classifier multi-WAN balancing

ROS V7

Tentukan bandwidth/kecepatan (Mbps) tiap ISP untuk menghitung rasio PCC.

Name
Interface
Gateway IP
Bandwidth / Kecepatan
Aksi
Mbps
Mbps
Kalkulasi Rasio PCC (Per Connection Classifier):Divisor: 3
Perbandingan: WAN1 (1) : WAN2 (2)
WAN1100 Mbps
Porsi Trafik:33.3%
Slot PCC:3/0
WAN2200 Mbps
Porsi Trafik:66.7%
Slot PCC:3/1, 3/2

Sistem menghitung rasio bandwidth ISP menggunakan rumus FPB / GCD (Greatest Common Divisor). Mangle prerouting otomatis dipecah menjadi WAN1: 1 slot, WAN2: 2 slot sehingga beban traffic didistribusikan seimbang sesuai kapasitas masing-masing link ISP.

Skrip CLI MikroTik RouterOSlb-pcc.rsc
# ==============================================================================
# MIKROTIK ROUTEROS SCRIPT: Load Balancing PCC (2 WAN Lines)
# Target RouterOS: V7 (Generated by GENERATOR TOOLS)
# Timestamp: 11/11/2026, 15.28.32
# Cara Pakai: Buka Winbox -> New Terminal -> Paste seluruh skrip di bawah ini
# ==============================================================================

# Rasio Bandwidth & Slot Divisor: WAN1: 100Mbps (1 slot) : WAN2: 200Mbps (2 slot) | Total Divisor: 3

# 1. Address List Jaringan Lokal (RFC6890 / RFC1918)
/ip firewall address-list
add address=10.0.0.0/8 list=LOCAL-IP comment="RFC1918 Private"
add address=172.16.0.0/12 list=LOCAL-IP comment="RFC1918 Private"
add address=192.168.0.0/16 list=LOCAL-IP comment="RFC1918 Private"
add address=192.168.88.0/24 list=LOCAL-IP comment="LAN Subnet"

# 2. RouterOS v7 Routing Tables Definition
/routing table
add name="to_WAN1" fib
add name="to_WAN2" fib

# 3. Mangle Rules (Per Connection Classifier)
/ip firewall mangle
add chain=prerouting dst-address-list=LOCAL-IP src-address-list=LOCAL-IP action=accept comment="Accept LAN to LAN"
add chain=input in-interface="ether1-ISP1" connection-state=new action=mark-connection new-connection-mark="WAN1_conn" passthrough=yes comment="WAN1 Incoming"
add chain=output connection-mark="WAN1_conn" action=mark-routing new-routing-mark="to_WAN1" passthrough=no comment="WAN1 Output Reply"
add chain=input in-interface="ether2-ISP2" connection-state=new action=mark-connection new-connection-mark="WAN2_conn" passthrough=yes comment="WAN2 Incoming"
add chain=output connection-mark="WAN2_conn" action=mark-routing new-routing-mark="to_WAN2" passthrough=no comment="WAN2 Output Reply"
add chain=prerouting in-interface="ether3-LAN" connection-state=new dst-address-type=!local per-connection-classifier=both-addresses-and-ports:3/0 action=mark-connection new-connection-mark="WAN1_conn" passthrough=yes comment="PCC Classifier WAN1"
add chain=prerouting in-interface="ether3-LAN" connection-state=new dst-address-type=!local per-connection-classifier=both-addresses-and-ports:3/1 action=mark-connection new-connection-mark="WAN2_conn" passthrough=yes comment="PCC Classifier WAN2 (1/2)"
add chain=prerouting in-interface="ether3-LAN" connection-state=new dst-address-type=!local per-connection-classifier=both-addresses-and-ports:3/2 action=mark-connection new-connection-mark="WAN2_conn" passthrough=yes comment="PCC Classifier WAN2 (2/2)"
add chain=prerouting in-interface="ether3-LAN" connection-mark="WAN1_conn" action=mark-routing new-routing-mark="to_WAN1" passthrough=no comment="Route to WAN1"
add chain=prerouting in-interface="ether3-LAN" connection-mark="WAN2_conn" action=mark-routing new-routing-mark="to_WAN2" passthrough=no comment="Route to WAN2"

# 4. IP Routes
/ip route
add dst-address=0.0.0.0/0 gateway=192.168.1.1 routing-table="to_WAN1" check-gateway=ping distance=1 comment="Route via WAN1"
add dst-address=0.0.0.0/0 gateway=192.168.2.1 routing-table="to_WAN2" check-gateway=ping distance=1 comment="Route via WAN2"
add dst-address=0.0.0.0/0 gateway=192.168.1.1 distance=1 check-gateway=ping comment="Default Failover WAN1"
add dst-address=0.0.0.0/0 gateway=192.168.2.1 distance=2 check-gateway=ping comment="Default Failover WAN2"

# 5. NAT Masquerade per WAN
/ip firewall nat
add chain=srcnat out-interface="ether1-ISP1" action=masquerade comment="NAT Masquerade WAN1"
add chain=srcnat out-interface="ether2-ISP2" action=masquerade comment="NAT Masquerade WAN2"