Я видел здесь несколько скриптов для DDNS, но обычно они работали с проблемами совместимости на новых версиях RouterOS. Хочу поделиться тем, что использую я. Работает даже если вы за вторым NAT, поскольку опирается на внешний сервис для определения IP.
DynDNS:
:local DDNSuser "login"
:local DDNSpass "password"
:local DDNShost "domain.dyndns.info"
:local CURRip [/tool fetch url="http://myip.dnsomatic.com/index.html" mode=http dst-path=CURRip; :delay 1; /file get CURRip contents; /file remove CURRip]
if ([:resolve $DDNShost] != $CURRip) do={
/tool fetch url="http://members.dyndns.org/nic/update?hostname=$DDNShost&myip=$CURRip" mode=http user=$DDNSuser password=$DDNSpass dst-path=DDNShost keep-result=no;
/log info message=("DDNS: Обновляю $DDNShost с IP: $CURRip")
}
NO-IP:
:local DDNSuser "login"
:local DDNSpass "password"
:local DDNSHost "domain.no-ip.com"
:local CURRip [/tool fetch url="http://myip.dnsomatic.com/index.html" mode=http dst-path=CURRip; :delay 1; /file get CURRip contents; /file remove CURRip]
if ([:resolve $DDNShost] != $CURRip) do={
/tool fetch url="http://dynupdate.no-ip.com/nic/update?hostname=$DDNShost&myip=$CURRip" mode=http user=$DDNSuser password=$DDNSpass dst-path=DDNShost keep-result=no;
/log info message=("DDNS: Обновляю $DDNShost с IP: $CURRip")
}
ChangeIP:
:local DDNSuser "login"
:local DDNSpass "password"
:local DDNSHost "domain.changeip.com"
:local CURRip [/tool fetch url="http://myip.dnsomatic.com/index.html" mode=http dst-path=CURRip; :delay 1; /file get CURRip contents; /file remove CURRip]
if ([:resolve $DDNShost] != $CURRip) do={
/tool dns-update name=$DDNShost address=$CURRip key-name=$DDNSuser key=$DDNSpass
/log info message=("DDNS: Обновляю $DDNShost с IP: $CURRip")
}
DynDNS:
:local DDNSuser "login"
:local DDNSpass "password"
:local DDNShost "domain.dyndns.info"
:local CURRip [/tool fetch url="http://myip.dnsomatic.com/index.html" mode=http dst-path=CURRip; :delay 1; /file get CURRip contents; /file remove CURRip]
if ([:resolve $DDNShost] != $CURRip) do={
/tool fetch url="http://members.dyndns.org/nic/update?hostname=$DDNShost&myip=$CURRip" mode=http user=$DDNSuser password=$DDNSpass dst-path=DDNShost keep-result=no;
/log info message=("DDNS: Обновляю $DDNShost с IP: $CURRip")
}
NO-IP:
:local DDNSuser "login"
:local DDNSpass "password"
:local DDNSHost "domain.no-ip.com"
:local CURRip [/tool fetch url="http://myip.dnsomatic.com/index.html" mode=http dst-path=CURRip; :delay 1; /file get CURRip contents; /file remove CURRip]
if ([:resolve $DDNShost] != $CURRip) do={
/tool fetch url="http://dynupdate.no-ip.com/nic/update?hostname=$DDNShost&myip=$CURRip" mode=http user=$DDNSuser password=$DDNSpass dst-path=DDNShost keep-result=no;
/log info message=("DDNS: Обновляю $DDNShost с IP: $CURRip")
}
ChangeIP:
:local DDNSuser "login"
:local DDNSpass "password"
:local DDNSHost "domain.changeip.com"
:local CURRip [/tool fetch url="http://myip.dnsomatic.com/index.html" mode=http dst-path=CURRip; :delay 1; /file get CURRip contents; /file remove CURRip]
if ([:resolve $DDNShost] != $CURRip) do={
/tool dns-update name=$DDNShost address=$CURRip key-name=$DDNSuser key=$DDNSpass
/log info message=("DDNS: Обновляю $DDNShost с IP: $CURRip")
}