Home / Networking / Router / Load Balance PCC

Load Balance PCC

Load Balance PCC 2 ISP

Load Balance PCC 2 ISP adalah metode penyimbangan dua koneksi atau lebih internet gateway

#=====================================================
# https://midteknologi.com
#=====================================================

/interface
set ether1 comment=Modem-1
set ether2 comment=Modem-2
set ether3 comment=Lan

/ip firewall address-list
add address=192.168.0.0/16 list=IP-LOKAL
add address=172.16.0.0/12 list=IP-LOKAL
add address=10.0.0.0/8 list=IP-LOKAL

/ ip address
add address=192.168.9.9/24 network=192.168.9.0 broadcast=192.168.9.255 interface=ether1
add address=192.168.8.2/24 network=192.168.8.0 broadcast=192.168.8.255 interface=ether2
add address=192.168.10.1/24 network=192.168.10.0 broadcast=192.168.10.255 interface=ether3

/ip route
add check-gateway=ping distance=1 gateway="192.168.9.1" routing-mark="to-ether1"
add check-gateway=ping distance=1 gateway="192.168.8.1" routing-mark="to-ether2"
add check-gateway=ping distance=1 gateway="192.168.9.1"
add check-gateway=ping distance=2 gateway="192.168.8.1"

/ip dns set cache-max-ttl=1d cache-size=2048KiB servers=8.8.8.8,8.8.4.4

/ip firewall nat
add chain=srcnat out-interface="ether1" action=masquerade
add chain=srcnat out-interface="ether2" action=masquerade

/ip firewall mangle
add action=mark-connection chain=input in-interface="ether1" new-connection-mark="cm-ether1" passthrough=yes
add action=mark-connection chain=input in-interface="ether2" new-connection-mark="cm-ether2" passthrough=yes
add action=mark-routing chain=output connection-mark="cm-ether1" new-routing-mark="to-ether1" passthrough=yes
add action=mark-routing chain=output connection-mark="cm-ether2" new-routing-mark="to-ether2" passthrough=yes

add action=mark-connection chain=prerouting dst-address-list=!IP-LOKAL dst-address-type=!local new-connection-mark="cm-ether1" passthrough=yes per-connection-classifier=both-addresses-and-ports:2/0 src-address-list=IP-LOKAL

add action=mark-connection chain=prerouting dst-address-list=!IP-LOKAL dst-address-type=!local new-connection-mark="cm-ether2" passthrough=yes per-connection-classifier=both-addresses-and-ports:2/1 src-address-list=IP-LOKAL

add action=mark-routing chain=prerouting connection-mark="cm-ether1" dst-address-list=!IP-LOKAL new-routing-mark="to-ether1" passthrough=yes src-address-list=IP-LOKAL

add action=mark-routing chain=prerouting connection-mark="cm-ether2" dst-address-list=!IP-LOKAL new-routing-mark="to-ether2" passthrough=yes src-address-list=IP-LOKAL

Load Balance PCC 3 ISP

Load Balance PCC 3 ISP adalah metode penyimbangan dua koneksi atau lebih internet gateway

#=====================================================
# https://midteknologi.com
#=====================================================

/interface
set ether1 comment=Modem-1
set ether2 comment=Modem-2
set ether3 comment=Modem-3
set ether4 comment=Lan

/ip firewall address-list
add address=192.168.0.0/16 list=IP-LOKAL
add address=172.16.0.0/12 list=IP-LOKAL
add address=10.0.0.0/8 list=IP-LOKAL

/ ip address
add address=192.168.9.9/24 network=192.168.9.0 broadcast=192.168.9.255 interface=ether1
add address=192.168.8.2/24 network=192.168.8.0 broadcast=192.168.8.255 interface=ether2
add address=192.168.10.2/24 network=192.168.10.0 broadcast=192.168.8.255 interface=ether3
add address=192.168.11.1/24 network=192.168.11.0 broadcast=192.168.10.255 interface=ether4

/ip route
add check-gateway=ping distance=1 gateway="192.168.9.1" routing-mark="to-ether1"
add check-gateway=ping distance=1 gateway="192.168.8.1" routing-mark="to-ether2"
add check-gateway=ping distance=1 gateway="192.168.10.1" routing-mark="to-ether3"
add check-gateway=ping distance=1 gateway="192.168.9.1"
add check-gateway=ping distance=2 gateway="192.168.8.1"
add check-gateway=ping distance=3 gateway="192.168.10.1"

/ip dns set cache-max-ttl=1d cache-size=2048KiB servers=8.8.8.8,8.8.4.4

/ip firewall nat
add chain=srcnat out-interface="ether1" action=masquerade
add chain=srcnat out-interface="ether2" action=masquerade
add chain=srcnat out-interface="ether3" action=masquerade

/ip firewall mangle
add action=mark-connection chain=input in-interface="ether1" new-connection-mark="cm-ether1" passthrough=yes
add action=mark-connection chain=input in-interface="ether2" new-connection-mark="cm-ether2" passthrough=yes
add action=mark-connection chain=input in-interface="ether3" new-connection-mark="cm-ether3" passthrough=yes

add action=mark-routing chain=output connection-mark="cm-ether1" new-routing-mark="to-ether1" passthrough=yes
add action=mark-routing chain=output connection-mark="cm-ether2" new-routing-mark="to-ether2" passthrough=yes
add action=mark-routing chain=output connection-mark="cm-ether3" new-routing-mark="to-ether3" passthrough=yes

add action=mark-connection chain=prerouting dst-address-list=!IP-LOKAL dst-address-type=!local new-connection-mark="cm-ether1" passthrough=yes per-connection-classifier=both-addresses-and-ports:2/0 src-address-list=IP-LOKAL

add action=mark-connection chain=prerouting dst-address-list=!IP-LOKAL dst-address-type=!local new-connection-mark="cm-ether2" passthrough=yes per-connection-classifier=both-addresses-and-ports:2/1 src-address-list=IP-LOKAL

add action=mark-connection chain=prerouting dst-address-list=!IP-LOKAL dst-address-type=!local new-connection-mark="cm-ether3" passthrough=yes per-connection-classifier=both-addresses-and-ports:2/2 src-address-list=IP-LOKAL

add action=mark-routing chain=prerouting connection-mark="cm-ether1" dst-address-list=!IP-LOKAL new-routing-mark="to-ether1" passthrough=yes src-address-list=IP-LOKAL

add action=mark-routing chain=prerouting connection-mark="cm-ether2" dst-address-list=!IP-LOKAL new-routing-mark="to-ether2" passthrough=yes src-address-list=IP-LOKAL

add action=mark-routing chain=prerouting connection-mark="cm-ether3" dst-address-list=!IP-LOKAL new-routing-mark="to-ether3" passthrough=yes src-address-list=IP-LOKAL

Leave a Reply

Your email address will not be published. Required fields are marked *