27 Februari 2024

Load Balance PCC + NTH 2 Wan

Ganti dulu nama interface di mikrotiknya

Copy Code di bawah terus paste di new terminal mikrotik

/interface ethernet
set [ find default-name=ether1 ] name=ether1-ISP1
set [ find default-name=ether2 ] name=ether2-ISP2
set [ find default-name=ether5 ] name=ether5-dis

Tambahkan IP nya bisa statik ataupun DHCP-Client

Untuk interface yang mengarah ke ISP kita gunakan DHCP-Client

dan untuk interface yang mengarah ke distribusi ya itu Ether5-dis kita gunakan ip statik

/ip address

add address=192.168.10.1/24 interface=ether5-dis network=192.168.10.0
/ip dhcp-client
add add-default-route=no disabled=no interface=ether1-ISP1 use-peer-dns=no \
    use-peer-ntp=no
add add-default-route=no disabled=no interface=ether2-ISP2 use-peer-dns=no \
    use-peer-ntp=no

Tambhakan Juga Gateway yang mengarah ke ISP

/ip route
add check-gateway=ping distance=1 gateway=192.168.200.1
add check-gateway=ping distance=2 gateway=192.168.1.1

DNS Server dan NAT juga jangan lupa ya

Tambahkan NAT(Network Address Translation)

/ip firewall nat
add action=masquerade chain=srcnat
add action=masquerade chain=srcnat out-interface=ether1-ISP1
add action=masquerade chain=srcnat out-interface=ether2-ISP2
add action=masquerade chain=srcnat out-interface=ether5-dis
/ip dns
set servers=8.8.8.8,8.8.4.4

Sampai sini seharusnya mikrotik sudah bisa mendapatkan koneksi internet

Bisa di coba dengan Ping 8.8.8.8

Tambahkan Mangle Loadbalance nya

/ip firewall mangle
add action=mark-connection chain=prerouting comment="IN/OUT FOR EACH WAN" \
    connection-mark=no-mark in-interface=ether1-ISP1 new-connection-mark=\
    cm_in_isp1
add action=mark-connection chain=prerouting connection-mark=no-mark \
    in-interface=ether2-ISP2 new-connection-mark=cm_in_isp2 passthrough=yes
add action=mark-routing chain=output connection-mark=cm_in_isp1 \
    new-routing-mark=Via-ISP1 passthrough=yes
add action=mark-routing chain=output connection-mark=cm_in_isp2 \
    new-routing-mark=Via-ISP2 passthrough=yes
add action=jump chain=prerouting comment=\
    "LB NTH JUMPER [!!! only for tcp 80 traffic]" connection-state=new \
    dst-address-list=!private-lokal 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=ether5-dis new-connection-mark=\
    cm_nth_balancer_1 nth=2,1
add action=mark-connection chain=nth-balancer in-interface=ether5-dis \
    new-connection-mark=cm_nth_balancer_2 nth=2,2
add action=return chain=nth-balancer
add action=mark-routing chain=prerouting comment="LB NTH ROUTE" \
    connection-mark=cm_nth_balancer_1 in-interface=ether5-dis \
    new-routing-mark=Via-ISP1 passthrough=no
add action=mark-routing chain=prerouting connection-mark=cm_nth_balancer_2 \
    in-interface=ether5-dis new-routing-mark=Via-ISP2 passthrough=no
add action=jump chain=prerouting comment="LB PCC JUMPER [for any traffic]" \
    dst-address-list=!private-lokal in-interface=ether5-dis jump-target=\
    pcc-balancer protocol=!ospf
add action=jump chain=prerouting dst-address-list=!private-lokal \
    in-interface=ether5-dis jump-target=pcc-balancer protocol=tcp
add action=jump chain=prerouting dst-address-list=!private-lokal \
    in-interface=ether5-dis jump-target=pcc-balancer protocol=udp
add action=mark-connection chain=pcc-balancer comment=\
    "LB PCC BALANCER CLASSIFIER" in-interface=ether5-dis 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=ether5-dis \
    new-connection-mark=cm_pcc_balancer_2 per-connection-classifier=\
    src-address-and-port:2/1
add action=return chain=pcc-balancer in-interface=ether5-dis
add action=mark-routing chain=prerouting comment="LB PCC ROUTE" \
    connection-mark=cm_pcc_balancer_1 in-interface=ether5-dis \
    new-routing-mark=Via-ISP1 passthrough=no
add action=mark-routing chain=prerouting connection-mark=cm_pcc_balancer_2 \
    in-interface=ether5-dis new-routing-mark=Via-ISP2 passthrough=no

Tambahkan Gateway lagi

/ip route
add check-gateway=ping distance=1 gateway=192.168.200.1 routing-mark=Via-ISP1
add check-gateway=ping distance=2 gateway=192.168.1.1 routing-mark=Via-ISP2

TULISAN INI BERTUJUAN AGAR SI PENULIS TIDAK LUPA SAJA MOHON MAAF KALO ADA YANG KURANG HEHEHE

note: sesana mah inget inget sorangan yat wkwk

You may also like...