วันพฤหัสบดีที่ 3 สิงหาคม พ.ศ. 2560

ppc Failover Mikrotik ppoe+static


/ip address
add address=192.168.0.1/24 interface=lan network=192.168.0.0
add address=192.168.2.1/24 interface=wifi network=192.168.2.0
add address=192.168.1.200/24 interface=wan2 network=192.168.1.0

/ip firewall mangle
add action=mark-connection chain=prerouting in-interface=lan\
new-connection-mark=pppoe-out1 passthrough=yes src-address-list=pppoe-out1
add action=mark-routing chain=prerouting in-interface=lan\
new-routing-mark=pppoe-out1 passthrough=no src-address-list=pppoe-out1
add action=mark-connection chain=prerouting in-interface=lan\
new-connection-mark=wan2 passthrough=yes src-address-list=wan2
add action=mark-routing chain=prerouting in-interface=lan\
new-routing-mark=wan2 passthrough=no src-address-list=wan2
add action=mark-connection chain=prerouting connection-state=new\
in-interface=lan new-connection-mark=pppoe-out1 nth=2,1 passthrough=yes
add action=add-src-to-address-list address-list=pppoe-out1\
address-list-timeout=1d chain=prerouting connection-mark=pppoe-out1\
in-interface=lan
add action=mark-routing chain=prerouting connection-mark=pppoe-out1\
in-interface=lan new-routing-mark=pppoe-out1 passthrough=no
add action=mark-connection chain=prerouting connection-state=new\
in-interface=lan new-connection-mark=wan2 nth=2,2 passthrough=yes
add action=add-src-to-address-list address-list=wan2\
address-list-timeout=1d chain=prerouting connection-mark=wan2\
in-interface=lan
add action=mark-routing chain=prerouting connection-mark=wan2\
in-interface=lan new-routing-mark=wan2 passthrough=no

/ip firewall nat
add action=masquerade chain=srcnat out-interface=pppoe-out1
add action=masquerade chain=srcnat out-interface=wan2

/ip route
add check-gateway=ping comment="wan1" distance=1\
gateway=pppoe-out1 routing-mark=wan1 scope=255
add check-gateway=ping comment="wan2" distance=1\
gateway=192.168.1.1 routing-mark=wan2 scope=255
add check-gateway=ping comment="wan1" distance=2\
gateway=pppoe-out1 routing-mark=wan2 scope=255
add check-gateway=ping comment="wan2" distance=2\
gateway=192.168.1.1 routing-mark=wan1 scope=255
add check-gateway=ping distance=1 gateway=pppoe-out1 scope=255
add check-gateway=ping distance=2 gateway=192.168.1.1 scope=255
add comment="netwatch opendns wan1" distance=1\
dst-address=208.67.222.222/32 gateway=pppoe-out1
add comment="netwatch opendns wan2" distance=1\
dst-address=208.67.220.220/32 gateway=192.168.1.1

/tool netwatch
add down-script="/ip route disable [find comment=wan1]"\
host=208.67.222.222 up-script="/ip route enable [find comment=wan1]"
add down-script="/ip route disable [find comment=wan2]"\
host=208.67.220.220 up-script="/ip route enable [find comment=wan2]"

ไม่มีความคิดเห็น:

แสดงความคิดเห็น