Scripts Load Balance Mikrotik
Scripts Load Balance Mikrotik
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
/ ip address
add address=192.168.1.1/24 network=192.168.1.0 broadcast=192.168.1.255
interface=Local
add address=172.0.2.92/16 network=172.0.0.0 broadcast=172.0.255.255
interface=Link1
add address=172.0.1.49/16 network=172.0.0.0 broadcast=172.0.255.255
interface=Link2
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
/ ip firewall mangle
add chain=prerouting src-address-list=odd in-interface= Local action=mark-
connection \ new-connection-mark=odd passthrough=yes
add chain=prerouting src-address-list=odd in-interface= Local action=mark-routing \
new-routing-mark=odd
add chain=prerouting src-address-list=even in-interface= Local action=mark-connection
\ new-connection-mark=even passthrough=yes
add chain=prerouting src-address-list=even in-interface= Local action=mark-routing \
new-routing-mark=even
add chain=prerouting in-interface= Local connection-state=new nth=1,1,0 \
action=mark-connection new-connection-mark=odd passthrough=yes
add chain=prerouting in-interface= Local action=add-src-to-address-list \ address-
list=odd address-list-timeout=1d connection-mark=odd passthrough=yes
add chain=prerouting in-interface= Local connection-mark=odd action=mark-routing \
new-routing-mark=odd passthrough=no
add chain=prerouting in-interface= Local connection-state=new nth=1,1,1 \
action=mark-connection new-connection-mark=even passthrough=yes
add chain=prerouting in-interface= Local action=add-src-to-address-list \ address-
list=even address-list-timeout=1d connection-mark=even passthrough=yes
add chain=prerouting in-interface= Local connection-mark=even action=mark-routing \
new-routing-mark=even passthrough=no
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
/ ip firewall nat
add chain=srcnat connection-mark=odd action=src-nat to-addresses=172.0.2.92 \ to-
ports=0-65535
add chain=srcnat connection-mark=even action=src-nat to-addresses=172.0.1.49 \ to-
ports=0-65535
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
/ ip route
add dst-address=0.0.0.0/0 gateway=172.0.1.1 scope=255 target-scope=10 routing-
mark=odd
add dst-address=0.0.0.0/0 gateway=172.0.1.1 scope=255 target-scope=10 routing-
mark=even
add dst-address=0.0.0.0/0 gateway=172.0.1.1 scope=255 target-scope=10