Hello, here it is. It's working in a 4.15 ; )

* Martín Ruiz*
* *
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.butchevans.com/pipermail/mikrotik/attachments/20130212/50cd66e0/attachment.html>
-------------- next part --------------
/system script add name=dyndns-update 
policy=ftp,reboot,read,write,policy,test,winbox,password,sniff source="# Set 
needed variables\r\
    \n# modified by Ibersystems http://www.ibersystems.es\r\
    \n:local username \"your_username\"\r\
    \n:local password \"your_pass\"\r\
    \n:local hostname \"your.dyndns.org\"\r\
    \n\r\
    \n:global dyndnsForce\r\
    \n:global previousIP\r\
    \n\r\
    \n# print some debug info\r\
    \n:log info (\"dyndns-update: hostname = \$hostname\")\r\
    \n:log info (\"dyndns-update: 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 \"dyndns-update: currentIP = \$currentIP\"\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    /tool fetch user=\$username password=\$password mode=http 
address=\"members.dyndns.org\" 
src-path=\"/nic/update\?hostname=\$hostname&myip=\$currentIP\" 
dst-path=\"/dyndns.txt\"\r\
    \n    :local result [/file get dyndns.txt contents]\r\
    \n    :set previousIP \$currentIP    \r\
    \n    :log info (\"dyndns-update: Dyndns update needed\")\r\
    \n    :log info (\"dyndns-update: Dyndns Update Result: \".\$result)\r\
    \n    :put (\"Dyndns Update Result: \".\$result)\r\
    \n} else={\r\
    \n    :log info (\"dyndns-update: No dyndns update needed\")\r\
    \n}"
add name=dyndnsForce 
policy=ftp,reboot,read,write,policy,test,winbox,password,sniff source=":global 
dyndnsForce true\r\
    \n/system script run dyndns-update"
/system scheduler
add comment="" disabled=no interval=15m name=dyndns-update on-event=\
    dyndns-update policy=read,write,test start-date=jan/01/1970 start-time=\
    00:00:00
add comment="" disabled=no interval=1d name=dyndns-force on-event=dyndnsForce \
    policy=read,write,test start-date=jan/01/1970 start-time=02:08:00

_______________________________________________
Mikrotik mailing list
[email protected]
http://mail.butchevans.com/mailman/listinfo/mikrotik

Visit http://blog.butchevans.com/ for tutorials related to Mikrotik RouterOS

Reply via email to