Selain itu laoad balance dapat digunakan untuk memperkecil waktu tanggap dan menghindari overload pada salah satu jalur koneksi, kali ini metode yang digunakan menggunakan PCC (Per-Connection Classifier).
Langsung saja.
1. Konfigurasi IP Address
/ ip address
add address=192.168.10.1/24 network=192.168.10.0 broadcast=192.168.10.255 interface=ether3
/ip dhcp-client add interface=ether1 add-default-route=no disabled=no
/ip dhcp-client add interface=ether2 add-default-route=no disabled=no
2. NAT
Untuk konfigurasi NAT, karena terdapat dua uplink ke ISP, maka tambahkan dua rule src-nat mengarah ke dua ISP.
/ ip firewall nat
add chain=srcnat out-interface=ether1 action=masquerade comment=nat-indihome1
add chain=srcnat out-interface=ether2 action=masquerade comment=nat-indihome2
3. Pengaturan Police Routing
/ ip firewall mangle
add chain=prerouting dst-address=192.168.1.1/24 action=accept in-interface=ether3
add chain=prerouting dst-address=192.168.2.1/24 action=accept in-interface=ether3
add chain=prerouting in-interface=ether1 connection-mark=no-mark action=mark-connection new-connection-mark=ISP1_conn
add chain=prerouting in-interface=ether2 connection-mark=no-mark action=mark-connection new-connection-mark=ISP2_conn
4. Membagi beban trafik karena beda bandwidth
Karena kecepatan koneksi kedua ISP berbeda (50 Mbps dan 20 Mbps), kita membagi beban trafiknya menjadi 3 (tiga) bagian. Dua bagian pertama akan melewati gateway ISP-1, dan 1 bagian terakhir akan melewati gateway ISP-2.
/ ip firewall mangle
add chain=prerouting in-interface=ether3 connection-mark=no-mark dst-address-type=!local
per-connection-classifier=both-addresses:3/0 action=mark-connection new-connection-mark=ISP1_conn
add chain=prerouting in-interface=ether3 connection-mark=no-mark dst-address-type=!local
per-connection-classifier=both-addresses:3/1 action=mark-connection new-connection-mark=ISP1_conn
add chain=prerouting in-interface=ether3 connection-mark=no-mark dst-address-type=!local
per-connection-classifier=both-addresses:3/2 action=mark-connection new-connection-mark=ISP2_conn
5. Membuat Policy routing trafik keluar menuju internet
/ ip firewall mangle
add chain=prerouting connection-mark=ISP1_conn in-interface=ether3 action=mark-routing
new-routing-mark=to_ISP1
add chain=prerouting connection-mark=ISP2_conn in-interface=ether3 action=mark-routing
new-routing-mark=to_ISP2
add chain=output connection-mark=ISP1_conn action=mark-routing new-routing-mark=to_ISP1
add chain=output connection-mark=ISP2_conn action=mark-routing new-routing-mark=to_ISP2
6. Setelah konfigurasi mark-connection dan mark-routing selesai, menambahkan rule default route.
/ ip route
add dst-address=0.0.0.0/0 gateway=192.168.1.1 routing-mark=to_ISP1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.2.1 routing-mark=to_ISP2 check-gateway=ping
Tambahkan rule berikut ini, yang berfungsi untuk failover jika salah satu line ISP mati.
/ ip route
add dst-address=0.0.0.0/0 gateway=192.168.1.1 distance=1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.2.1 distance=2 check-gateway=ping