Professional Documents
Culture Documents
ether4-gateway4 passthrough=no
add action=mark-connection chain=prerouting comment=EST_C_1 connection-state=\
established disabled=no in-interface=ether1-gateway new-connection-mark=\
wan1 passthrough=yes protocol=tcp src-port=!80
add action=mark-connection chain=prerouting comment=EST_C_2 connection-state=\
established disabled=no in-interface=ether2-gateway2 new-connection-mark=\
wan2 passthrough=yes protocol=tcp src-port=!80
add action=mark-connection chain=prerouting comment=EST_C_3 connection-state=\
established disabled=no in-interface=ether3-gateway3 new-connection-mark=\
wan3 passthrough=yes protocol=tcp src-port=!80
add action=mark-connection chain=prerouting comment=EST_C_4 connection-state=\
established disabled=no in-interface=ether4-gateway4 new-connection-mark=\
wan4 passthrough=yes protocol=tcp src-port=!80
add action=mark-routing chain=output comment=EST_R_1 connection-mark=wan1 \
connection-state=established disabled=no dst-port=!80 new-routing-mark=\
wan1 passthrough=no protocol=tcp
add action=mark-routing chain=output comment=EST_R_2 connection-mark=wan2 \
connection-state=established disabled=no dst-port=!80 new-routing-mark=\
wan2 passthrough=no protocol=tcp
add action=mark-routing chain=output comment=EST_R_3 connection-mark=wan3 \
connection-state=established disabled=no dst-port=!80 new-routing-mark=\
wan3 passthrough=no protocol=tcp
add action=mark-routing chain=output comment=EST_R_4 connection-mark=wan4 \
connection-state=established disabled=no dst-port=!80 new-routing-mark=\
wan4 passthrough=no protocol=tcp
add action=mark-connection chain=prerouting comment=PCC_C_1 disabled=no \
dst-address-type=!local dst-port=!80 in-interface=Local \
new-connection-mark=wan1_pcc_conn passthrough=yes \
per-connection-classifier=both-addresses:4/0 protocol=tcp
add action=mark-connection chain=prerouting comment=PCC_C_2 disabled=no \
dst-address-type=!local dst-port=!80 in-interface=Local \
new-connection-mark=wan2_pcc_conn passthrough=yes \
per-connection-classifier=both-addresses:4/1 protocol=tcp
add action=mark-connection chain=prerouting comment=PCC_C_3 disabled=no \
dst-address-type=!local dst-port=!80 in-interface=Local \
new-connection-mark=wan3_pcc_conn passthrough=yes \
per-connection-classifier=both-addresses:4/2 protocol=tcp
add action=mark-connection chain=prerouting comment=PCC_C_4 disabled=no \
dst-address-type=!local dst-port=!80 in-interface=Local \
new-connection-mark=wan4_pcc_conn passthrough=yes \
per-connection-classifier=both-addresses:4/3 protocol=tcp
add action=mark-connection chain=prerouting comment=PCC_C_1 disabled=no \
dst-address-type=!local in-interface=Local new-connection-mark=\
wan1_pcc_conn passthrough=yes per-connection-classifier=\
both-addresses:4/0 protocol=udp
add action=mark-connection chain=prerouting comment=PCC_C_2 disabled=no \
dst-address-type=!local in-interface=Local new-connection-mark=\
wan2_pcc_conn passthrough=yes per-connection-classifier=\
both-addresses:4/1 protocol=udp
add action=mark-connection chain=prerouting comment=PCC_C_3 disabled=no \
dst-address-type=!local in-interface=Local new-connection-mark=\
wan3_pcc_conn passthrough=yes per-connection-classifier=\
both-addresses:4/2 protocol=udp
add action=mark-connection chain=prerouting comment=PCC_C_4 disabled=no \
dst-address-type=!local in-interface=Local new-connection-mark=\
wan4_pcc_conn passthrough=yes per-connection-classifier=\
both-addresses:4/3 protocol=udp
add action=mark-routing chain=prerouting comment=PCC_R_1 connection-mark=\
wan1_pcc_conn disabled=no in-interface=Local new-routing-mark=wan1 \
passthrough=yes
set time-zone-name=America/Caracas
/system clock manual
set dst-delta=+00:00 dst-end="mar/01/1970 00:00:00" dst-start=\
"mar/01/1970 00:00:00" time-zone=+00:00
/system console
add disabled=no term=vt102
/system health
set
/system identity
set name=MikroTik
/system logging
add action=memory disabled=no prefix="" topics=info
add action=memory disabled=no prefix="" topics=error
add action=memory disabled=no prefix="" topics=warning
add action=echo disabled=no prefix="" topics=critical
/system note
set note="" show-at-login=yes
/system ntp client
set enabled=yes mode=unicast primary-ntp=190.202.98.221 secondary-ntp=0.0.0.0
/system scheduler
add comment="" disabled=no interval=40s name=ether1-run on-event=\
"/system script run failover-ether1" policy=\
reboot,read,write,policy,test,password,sniff,sensitive start-time=startup
add comment="" disabled=no interval=40s name=ether2-run on-event=\
"/system script run failover-ether2" policy=\
reboot,read,write,policy,test,password,sniff,sensitive start-time=startup
add comment="" disabled=no interval=40s name=ether3-run on-event=\
"/system script run failover-ether3" policy=\
reboot,read,write,policy,test,password,sniff,sensitive start-time=startup
add comment="" disabled=no interval=40s name=ether4-run on-event=\
"/system script run failover-ether4" policy=\
reboot,read,write,policy,test,password,sniff,sensitive start-time=startup
/system script
add name=failover-ether1 policy=\
ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive source="\
:global GA [/ip dhcp-client get ether1-gateway gateway] \r\
\n:global GB [/ip dhcp-client get ether2-gateway2 gateway]\r\
\n\r\
\n:global pingresultA\r\
\n:global pingresultB\r\
\n\r\
\n:if ([:len \$GA] != 0) do={\r\
\n
:global pingresultA [/ping \$GA interface=ether1-gatewa\
y count=3]\r\
\n} else={\r\
\n
:global pingresultA 0\r\
\n}\r\
\n#Si WAN1 esta activo:\r\
\n:if (\$pingresultA>0) do={\r\
\n
:local gatewayNuevo [/ip dhcp-client get [find interface=ether1-gate\
way] gateway ]\r\
\n
:local gatewayActivo [/ip route get [find routing-mark=wan1] gateway\
\_]\r\
\n
:if (\$gatewayNuevo != \$gatewayActivo) do={\r\
\n\t/ip route set [find routing-mark=wan1] gateway=[/ip dhcp-client get [f\
ind interface=ether1-gateway] gateway ]\r\
\n\t:log info \"Wan1 activo y se actualiza Gateway\" \r\
\n
} \r\
\n
\r\
\n}\r\
\n\r\
\n#Si WAN1 se cae:\r\
\n:if (\$pingresultA=0) do={ \r\
\n\r\
\n
:local status [/ip dhcp-client get [/ip dhcp-client find\
\_interface=ether1-gateway] status ]\r\
\n
:if (\$status=\"bound\") do={\r\
\n
/ip dhcp-client set [find interface=eth\
er1-gateway] disabled=yes\r\
\n
:local d [/ip dhcp-client get [/ip dhcp-\
client find interface=ether1-gateway] disabled ]\r\
\n
:if (\$d=true) do={\r\
\n
/ip dhcp-client set [find inter\
face=ether1-gateway] disabled=no\r\
\n
}\r\
\n
}\r\
\n\r\
\n
\t:local pingresultB [/ping 208.67.220.220 interface=ether2-gateway2\
\_count=10]\r\
\n\t:if (\$pingresultB>0) do={ \r\
\n\t\t:local gatewayNuevoB [/ip dhcp-client get [find interface=ether2-gat\
eway2] gateway ]\r\
\n
\t\t:local gatewayActivoA [/ip route get [find routing-mark=wan1] ga\
teway ]\r\
\n\t\t:if (\$gatewayNuevoB != \$gatewayActivoA) do={\r\
\n\t\t\t/ip route set [find routing-mark=wan1] gateway=[/ip dhcp-client ge\
t [find interface=ether2-gateway2] gateway ]\r\
\n\t\t\t:log info \"Wan1 inactivo se le asigna el Gateway del Wan2 \" \r\
\n\t\t}\t\r\
\n\t\t\r\
\n\t}\r\
\n\t:if (\$pingresultB=0) do={ \r\
\n\t\t:local pingresultC [/ping 208.67.220.220 interface=ether3-gateway3 c\
ount=10]\r\
\n\t\t:if (\$pingresultC>0) do={ \r\
\n\t\t\t:local gatewayNuevoC [/ip dhcp-client get [find interface=ether3-g\
ateway3] gateway ]\r\
\n
\t\t\t:local gatewayActivoA [/ip route get [find routing-mark=wan1] \
gateway ]\r\
\n\t\t\t:if (\$gatewayNuevoC != \$gatewayActivoA) do={\r\
\n\t\t\t\t/ip route set [find routing-mark=wan1] gateway=[/ip dhcp-client \
get [find interface=ether3-gateway3] gateway ]\r\
\n\t\t\t\t:log info \"Wan1 inactivo se le asigna el Gateway del Wan3 \" \r\
\n\t\t\t}\r\
\n\t\t}\r\
\n\r\
\n\t\t:if (\$pingresultC=0) do={\r\
\n\t\t\t:local pingresultD [/ping 208.67.220.220 interface=ether4-gateway4\
\_count=10]\r\
\n\t\t\t:if (\$pingresultD>0) do={ \r\
\n\t\t\t\t:local gatewayNuevoD [/ip dhcp-client get [find interface=ether4\
-gateway4] gateway ]\r\
\n
\t\t\t\t:local gatewayActivoA [/ip route get [find routing-mark=wan1\
] gateway ]\r\
\n\t\t\t\t:if (\$gatewayNuevoD != \$gatewayActivoA) do={\r\
\n\t\t\t\t\t/ip route set [find routing-mark=wan1] gateway=[/ip dhcp-clien\
t get [find interface=ether4-gateway4] gateway ]\r\
\n\t\t\t\t\t:log info \"Wan1 inactivo se le asigna el Gateway del Wan4 \" \
\r\
\n\t\t\t\t}\r\
\n\t\t\t}\r\
\n\t\t}\r\
\n\t}\r\
\n
\r\
\n}\r\
\n"
add name=failover-ether2 policy=\
ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive source="\
:global GA [/ip dhcp-client get ether1-gateway gateway] \r\
\n:global GB [/ip dhcp-client get ether2-gateway2 gateway]\r\
\n\r\
\n:global pingresultA\r\
\n:global pingresultB\r\
\n\r\
\n:if ([:len \$GB] != 0) do={\r\
\n
:global pingresultB [/ping \$GB interface=ether2-gatewa\
y2 count=3]\r\
\n} else={\r\
\n
:global pingresultB 0\r\
\n}\r\
\n\r\
\n#Si WAN2 esta activo:\r\
\n:if (\$pingresultB>0) do={\r\
\n
:local gatewayNuevo [/ip dhcp-client get [find interface=ether2-gate\
way2] gateway ]\r\
\n
:local gatewayActivo [/ip route get [find routing-mark=wan2] gateway\
\_]\r\
\n
:if (\$gatewayNuevo != \$gatewayActivo) do={\r\
\n\t/ip route set [find routing-mark=wan2] gateway=[/ip dhcp-client get [f\
ind interface=ether2-gateway2] gateway ]\r\
\n\t:log info \"Wan2 activo y se actualiza Gateway\" \r\
\n
} \r\
\n}\r\
\n\r\
\n#Si WAN2 se cae:\r\
\n:if (\$pingresultB=0) do={ \r\
\n\r\
\n
:local status [/ip dhcp-client get [/ip dhcp-client fi\
nd interface=ether2-gateway2] status ]\r\
\n
:if (\$status=\"bound\") do={\r\
\n
/ip dhcp-client set [find interface=eth\
er2-gateway2] disabled=yes\r\
\n
:local d [/ip dhcp-client get [/ip dhcp-\
client find interface=ether2-gateway2] disabled ]\r\
\n
:if (\$d=true) do={\r\
\n
/ip dhcp-client set [find inter\
face=ether2-gateway2] disabled=no\r\
\n
}\r\
\n
}\r\
\n \r\
\n
\t:local pingresultA [/ping 208.67.222.222 interface=ether1-gateway \
count=10]\r\
\n\t:if (\$pingresultA>0) do={ \r\
\n\t\t:local gatewayNuevoA [/ip dhcp-client get [find interface=ether1-gat\
eway] gateway ]\r\
\n
\t\t:local gatewayActivoB [/ip route get [find routing-mark=wan2] ga\
teway ]\r\
\n\t\t:if (\$gatewayNuevoA != \$gatewayActivoB) do={\r\
\n\t\t\t/ip route set [find routing-mark=wan2] gateway=[/ip dhcp-client ge\
t [find interface=ether1-gateway] gateway ]\r\
\n\t\t\t:log info \"Wan2 inactivo se le asigna el Gateway del Wan1 \" \r\
\n\t\t}\t\t\r\
\n\t}\t\r\
\n\t:if (\$pingresultA=0) do={ \r\
\n\t\t:local pingresultC [/ping 208.67.222.222 interface=ether3-gateway3 c\
ount=10]\r\
\n\t\t:if (\$pingresultC>0) do={ \r\
\n\t\t\t:local gatewayNuevoC [/ip dhcp-client get [find interface=ether3-g\
ateway3] gateway ]\r\
\n
\t\t\t:local gatewayActivoB [/ip route get [find routing-mark=wan2] \
gateway ]\r\
\n\t\t\t:if (\$gatewayNuevoC != \$gatewayActivoB) do={\r\
\n\t\t\t\t/ip route set [find routing-mark=wan2] gateway=[/ip dhcp-client \
get [find interface=ether3-gateway3] gateway ]\r\
\n\t\t\t\t:log info \"Wan2 inactivo se le asigna el Gateway del Wan3 \" \r\
\n\t\t\t}\r\
\n\t\t}\r\
\n\r\
\n\t\t:if (\$pingresultC=0) do={
\r\
\n\t\t\t:local pingresultD [/ping 208.67.222.222 interface=ether4-gateway4\
\_count=10]\r\
\n\t\t\t:if (\$pingresultD>0) do={ \r\
\n\t\t\t\t:local gatewayNuevoD [/ip dhcp-client get [find interface=ether4\
-gateway4] gateway ]\r\
\n
\t\t\t\t:local gatewayActivoB [/ip route get [find routing-mark=wan2\
] gateway ]\r\
\n\t\t\t\t:if (\$gatewayNuevoD != \$gatewayActivoB) do={\r\
\n\t\t\t\t\t/ip route set [find routing-mark=wan2] gateway=[/ip dhcp-clien\
t get [find interface=ether4-gateway4] gateway ]\r\
\n\t\t\t\t\t:log info \"Wan2 inactivo se le asigna el Gateway del Wan4 \" \
\r\
\n\t\t\t\t}\r\
\n\t\t\t}\r\
\n\r\
\n\t\t}\r\
\n\t}\r\
\n}\r\
\n"
add name=failover-ether3 policy=\
ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive source="\
\r\
\n:global GA [/ip dhcp-client get ether1-gateway gateway] \r\
\n:global GC [/ip dhcp-client get ether3-gateway3 gateway]\r\
\n\r\
\n:global pingresultA\r\
\n:global pingresultC\r\
\n\r\
\n:if ([:len \$GC] != 0) do={\r\
\n
:global pingresultC [/ping \$GC interface=ether3-gatewa\
y3 count=3]\r\
\n} else={\r\
\n
:global pingresultC 0\r\
\n}\r\
\n\r\
\n#Si WAN3 esta activo:\r\
\n:if (\$pingresultC>0) do={\r\
\n
:local gatewayNuevo [/ip dhcp-client get [find interface=ether3-gate\
way3] gateway]\r\
\n
:local gatewayActivo [/ip route get [find routing-mark=wan3] gateway\
\_]\r\
\n
:if (\$gatewayNuevo != \$gatewayActivo) do={\r\
\n\t/ip route set [find routing-mark=wan3] gateway=[/ip dhcp-client get [f\
ind interface=ether3-gateway3] gateway ]\r\
\n\t:log info \"Wan3 activo y se actualiza Gateway\" \r\
\n
} \r\
\n}\r\
\n\r\
\n#Si WAN3 se cae:\r\
\n:if (\$pingresultC=0) do={ \r\
\n\r\
\n
:local status [/ip dhcp-client get [/ip dhcp-client find\
\_interface=ether3-gateway3] status ]\r\
\n
:if (\$status=\"bound\") do={\r\
\n
/ip dhcp-client set [find interface=eth\
er3-gateway3] disabled=yes\r\
\n
:local d [/ip dhcp-client get [/ip dhcp-\
client find interface=ether3-gateway3] disabled ]\r\
\n
:if (\$d=true) do={\r\
\n
/ip dhcp-client set [find inter\
face=ether3-gateway3] disabled=no\r\
\n
}\r\
\n
}\r\
\n \r\
\n
\t:local pingresultB [/ping 208.67.222.222 interface=ether4-gateway4\
\_count=10]\r\
\n\t:if (\$pingresultB>0) do={ \r\
\n\t\t:local gatewayNuevoB [/ip dhcp-client get [find interface=ether4-gat\
eway4] gateway ]\r\
\n
\t\t:local gatewayActivoC [/ip route get [find routing-mark=wan3] ga\
teway ]\r\
\n\t\t:if (\$gatewayNuevoB != \$gatewayActivoC) do={\r\
\n\t\t\t/ip route set [find routing-mark=wan3] gateway=[/ip dhcp-client ge\
t [find interface=ether4-gateway4] gateway ]\r\
\n\t\t\t:log info \"Wan3 inactivo se le asigna el Gateway del Wan4 \" \r\
\n\t\t}\t\t\r\
\n\t}\t\r\
\n\t:if (\$pingresultB=0) do={ \r\
\n\t\t:local pingresultA [/ping 208.67.222.222 interface=ether1-gateway co\
unt=10]\r\
\n\t\t:if (\$pingresultA>0) do={ \r\
\n\t\t\t:local gatewayNuevoA [/ip dhcp-client get [find interface=ether1-g\
ateway] gateway ]\r\
\n
\t\t\t:local gatewayActivoC [/ip route get [find routing-mark=wan3] \
gateway ]\r\
\n\t\t\t:if (\$gatewayNuevoA != \$gatewayActivoC) do={\r\
\n\t\t\t\t/ip route set [find routing-mark=wan3] gateway=[/ip dhcp-client \
get [find interface=ether1-gateway] gateway ]\r\
\n\t\t\t\t:log info \"Wan3 inactivo se le asigna el Gateway del Wan1 \" \r\
\n\t\t\t}\r\
\n\t\t}\r\
\n\t\t:if (\$pingresultA=0) do={ \r\
\n\t\t\t:local pingresultD [/ping 208.67.222.222 interface=ether2-gateway2\
\_count=10]\r\
\n\t\t\t:if (\$pingresultD>0) do={ \r\
\n\t\t\t\t:local gatewayNuevoD [/ip dhcp-client get [find interface=ether2\
-gateway2] gateway ]\r\
\n\t
\t\t\t:local gatewayActivoC [/ip route get [find routing-mark=wan3\
] gateway ]\r\
\n\t\t\t\t:if (\$gatewayNuevoD != \$gatewayActivoC) do={\r\
\n\t\t\t\t\t/ip route set [find routing-mark=wan3] gateway=[/ip dhcp-clien\
teway ]\r\
\n\t\t:if (\$gatewayNuevoC != \$gatewayActivoD) do={\r\
\n\t\t\t/ip route set [find routing-mark=wan4] gateway=[/ip dhcp-client ge\
t [find interface=ether3-gateway3] gateway ]\r\
\n\t\t\t:log info \"Wan4 inactivo se le asigna el Gateway del Wan3 \" \r\
\n\t\t}\t\t\r\
\n\t}\t\r\
\n\t:if (\$pingresultC=0) do={ \r\
\n\t\t:local pingresultB [/ping 208.67.222.222 interface=ether2-gateway2 c\
ount=10]\r\
\n\t\t:if (\$pingresultB>0) do={ \r\
\n\t\t\t:local gatewayNuevoB [/ip dhcp-client get [find interface=ether2-g\
ateway2] gateway ]\r\
\n
\t\t\t:local gatewayActivoD [/ip route get [find routing-mark=wan4] \
gateway ]\r\
\n\t\t\t:if (\$gatewayNuevoB != \$gatewayActivoD) do={\r\
\n\t\t\t\t/ip route set [find routing-mark=wan4] gateway=[/ip dhcp-client \
get [find interface=ether2-gateway2] gateway ]\r\
\n\t\t\t\t:log info \"Wan4 inactivo se le asigna el Gateway del Wan2 \" \r\
\n\t\t\t}\r\
\n\t\t}\r\
\n\t\t:if (\$pingresultB=0) do={ \r\
\n\t\t\t:local pingresultA [/ping 208.67.222.222 interface=ether1-gateway \
count=10]\r\
\n\t\t\t:if (\$pingresultA>0) do={ \r\
\n\t\t\t\t:local gatewayNuevoA [/ip dhcp-client get [find interface=ether1\
-gateway] gateway ]\r\
\n\t
\t\t\t:local gatewayActivoD [/ip route get [find routing-mark=wan4\
] gateway ]\r\
\n\t\t\t\t:if (\$gatewayNuevoA != \$gatewayActivoD) do={\r\
\n\t\t\t\t\t/ip route set [find routing-mark=wan4] gateway=[/ip dhcp-clien\
t get [find interface=ether1-gateway] gateway ]\r\
\n\t\t\t\t\t:log info \"Wan4 inactivo se le asigna el Gateway del Wan1 \" \
\r\
\n\t\t\t\t}\r\
\n\t\t\t}\r\
\n\t\t}\r\
\n\t}\r\
\n}\r\
\n"
/system upgrade mirror
set check-interval=1d enabled=no primary-server=0.0.0.0 secondary-server=\
0.0.0.0 user=""
/system watchdog
set auto-send-supout=no automatic-supout=yes no-ping-delay=5m watch-address=\
none watchdog-timer=yes
/tool bandwidth-server
set allocate-udp-ports-from=2000 authenticate=yes enabled=yes max-sessions=\
100
/tool e-mail
set from=<> password="" server=0.0.0.0:25 username=""
/tool graphing
set page-refresh=300 store-every=5min
/tool graphing interface
add allow-address=0.0.0.0/0 disabled=no interface=all store-on-disk=yes
/tool mac-server
add disabled=no interface=ether2-gateway2
add disabled=no interface=ether3-gateway3
add disabled=no interface=ether4-gateway4
add disabled=no interface=Local