Teknik penyebaran traffic / load balancing NTH digunakan hanya untuk traffic http (browsing web) dengan identifikasi connection mark berdasarkan connection-state=new, ini bermanfaat ketika kita melakukan sambungan ke server tertentu dengan multiple connection (download menggunakan IDM/download manager misalnya)
Lalu, teknik penyebaran traffic PCC (per connection classifier) digunakan untuk traffic selain tcp 80, yang karakter pada umumnya cukup sensitif terhadap session dan perubahan IP pengakses (internet banking atau management cpanel misalnya)
dalam ilustrasi ini digunakan 2 line ADSL Speedy sebagai upstream provider (tersambung ether1 dan ether2) kemudian yang mengarah ke lan adalah ether9-lan
(konfigurasi ini sudah diujicobakan ke koneksi yang menggunakan 12 line upstream Speedy, dan metode konfigurasinya hampir sama)
### Bagian 1, Mengarahkan traffic masuk dari setiap interface wan, agar keluar pada interface yang sesuai
/ip firewall mangle
add action=mark-connection chain=prerouting comment="IN/OUT FOR EACH WAN" \
connection-mark=no-mark in-interface=pppoe-speedy1 new-connection-mark=\
cm_in_isp1
add action=mark-connection chain=prerouting connection-mark=no-mark \
in-interface=pppoe-speedy2 new-connection-mark=cm_in_isp2
add action=mark-routing chain=output connection-mark=cm_in_isp1 \
new-routing-mark=via_speedy1
add action=mark-routing chain=output connection-mark=cm_in_isp2 \
new-routing-mark=via_speedy2
add action=mark-connection chain=prerouting comment="IN/OUT FOR EACH WAN" \
connection-mark=no-mark in-interface=pppoe-speedy1 new-connection-mark=\
cm_in_isp1
add action=mark-connection chain=prerouting connection-mark=no-mark \
in-interface=pppoe-speedy2 new-connection-mark=cm_in_isp2
add action=mark-routing chain=output connection-mark=cm_in_isp1 \
new-routing-mark=via_speedy1
add action=mark-routing chain=output connection-mark=cm_in_isp2 \
new-routing-mark=via_speedy2
### Bagian 2, Jump paket dengan klasifikasi TCP 80, dan membuat custom chain nth-balancer, klasifikasikan setiap koneksi dengan state new
add action=jump chain=prerouting comment="LB NTH JUMPER [!!! only for tcp 80 traffic]" \
connection-state=new dst-address-list=!rfc1918 dst-port=80 in-interface=\
all-ethernet jump-target=nth-balancer protocol=tcp
connection-state=new dst-address-list=!rfc1918 dst-port=80 in-interface=\
all-ethernet jump-target=nth-balancer protocol=tcp
add action=mark-connection chain=nth-balancer comment="LB NTH BALANCER CLASSIFIER" \
in-interface=ether9-lan new-connection-mark=cm_nth_balancer_1 nth=2,1
add action=mark-connection chain=nth-balancer in-interface=ether9-lan \
new-connection-mark=cm_nth_balancer_2 nth=2,2
add action=return chain=nth-balancer
in-interface=ether9-lan new-connection-mark=cm_nth_balancer_1 nth=2,1
add action=mark-connection chain=nth-balancer in-interface=ether9-lan \
new-connection-mark=cm_nth_balancer_2 nth=2,2
add action=return chain=nth-balancer
### Bagian 3, paket yang telah diklasfikasikan secara NTH, di-routing-kan ke masing-masing gateway upstream
add action=mark-routing chain=prerouting comment="LB NTH ROUTE" \
connection-mark=cm_nth_balancer_1 in-interface=ether9-lan new-routing-mark=\
via_speedy1 passthrough=no
add action=mark-routing chain=prerouting connection-mark=cm_nth_balancer_2 \
in-interface=ether9-lan new-routing-mark=via_speedy2 passthrough=no
connection-mark=cm_nth_balancer_1 in-interface=ether9-lan new-routing-mark=\
via_speedy1 passthrough=no
add action=mark-routing chain=prerouting connection-mark=cm_nth_balancer_2 \
in-interface=ether9-lan new-routing-mark=via_speedy2 passthrough=no
### Bagian 4, Jump paket dengan klasifikasi selain TCP 80, dan membuat custom chain, pcc-balancer, klasifikasikan setiap koneksi dengan dst-address dan port yang sama kedalam satu kelompok
add action=jump chain=prerouting comment="LB PCC JUMPER [for any traffic]" \
dst-address-list=!rfc1918 in-interface=ether9-lan jump-target=pcc-balancer \
protocol=!ospf
add action=jump chain=prerouting dst-address-list=!rfc1918 in-interface=ether9-lan \
jump-target=pcc-balancer protocol=tcp
add action=jump chain=prerouting dst-address-list=!rfc1918 in-interface=ether9-lan \
jump-target=pcc-balancer protocol=udp
dst-address-list=!rfc1918 in-interface=ether9-lan jump-target=pcc-balancer \
protocol=!ospf
add action=jump chain=prerouting dst-address-list=!rfc1918 in-interface=ether9-lan \
jump-target=pcc-balancer protocol=tcp
add action=jump chain=prerouting dst-address-list=!rfc1918 in-interface=ether9-lan \
jump-target=pcc-balancer protocol=udp
add action=mark-connection chain=pcc-balancer comment="LB PCC BALANCER CLASSIFIER" \
in-interface=ether9-lan new-connection-mark=cm_pcc_balancer_1 \
per-connection-classifier=dst-address-and-port:2/0
add action=mark-connection chain=pcc-balancer in-interface=ether9-lan \
new-connection-mark=cm_pcc_balancer_2 per-connection-classifier=\
src-address-and-port:2/1
add action=return chain=pcc-balancer in-interface=ether9-lan
in-interface=ether9-lan new-connection-mark=cm_pcc_balancer_1 \
per-connection-classifier=dst-address-and-port:2/0
add action=mark-connection chain=pcc-balancer in-interface=ether9-lan \
new-connection-mark=cm_pcc_balancer_2 per-connection-classifier=\
src-address-and-port:2/1
add action=return chain=pcc-balancer in-interface=ether9-lan
### Bagian 5. Paket yang telah diklasifikasikan secara PCC, di-routing-kan ke masing-masing gateway upstream
add action=mark-routing chain=prerouting comment="LB PCC ROUTE" \
connection-mark=cm_pcc_balancer_1 in-interface=ether9-lan new-routing-mark=\
via_speedy1 passthrough=no
add action=mark-routing chain=prerouting connection-mark=cm_pcc_balancer_2 \
in-interface=ether9-lan new-routing-mark=via_speedy2 passthrough=no
connection-mark=cm_pcc_balancer_1 in-interface=ether9-lan new-routing-mark=\
via_speedy1 passthrough=no
add action=mark-routing chain=prerouting connection-mark=cm_pcc_balancer_2 \
in-interface=ether9-lan new-routing-mark=via_speedy2 passthrough=no
### Bagian 6. Membuat address list yang terdiri dari Blok IP Private, rules load balancing tidak akan diaplikasikan untuk paket yang berasal dari network local dengan tujuan ke network local juga
/ip firewall address-list
add address=192.168.0.0/16 list=rfc1918
add address=172.16.0.0/12 list=rfc1918
add address=10.0.0.0/8 list=rfc1918
add address=192.168.0.0/16 list=rfc1918
add address=172.16.0.0/12 list=rfc1918
add address=10.0.0.0/8 list=rfc1918
### Bagian 7. Membuat routing table default dan custom routing table untuk masing-masih provider.
/ip route
add distance=1 gateway=pppoe-speedy1 routing-mark=via_speedy1
add distance=1 gateway=pppoe-speedy2 routing-mark=via_speedy2
add distance=1 gateway=pppoe-speedy1
add distance=2 gateway=pppoe-speedy2
add distance=1 gateway=pppoe-speedy1 routing-mark=via_speedy1
add distance=1 gateway=pppoe-speedy2 routing-mark=via_speedy2
add distance=1 gateway=pppoe-speedy1
add distance=2 gateway=pppoe-speedy2
### Bagian 8. Melakukan SNAT/MASQUERADE ke arah interface public agar ip private dibelakang router dapat mengakses internet
/ip fi nat
add action=masquerade chain=srcnat comment="MASQ PUBLIC" out-interface=\
pppoe-speedy1
add action=masquerade chain=srcnat comment="MASQ PUBLIC" out-interface=\
pppoe-speedy2
add action=masquerade chain=srcnat comment="MASQ PUBLIC" out-interface=\
pppoe-speedy1
add action=masquerade chain=srcnat comment="MASQ PUBLIC" out-interface=\
pppoe-speedy2
0 Response to "LOAD BALANCE NTH"
Post a Comment
Ilmu ibarat sempax, kita harus menggunakannya, tapi tak perlu memamerkannya..".Tolong klik iklan dong..biar blog nya tetep eksis..Thxs "