Mikrotik PCC 4 WAN RB750

Fitur PCC (Per Connection Classifier) pada mikrotik pada prinsipnya memungkinkan kita untuk membagi lalu lintas data ke beberapa stream berdasarkan sumber atau tujuan paket data tersebut (src-address, src-port, dst-address atau dst-port). PCC menjaga agar komunikasi data tetap persisten, dan menguntungkan untuk komunikasi realtime seperti game online (PCC dapat menghindari putusnya koneksi secara tiba-tiba).

Jika anda menggunakan RB750, anda dapat menggunakan 4 line provider / WAN untuk di load balance. Berikut adalah script sederhana untuk Mikrotik PCC 4 WAN RB750.

Saya mengasumsikan bahwa 4 WAN sudah terhubung dengan modem sebagai bridge dan routerbox sebagai dialer PPPoE.

Pengaturan untuk interfaces :

/ip address
add address=192.168.0.1/24 network=192.168.0.0 broadcast=192.168.0.255 interface=Local
add address=10.10.10.2/24 network=10.10.10.0 broadcast=10.10.10.255 interface=ISP1
add address=10.10.20.2/24 network=10.10.20.0 broadcast=10.10.20.255 interface=ISP2
add address=10.10.30.2/24 network=10.10.30.0 broadcast=10.10.30.255 interface=ISP3
add address=10.10.40.2/24 network=10.10.40.0 broadcast=10.10.40.255 interface=ISP4

Selanjutnya pengaturan mangle :

/ip firewall mangle
add chain=input in-interface=ISP1 action=mark-connection new-connection-mark=con-ISP1
add chain=input in-interface=ISP2 action=mark-connection new-connection-mark=con-ISP2
add chain=input in-interface=ISP3 action=mark-connection new-connection-mark=con-ISP3
add chain=input in-interface=ISP4 action=mark-connection new-connection-mark=con-ISP4

add chain=output connection-mark=con-ISP1 action=mark-routing new-routing-mark=to_ISP1
add chain=output connection-mark=con-ISP2 action=mark-routing new-routing-mark=to_ISP2
add chain=output connection-mark=con-ISP3 action=mark-routing new-routing-mark=to_ISP3
add chain=output connection-mark=con-ISP4 action=mark-routing new-routing-mark=to_ISP4

add chain=prerouting dst-address=10.10.10.0/24 action=accept in-interface=Local
add chain=prerouting dst-address=10.10.20.0/24 action=accept in-interface=Local
add chain=prerouting dst-address=10.10.30.0/24 action=accept in-interface=Local
add chain=prerouting dst-address=10.10.40.0/24 action=accept in-interface=Local

add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:4/0 action=mark-connection new-connection-mark=con-ISP1 passthrough=yes
add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:4/1 action=mark-connection new-connection-mark=con-ISP2 passthrough=yes
add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:4/2 action=mark-connection new-connection-mark=con-ISP3 passthrough=yes
add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:4/3 action=mark-connection new-connection-mark=con-ISP4 passthrough=yes
add chain=prerouting connection-mark=con-ISP1 in-interface=Local action=mark-routing new-routing-mark=to_ISP1
add chain=prerouting connection-mark=con-ISP2 in-interface=Local action=mark-routing new-routing-mark=to_ISP2
add chain=prerouting connection-mark=con-ISP3 in-interface=Local action=mark-routing new-routing-mark=to_ISP3
add chain=prerouting connection-mark=con-ISP4 in-interface=Local action=mark-routing new-routing-mark=to_ISP4

Pengaturan routes dengan mekanisme failover :

/ip route
add dst-address=0.0.0.0/0 gateway=10.10.10.1 routing-mark=to_ISP1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=10.10.20.1 routing-mark=to_ISP2 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=10.10.30.1 routing-mark=to_ISP3 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=10.10.40.1 routing-mark=to_ISP4 check-gateway=ping

add dst-address=0.0.0.0/0 gateway=10.10.10.1 distance=1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=10.10.20.1 distance=2 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=10.10.30.1 distance=3 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=10.10.40.1 distance=4 check-gateway=ping

Masquerading pada NAT

/ip firewall nat
add chain=srcnat out-interface=ISP1 action=masquerade
add chain=srcnat out-interface=ISP2 action=masquerade
add chain=srcnat out-interface=ISP3 action=masquerade
add chain=srcnat out-interface=ISP4 action=masquerade

Terakhir tambahkan pengaturan agar routerbox RB750 bisa menerima request DNS :

/ip dns set allow-remote-requests=yes cache-max-ttl=1w cache-size=512KiB max-udp-packet-size=512 servers=8.8.8.8,8.8.4.4

Selesai. Silakan ujicoba dengan menggunakan mendownload sebuah file berukuran besar dengan download manager. Jika PCC berjalan baik, maka traffic akan berjalan seimbang disemua WAN. Jika PCC memberatkan kinerja mikrotik anda, silakan mengupgrade RouterOS nya terlebih dahulu.

3 Comments

  1. Shon Haji

    bagai mana jika beda kecepatan misal 20 mb 20mb sama 10 mb pak

  2. Fauzi

    Di implementasikan rb952ui.52nd bisakah script diatas. Untuk OS 6.45.6. atau ada perubahan script.

    • fazar

      bisa kok.. coba cek juga wiki mikrotik, kali aja disana ada versi yg terbaru untuk metode loadbalance pcc.

Leave a Reply

Your email address will not be published. Required fields are marked *