Load Balance Menggunakan Metode PCC pada Mikrotik

Load balance pada mikrotik adalah teknik untuk mendistribusikan beban trafik pada dua atau lebih jalur koneksi secara seimbang, agar trafik dapat berjalan optimal, memaksimalkan throughput, memperkecil waktu tanggap dan menghindari overload pada salah satu jalur koneksi. (wiki)

Pada tutorial ini saya menggunakan 4 line modem speedy dengan kecepatan bandwith per-modem yang katanya bisa mencapai 3Mbps. Disini saya menggunakan metode load balancing PCC. PCC adalah Per Connection Classifier, PCC sendiri baru ada pada Mikrotik versi 3.24, maka dari itu konfigurasi PCC ini wajib berjalan pada mesin Mikrotik versi 3.24 keatas.

Baiklah, berikut step by step konfigurasi load balance yang saya terapkan pada Mikrotik v6.x.

1. Pertama-tama ganti nama interfaces pada Mikrotik, sebagai contoh ether1 saya ganti menjadi speedy-1 dan seterusnya, yang perlu diperhatikan adalah ip address untuk interface mikrotik yang mengarah ke modem. Berikut contoh nama-nama interfaces dan ip address pada Mikrotik.

[gaus@DLB-RB2011iL-RM] > ip addr pr

Flags: X – disabled, I – invalid, D – dynamic
# ADDRESS NETWORK INTERFACE
0 ;;; to–SWITCH
192.168.2.254/24 192.168.2.0 localnet
1 ;;; Speedy – 01
192.168.4.253/24 192.168.4.0 speedy-1
2 ;;; Speedy – 02
192.168.3.253/24 192.168.3.0 speedy-2
3 ;;; Speedy – 03
192.168.1.253/24 192.168.1.0 speedy-3
4 ;;; Speedy – 04
192.168.0.253/24 192.168.0.0 speedy-4

2. Bikin nat masquerade pada semua interface.

/ip firewall nat
add chain=srcnat out-interface=speedy-1 action=masquerade
add chain=srcnat out-interface=speedy-2 action=masquerade
add chain=srcnat out-interface=speedy-3 action=masquerade
add chain=srcnat out-interface=speedy-4 action=masquerade
add chain=srcnat out-interface=localnet action=masquerade

3. Kemudian buat mangle untuk konfigurasi load balance dengan menggunakan metode PCC, sebagai berikut.

/ip firewall mangle
add chain=input in-interface=speedy-1 action=mark-connection new-connection-mark=internet1_conn
add chain=input in-interface=speedy-2 action=mark-connection new-connection-mark=internet2_conn
add chain=input in-interface=speedy-3 action=mark-connection new-connection-mark=internet3_conn
add chain=input in-interface=speedy-4 action=mark-connection new-connection-mark=internet4_conn

add chain=output connection-mark=internet1_conn action=mark-routing new-routing-mark=to_internet1
add chain=output connection-mark=internet2_conn action=mark-routing new-routing-mark=to_internet2
add chain=output connection-mark=internet3_conn action=mark-routing new-routing-mark=to_internet3
add chain=output connection-mark=internet4_conn action=mark-routing new-routing-mark=to_internet4

add chain=prerouting dst-address-type=!local in-interface=localnet per-connection-classifier=both-addresses:4/0 \
action=mark-connection new-connection-mark=internet1_conn passthrough=yes

add chain=prerouting dst-address-type=!local in-interface=localnet per-connection-classifier=both-addresses:4/1 \
action=mark-connection new-connection-mark=internet2_conn passthrough=yes

add chain=prerouting dst-address-type=!local in-interface=localnet per-connection-classifier=both-addresses:4/2 \
action=mark-connection new-connection-mark=internet3_conn passthrough=yes

add chain=prerouting dst-address-type=!local in-interface=localnet per-connection-classifier=both-addresses:4/3 \
action=mark-connection new-connection-mark=internet4_conn passthrough=yes

add chain=prerouting connection-mark=internet1_conn in-interface=localnet action=mark-routing new-routing-mark=to_internet1
add chain=prerouting connection-mark=internet2_conn in-interface=localnet action=mark-routing new-routing-mark=to_internet2
add chain=prerouting connection-mark=internet3_conn in-interface=localnet action=mark-routing new-routing-mark=to_internet3
add chain=prerouting connection-mark=internet4_conn in-interface=localnet action=mark-routing new-routing-mark=to_internet4

4. Pengaturan routing table.

/ip route
add check-gateway=ping disabled=no distance=1 dst-address=0.0.0.0/0 gateway=192.168.4.254 routing-mark=to_internet1 scope=30 target-scope=10
add check-gateway=ping disabled=no distance=2 dst-address=0.0.0.0/0 gateway=192.168.3.254 routing-mark=to_internet2 scope=30 target-scope=10
add check-gateway=ping disabled=no distance=2 dst-address=0.0.0.0/0 gateway=192.168.1.254 routing-mark=to_internet3 scope=30 target-scope=10
add check-gateway=ping disabled=no distance=2 dst-address=0.0.0.0/0 gateway=192.168.0.254 routing-mark=to_internet4 scope=30 target-scope=10

add check-gateway=ping disabled=no distance=1 dst-address=0.0.0.0/0 gateway=192.168.4.254 scope=30 target-scope=10

5. Selanjutnya tambahkan DNS.

/ip dns set servers=8.8.8.8 allow-remote-requests=yes

done.

Referensi: PCC wiki

About Agus Firdaus

Just me ..

2 responses to “Load Balance Menggunakan Metode PCC pada Mikrotik”

  1. Qmonk In Da House (@ududmlulu) says :

    ini membagi beban ke 4 line tadi, tanpa melihat dia IX atau IIX ya bang?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: