Topologi Loadbalancing PCC dan Failover 2 ISP
Topologi Loadbalancing PCC dan Failover 2 ISP

Topologi

Astinet = 50mbps = ether1 = 192.168.200.1

Indihome= 150mbps = ether5 = 192.168.100.1

Topologi Loadbalancing PCC dan Failover 2 ISP
Topologi Loadbalancing PCC dan Failover 2 ISP
/ip firewall address-list
add address=10.0.0.0/8 list=private-lokal
add address=172.16.0.0/12 list=private-lokal
add address=192.168.0.0/16 list=private-lokal
 
/ip route
add check-gateway=ping comment=exit-1 distance=1 gateway=192.168.200.1 routing-mark=exit-1
add check-gateway=ping comment=exit-2 distance=1 gateway=192.168.100.1 routing-mark=exit-2
add check-gateway=ping comment=jalur-1 distance=1 gateway=192.168.200.1 routing-mark=jalur-1
add check-gateway=ping comment=jalur-1 distance=2 gateway=192.168.100.1 routing-mark=jalur-1
add check-gateway=ping comment=jalur-2 distance=1 gateway=192.168.100.1 routing-mark=jalur-2
add check-gateway=ping comment=jalur-2 distance=2 gateway=192.168.200.1 routing-mark=jalur-2
add check-gateway=ping comment=jalur-1 distance=1 gateway=192.168.200.1
add check-gateway=ping comment=jalur-2 distance=2 gateway=192.168.200.1
 
 
/ip firewall mangle
add action=accept chain=prerouting dst-address-list=private-lokal src-address-list=private-lokal
add action=accept chain=forward dst-address-list=private-lokal src-address-list=private-lokal
 
add action=mark-connection chain=input comment=exit-1 in-interface=ether1 new-connection-mark=exit-1 passthrough=yes
add action=mark-connection chain=input comment=exit-2 in-interface=ether5 new-connection-mark=exit-2 passthrough=yes
add action=mark-routing chain=output comment=exit-1 connection-mark=exit-1 new-routing-mark=exit-1 passthrough=no
add action=mark-routing chain=output comment=exit-2 connection-mark=exit-2 new-routing-mark=exit-2 passthrough=no
 
#LB PCC
add action=mark-routing chain=prerouting comment=jalur-1 dst-address-list=!private-lokal dst-address-type=!local new-routing-mark=jalur-1 passthrough=no per-connection-classifier=dst-address-and-port:4/0 src-address-list=private-lokal
 
add action=mark-routing chain=prerouting comment=jalur-2 dst-address-list=!private-lokal dst-address-type=!local new-routing-mark=jalur-2 passthrough=no per-connection-classifier=dst-address-and-port:4/1 src-address-list=private-lokal
 
add action=mark-routing chain=prerouting comment=jalur-2 dst-address-list=!private-lokal dst-address-type=!local new-routing-mark=jalur-2 passthrough=no per-connection-classifier=dst-address-and-port:4/2 src-address-list=private-lokal
 
add action=mark-routing chain=prerouting comment=jalur-2 dst-address-list=!private-lokal dst-address-type=!local new-routing-mark=jalur-2 passthrough=no per-connection-classifier=dst-address-and-port:4/3 src-address-list=private-lokal

Buat System Schedule dengan interval 10 detik dan pastekan script dibawah ini di On Event

#jalur-1 cek
:if ([/ping address=8.8.8.8 interface=ether1 routing=exit-1 count=5] = 0) do={/ip route set [find comment=jalur-1 gateway=192.168.200.1 distance=1] distance=3} else={/ip route set [find comment=jalur-1 gateway=192.168.100.1 distance=3] distance=1};
 
#jalur-2 cek
:if ([/ping address=8.8.8.8 interface=ether5 routing=exit-2 count=5] = 0) do={/ip route set [find comment=jalur-2 gateway=192.168.100.1 distance=1] distance=3} else={/ip route set [find comment=jalur-2 gateway=192.168.100.1 distance=3] distance=1};

Leave a Reply