AntoshAReal
![](http://forum.ru-board.com/board/avatars/russia.gif)
Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору ramzes83 Приведённый скрипт у меня не работает, так же как и в вики, немного переделал и получил это: Код: /system script add name=dyndns_update policy=\ ftp,reboot,read,write,policy,test,winbox,sniff,sensitive source="# Set nee\ ded variables\r\ \n:local username \"логин\"\r\ \n:local password \"пароль\"\r\ \n:local hostname \"nohostset\"\r\ \n:global systemname [/system identity get name]\r\ \n\r\ \n:if (\$systemname = \"MikroTik\" ) do= {\r\ \n:set hostname \"имя.dyndns.org,имя.homeip.net\"\r\ \n}\r\ \n\r\ \n\r\ \n:global dyndnsForce\r\ \n:global previousIP\r\ \n\r\ \n# print some debug info\r\ \n## :log info (\"UpdateDynDNS: username = \$username\")\r\ \n## :log info (\"UpdateDynDNS: password = \$password\")\r\ \n## :log info (\"UpdateDynDNS: hostname = \$hostname\")\r\ \n## :log info (\"UpdateDynDNS: previousIP = \$previousIP\")\r\ \n\r\ \n# get the current IP address from the internet (in case of double-nat)\r\ \n/tool fetch mode=http address=\"checkip.dyndns.org\" src-path=\"/\" dst-\ path=\"/dyndns.checkip.html\"\r\ \n:local result [/file get dyndns.checkip.html contents]\r\ \n\r\ \n# parse the current IP result\r\ \n:local resultLen [:len \$result]\r\ \n:local startLoc [:find \$result \": \" -1]\r\ \n:set startLoc (\$startLoc + 2)\r\ \n:local endLoc [:find \$result \"</body>\" -1]\r\ \n:local currentIP [:pick \$result \$startLoc \$endLoc]\r\ \n## :log info \"UpdateDynDNS: currentIP = \$currentIP\"\r\ \n\r\ \n# Remove the # on next line to force an update every single time - usefu\ l for debugging,\r\ \n# but you could end up getting blacklisted by DynDNS!\r\ \n\r\ \n#:set dyndnsForce true\r\ \n\r\ \n# Determine if dyndns update is needed\r\ \n# more dyndns updater request details available at http://www.dyndns.com\ /developers/specs/syntax.html\r\ \n:if ((\$currentIP != \$previousIP) || (\$dyndnsForce = true)) do={\r\ \n :set dyndnsForce false\r\ \n :set previousIP \$currentIP\r\ \n /tool fetch user=\$username password=\$password mode=http address=\"\ members.dyndns.org\" src-path=\"/nic/update\?hostname=\$hostname&myip=\$cu\ rrentIP\" dst-path=\"/dyndns.txt\"\r\ \n :local result [/file get dyndns.txt contents]\r\ \n## :log info (\"UpdateDynDNS: Dyndns update needed\")\r\ \n :log info (\"UpdateDynDNS: Dyndns Update Result: \".\$result)\r\ \n :put (\"Dyndns Update Result: \".\$result)\r\ \n} else={\r\ \n## :log info (\"UpdateDynDNS: No dyndns update needed\")\r\ \n}" | Измените системное имя на своё. Необходимо этот код выполнить в консоли и добавить в шедулер кодом: Код: /system scheduler add comment=dyndns disabled=no interval=10m name=dyndns_update on-event=\ dyndns_update policy=reboot,write,policy,test,password,sniff,sensitive \ start-date=jan/01/1970 start-time=00:00:00 |
| Всего записей: 305 | Зарегистр. 31-08-2005 | Отправлено: 18:21 16-12-2011 | Исправлено: AntoshAReal, 18:27 16-12-2011 |
|