Наверно....

Не надо так, ПЗУ надо беречь, хотя бы так:Sertik писал(а): ↑25 сен 2019, 11:45 # get the current IP address from the internet (in case of double-nat)
/tool fetch mode=http address="checkip.dyndns.org" src-path="/" dst-path="/dyndns.checkip.html"; :local result [/file get dyndns.checkip.html contents]
:global currentIP [:pick $result ([:find $result ": " -1]+2) [:find $result "</body>" -1]]
/file remove dyndns.checkip.html
Код: Выделить всё
# Определяем внешний IP-адрес
:local contentExtIP [/tool fetch url=("http://checkip.dyndns.org/") as-value output=user];
:set contentExtIP ($contentExtIP ->"data");
:local currentExtIP [:pick $contentExtIP ([:find $contentExtIP ": " -1]+2) [:find $contentExtIP "</body>" -1]];
Код: Выделить всё
/ip cloud force-update
:put ([/ip cloud print as-value]->"public-address")
Код: Выделить всё
/ip firewall mangle
chain=prerouting action=mark-connection new-connection-mark=conn-wan1 passthrough=yes connection-mark=no-mark in-interface=wan1
chain=prerouting action=mark-connection new-connection-mark=conn-wan2 passthrough=yes connection-mark=no-mark in-interface=wan2
chain=prerouting action=mark-connection new-connection-mark=conn-wan3 passthrough=yes connection-mark=no-mark in-interface=wan3
chain=prerouting action=mark-routing new-routing-mark=route-wan1 passthrough=yes connection-mark=conn-wan1 in-interface-list=!WAN
chain=prerouting action=mark-routing new-routing-mark=route-wan2 passthrough=yes connection-mark=conn-wan2 in-interface-list=!WAN
chain=prerouting action=mark-routing new-routing-mark=route-wan2 passthrough=yes connection-mark=conn-wan2 in-interface-list=!WAN
chain=output action=mark-routing new-routing-mark=route-wan1 passthrough=no connection-mark=conn-wan1
chain=output action=mark-routing new-routing-mark=route-wan2 passthrough=no connection-mark=conn-wan2
chain=output action=mark-routing new-routing-mark=route-wan3 passthrough=no connection-mark=conn-wan3
Код: Выделить всё
/ip route
DST-ADDRESS GATEWAY ROUTING-TABLE DISTANCE
0.0.0.0/0 gateway-wan1 main 1
0.0.0.0/0 gateway-wan2 main 2
0.0.0.0/0 gateway-wan3 main 3
0.0.0.0/0 gateway-wan1 route-wan1 11
0.0.0.0/0 gateway-wan2 route-wan1 12
0.0.0.0/0 gateway-wan3 route-wan1 13
0.0.0.0/0 gateway-wan2 route-wan2 11
0.0.0.0/0 gateway-wan1 route-wan2 12
0.0.0.0/0 gateway-wan3 route-wan2 13
0.0.0.0/0 gateway-wan3 route-wan3 11
0.0.0.0/0 gateway-wan2 route-wan3 12
0.0.0.0/0 gateway-wan1 route-wan3 13
Код: Выделить всё
/ip firewall address-list
list=external-api address=api.syo.su
list=external-wan1 address=1.1.1.1
list=external-wan2 address=2.2.2.2
list=external-wan3 address=3.3.3.3
Код: Выделить всё
/ip firewall mangle
chain=output action=mark-routing new-routing-mark=main passthrough=no dst-address-list=external-api
Код: Выделить всё
/ip firewal mangle set new-routing-mark=route-wan1 [find where dst-address-list="external-api"]
:delay 1s
:local res1 [/tool fetch mode=http http-method="get" url="http://api.syo.su/myip" output=user as-value]
:if (($res1->"status")="finished") do={
/ip firewall address-list set address=($res1->"data") [find where list="external-wan1" && address!=($res1->"data")]
} else={
/ip firewall address-list set address=0.0.0.0 [find where list="external-wan1" && address!=0.0.0.0]
}
/ip firewal mangle set new-routing-mark=route-wan2 [find where dst-address-list="external-api"]
:delay 1s
:local res2 [/tool fetch mode=http http-method="get" url="http://api.syo.su/myip" output=user as-value]
:if (($res2->"status")="finished") do={
/ip firewall address-list set address=($res2->"data") [find where list="external-wan2" && address!=($res2->"data")]
} else={
/ip firewall address-list set address=0.0.0.0 [find where list="external-wan2" && address!=0.0.0.0]
}
/ip firewal mangle set new-routing-mark=route-wan3 [find where dst-address-list="external-api"]
:delay 1s
:local res3 [/tool fetch mode=http http-method="get" url="http://api.syo.su/myip" output=user as-value]
:if (($res3->"status")="finished") do={
/ip firewall address-list set address=($res3->"data") [find where list="external-wan3" && address!=($res3->"data")]
} else={
/ip firewall address-list set address=0.0.0.0 [find where list="external-wan3" && address!=0.0.0.0]
}
/ip firewal mangle set new-routing-mark=main [find where dst-address-list="external-api"]
Код: Выделить всё
POST http://router/rest/ip/firewall/address-list/print
{".query": ["list=external-wan1"]}