MikroTik menyediakan beberapa pendekatan untuk membagi trafik antar jalur WAN. NTH dan ECMP adalah dua yang paling sering dipakai, dengan karakter dan keterbatasan berbeda.
Artikel ini merangkum contoh konfigurasi dan kapan sebaiknya memilih salah satunya.
Yang perlu diingat
- ECMP membagi berdasarkan rute, sedangkan NTH membagi berdasarkan paket/koneksi dengan aturan sendiri.
- Pastikan failover berjalan: cabut satu jalur dan periksa apakah trafik berpindah.
- Dokumentasikan rule agar mudah diaudit saat ada perubahan.
Script Load Balance Mikrotik 2 Line WAN metode NTH
# Load Balancing Metode -> NTH
################################################
/ip firewall address-list
add address=192.168.0.0/16 list=LOCAL-IP comment=”LB By BNT”
add address=172.16.0.0/12 list=LOCAL-IP comment=”LB By BNT”
add address=10.0.0.0/8 list=LOCAL-IP comment=”LB By BNT”
/ip firewall nat
add chain=srcnat out-interface=”ether1” action=masquerade comment=”LB By BNT”
add chain=srcnat out-interface=”ether2” action=masquerade comment=”LB By BNT”
/ip route
add check-gateway=ping distance=1 gateway=”192.168.1.1” routing-mark=”to-ether1” comment=”LB By BNT”
add check-gateway=ping distance=1 gateway=”192.168.2.1” routing-mark=”to-ether2” comment=”LB By BNT”
add check-gateway=ping distance=1 gateway=”192.168.1.1” comment=”LB By BNT”
add check-gateway=ping distance=2 gateway=”192.168.2.1” comment=”LB By BNT”
/ip firewall mangle
add action=mark-connection chain=prerouting in-interface=”ether1” new-connection-mark=”cm-ether1” passthrough=yes comment=”LB By BNT”
add action=mark-connection chain=prerouting in-interface=”ether2” new-connection-mark=”cm-ether2” passthrough=yes comment=”LB By BNT”
add action=mark-routing chain=output connection-mark=”cm-ether1” new-routing-mark=”to-ether1” passthrough=yes comment=”LB By BNT”
add action=mark-routing chain=output connection-mark=”cm-ether2” new-routing-mark=”to-ether2” passthrough=yes comment=”LB By BNT”
add action=mark-connection chain=prerouting dst-address-list=!LOCAL-IP new-connection-mark=”cm-ether1” passthrough=yes connection-state=new nth=2,1 src-address-list=LOCAL-IP comment=”LB By BNT”
add action=mark-connection chain=prerouting dst-address-list=!LOCAL-IP new-connection-mark=”cm-ether2” passthrough=yes connection-state=new nth=2,2 src-address-list=LOCAL-IP comment=”LB By BNT”
add action=mark-routing chain=prerouting connection-mark=”cm-ether1” dst-address-list=!LOCAL-IP new-routing-mark=”to-ether1” passthrough=no src-address-list=LOCAL-IP comment=”LB By BNT”
add action=mark-routing chain=prerouting connection-mark=”cm-ether2” dst-address-list=!LOCAL-IP new-routing-mark=”to-ether2” passthrough=no src-address-list=LOCAL-IP comment=”LB By BNT”
Script Load Balance Mikrotik 2 Line WAN dengan Metode ECMP
# Load Balancing ECMP (Equal Cost Multi Path)
################################################
/ip firewall nat
add chain=srcnat out-interface=”ether1” action=masquerade comment=”LB By BNT”
add chain=srcnat out-interface=”ether2” action=masquerade comment=”LB By BNT”
/ip route
add check-gateway=ping distance=1 gateway=”192.168.11.1,192.168.12.1,,,,” comment=”LB By BNT”
add check-gateway=ping distance=1 gateway=”192.168.11.1” routing-mark=”to-ether1” comment=”LB By BNT”
add check-gateway=ping distance=1 gateway=”192.168.12.1” routing-mark=”to-ether2” comment=”LB By BNT”
/ip firewall mangle
add action=mark-connection chain=input in-interface=”ether1” new-connection-mark=”cm-ether1” comment=”LB By BNT”
add action=mark-connection chain=input in-interface=”ether2” new-connection-mark=”cm-ether2” comment=”LB By BNT”
add action=mark-routing chain=output connection-mark=”cm-ether1” new-routing-mark=”to-ether1” comment=”LB By BNT”
add action=mark-routing chain=output connection-mark=”cm-ether2” new-routing-mark=”to-ether2” comment=”LB By BNT”
Membuat Script mandiri sesuai Topologi Jaringan Mikrotik anda…? silahkan kunjungi website berikut untuk membuat script nya:
Layanan yang berkaitan
Jika Anda ingin menerapkan panduan ini tanpa mengerjakan sendiri, tim Abyfine bisa membantu.
Tim teknis Abyfine Intermedia di Cilacap. Kami membangun dan merawat website, server, serta jaringan untuk sekolah, UMKM, dan instansi sejak 2004.