You are on page 1of 1

###############################################################

# Load Balancing ECMP (Equal Cost Multi Path) / LB ECMP Script Generator
# Date/Time: 9/13/2023, 6:40:12 PM
# Created by: BuanaNETPBun.Github.io - fb.me/buananet.pbun
# Load Balancing Method: ECMP (EQUAL COST MULTI PATH)
###############################################################
/ip firewall address-list
add address=192.168.0.0/16 list=LOCAL-IP comment="LB ECMP by buananetpbun.github.io"
add address=172.16.0.0/12 list=LOCAL-IP comment="LB ECMP by buananetpbun.github.io"
add address=10.0.0.0/8 list=LOCAL-IP comment="LB ECMP by buananetpbun.github.io"
/ip firewall nat
add chain=srcnat out-interface="ether1" action=masquerade comment="LB ECMP by
buananetpbun.github.io"
add chain=srcnat out-interface="ether2" action=masquerade comment="LB ECMP by
buananetpbun.github.io"
/ip route
add check-gateway=ping distance=1 gateway="192.168.18.1,192.168.2.1,,,," comment="LB ECMP
by buananetpbun.github.io"
add check-gateway=ping distance=1 gateway="192.168.18.1" routing-mark="to-ether1"
comment="LB ECMP by buananetpbun.github.io"
add check-gateway=ping distance=1 gateway="192.168.2.1" routing-mark="to-ether2"
comment="LB ECMP by buananetpbun.github.io"
/ip firewall mangle
add action=accept chain=prerouting dst-address-list=LOCAL-IP src-address-list=LOCAL-IP
comment="LB ECMP by buananetpbun.github.io"
add action=accept chain=postrouting dst-address-list=LOCAL-IP src-address-list=LOCAL-IP
comment="LB ECMP by buananetpbun.github.io"
add action=accept chain=forward dst-address-list=LOCAL-IP src-address-list=LOCAL-IP
comment="LB ECMP by buananetpbun.github.io"
add action=accept chain=input dst-address-list=LOCAL-IP src-address-list=LOCAL-IP comment="LB
ECMP by buananetpbun.github.io"
add action=accept chain=output dst-address-list=LOCAL-IP src-address-list=LOCAL-IP
comment="LB ECMP by buananetpbun.github.io"
add action=mark-connection chain=input in-interface="ether1" new-connection-mark="cm-
ether1" passthrough=yes comment="LB ECMP by buananetpbun.github.io"
add action=mark-connection chain=input in-interface="ether2" new-connection-mark="cm-
ether2" passthrough=yes comment="LB ECMP by buananetpbun.github.io"
add action=mark-routing chain=output connection-mark="cm-ether1" new-routing-mark="to-
ether1" passthrough=yes comment="LB ECMP by buananetpbun.github.io"
add action=mark-routing chain=output connection-mark="cm-ether2" new-routing-mark="to-
ether2" passthrough=yes comment="LB ECMP by buananetpbun.github.io"

You might also like