Load Balancing and Fail Over for 3 PPPoE WAN connection(NTH Method)

  /interface pppoe-client
add ac-name="" add-default-route=no allow=pap,chap,mschap1,mschap2 comment="" \
    dial-on-demand=no disabled=no interface=ether1 max-mru=1480 \
    max-mtu=1480 mrru=disabled name=pppoe-out1 password=1234 profile=default \
    service-name="" use-peer-dns=yes user=sysnet1@isp
add ac-name="" add-default-route=no allow=pap,chap,mschap1,mschap2 comment="" \
    dial-on-demand=no disabled=no interface=ether2 max-mru=1480 \
    max-mtu=1480 mrru=disabled name=pppoe-out2 password=1234 profile=default \
    service-name="" use-peer-dns=no user=sysnet2@isp
add ac-name="" add-default-route=no allow=pap,chap,mschap1,mschap2 comment="" \
    dial-on-demand=no disabled=no interface=ether3 max-mru=1480 \
    max-mtu=1480 mrru=disabled name=pppoe-out3 password=1234 profile=default \
    service-name="" use-peer-dns=no user=sysnet2@isp

================================================================================================================================

/interface ethernet
set 0 name=Local

/ip address
add address=192.168.2.1/24 interface=Local

/ip dns set allow-remote-requests=yes cache-max-ttl=1w cache-size=5000KiB max-udp-packet-size=512 servers=103.28.3.187,8.8.8.8

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

add chain=prerouting in-interface=Local connection-state=new nth=3,2 action=mark-connection new-connection-mark=conn2 passthrough=yes comment="" disabled=no
add chain=prerouting in-interface=Local connection-mark=conn2 action=mark-routing new-routing-mark=conn2 passthrough=no comment="" disabled=no

add chain=prerouting in-interface=Local connection-state=new nth=3,3 action=mark-connection new-connection-mark=conn3 passthrough=yes comment="" disabled=no
add chain=prerouting in-interface=Local connection-mark=conn3 action=mark-routing new-routing-mark=conn3 passthrough=no comment="" disabled=no

/ip firewall nat
add chain=srcnat connection-mark=conn1 action=masquerade out-interface=pppoe-out1 comment="" disabled=no
add chain=srcnat connection-mark=conn2 action=masquerade out-interface=pppoe-out2 comment="" disabled=no
add chain=srcnat connection-mark=conn3 action=masquerade out-interface=pppoe-out3 comment="" disabled=no

/ip route
add dst-address=0.0.0.0/0 gateway=pppoe-out1 scope=255 target-scope=10 routing-mark=conn1 comment="" disabled=no
add dst-address=0.0.0.0/0 gateway=pppoe-out2 scope=255 target-scope=10 routing-mark=conn2 comment="" disabled=no
add dst-address=0.0.0.0/0 gateway=pppoe-out3 scope=255 target-scope=10 routing-mark=conn3 comment="" disabled=no

add dst-address=0.0.0.0/0 gateway=pppoe-out1 comment="" disabled=no
add dst-address=0.0.0.0/0 gateway=pppoe-out2 comment="" disabled=no
add dst-address=0.0.0.0/0 gateway=pppoe-out3 comment="" disabled=no
Previous
Next Post »