Load Balancing and Fail Over for Two Static IP WAN(NTH Method)


/interface ethernet
set 0 name=WAN1
set 1 name=WAN2
set 2 name=internal


/ip address
add address=192.168.88.20/24 network=192.168.88.0 broadcast=192.168.88.255 interface=WAN1
add address=192.168.9.20/24 network=192.168.9.0 broadcast=192.168.9.255 interface=WAN2
add address=192.168.22.1/24 network=192.168.22.0 broadcast=192.168.22.255 interface=internal

/ip firewall mangle
add chain=prerouting in-interface=internal connection-state=new nth=2,1 action=mark-connection new-connection-mark=conn1 passthrough=yes comment="" disabled=no
add chain=prerouting in-interface=internal connection-mark=conn1 action=mark-routing new-routing-mark=conn1 passthrough=no comment="" disabled=no
add chain=prerouting in-interface=internal connection-state=new nth=2,2 action=mark-connection new-connection-mark=conn2 passthrough=yes comment="" disabled=no
add chain=prerouting in-interface=internal connection-mark=conn2 action=mark-routing new-routing-mark=conn2 passthrough=no comment="" disabled=no


/ip firewall nat
add chain=srcnat connection-mark=conn1 action=masquerade out-interface=WAN1 comment="" disabled=no
add chain=srcnat connection-mark=conn2 action=masquerade out-interface=WAN2 comment="" disabled=no


/ip route
add dst-address=0.0.0.0/0 gateway=192.168.88.1 scope=255 target-scope=10 routing-mark=conn1 comment="" disabled=no
add dst-address=0.0.0.0/0 gateway=192.168.9.1 scope=255 target-scope=10 routing-mark=conn2 comment="" disabled=no
add dst-address=0.0.0.0/0 gateway=192.168.88.1 comment="" disabled=no
add dst-address=0.0.0.0/0 gateway=192.168.9.1 comment="" disabled=no

First