Этот скрипт был адаптирован из скрипта для обновления entryDNS. Проверен на routerOS 6.x.
Переменные:
:local GoogleDNSUsername “xxx”
:local GOogleDNSPassword “xxx”
:local hostName “xxx”
:local GoogleDNSForceUpdate false
:local currentIP “”
:global previousIP
Скрипт:
/tool fetch url=“” mode=http dst-path=“publicip.txt”
:set currentIP [/file get “publicip.txt” contents]
/file remove “publicip.txt”
:if ([:typeof $previousIP] = “nothing”) do={
:set previousIP “”
}
:if ($currentIP != $previousIP) do={
:set GoogleDNSForceUpdate true
:set previousIP $currentIP
}
:if ($GoogleDNSForceUpdate) do={
:do {
/tool fetch url=“https://$GoogleDNSUsername:$GOogleDNSPassword@domains.google.com/nic/update?hostname=$hostName&myip=$currentIP” mode=https keep-result=no
:log info (“GoogleDNS Updated: current IP = $currentIP”)
} on-error={
:log error (“GoogleDNS: Failed Updating”)
}
}
Переменные:
:local GoogleDNSUsername “xxx”
:local GOogleDNSPassword “xxx”
:local hostName “xxx”
:local GoogleDNSForceUpdate false
:local currentIP “”
:global previousIP
Скрипт:
/tool fetch url=“” mode=http dst-path=“publicip.txt”
:set currentIP [/file get “publicip.txt” contents]
/file remove “publicip.txt”
:if ([:typeof $previousIP] = “nothing”) do={
:set previousIP “”
}
:if ($currentIP != $previousIP) do={
:set GoogleDNSForceUpdate true
:set previousIP $currentIP
}
:if ($GoogleDNSForceUpdate) do={
:do {
/tool fetch url=“https://$GoogleDNSUsername:$GOogleDNSPassword@domains.google.com/nic/update?hostname=$hostName&myip=$currentIP” mode=https keep-result=no
:log info (“GoogleDNS Updated: current IP = $currentIP”)
} on-error={
:log error (“GoogleDNS: Failed Updating”)
}
}
