Skip to content

Instantly share code, notes, and snippets.

@adinata-id
Created March 24, 2022 04:00
Show Gist options
  • Save adinata-id/8792bf653b950b532843330588ad1c86 to your computer and use it in GitHub Desktop.
Save adinata-id/8792bf653b950b532843330588ad1c86 to your computer and use it in GitHub Desktop.
Load Balance Mikrotik PCC 2 ISP
#=====================================================
# www.duniawifi.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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment