GeorgeVasil Posted January 11, 2011 #1 Share Posted January 11, 2011 Επιτέλους κατι που παιζει σωστά με DynDNS.(Βιδο-κοντραα εχω φαει ολο το net). http://forum.mikrotik.com/viewtopic.php?f=9&t=34575 @webasdf I've made something similar and have been testing for a few weeks...just saw this post and thought I'd share. I haven't been locked out of dyndns yet, so this should be a good script as well. The main difference is that it queries checkip.dyndns.org for the current publicly facing IP address. I also set up a force update once every day at midnight. This prevents the dyndns domain from expiring due to it not being updated enough (which has happened to me in the past). The script has lots of logs and a few puts in it, but these can be safely deleted if desired. The policies on the scripts mentioned above still apply. Make sure those are set properly as well. The Script "dyndns-update". Set the local variables username, password and hostname: # Set needed variables:local username "dyndnsUsername":local password "dyndnsPassword":local hostname "hostname.dyndns.org":global dyndnsForce:global previousIP# print some debug info:log info ("dyndns-update: username = $username"):log info ("dyndns-update: password = $password"):log info ("dyndns-update: hostname = $hostname"):log info ("dyndns-update: previousIP = $previousIP")# 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]# parse the current IP result:local resultLen [:len $result]:local startLoc [:find $result ": " -1]:set startLoc ($startLoc + 2):local endLoc [:find $result "</body>" -1]:local currentIP [:pick $result $startLoc $endLoc]:log info "dyndns-update: currentIP = $currentIP"# Determine if dyndns update is needed# more dyndns updater request details available at http://www.dyndns.com/developers/specs/syntax.html:if (($currentIP != $previousIP) || ($dyndnsForce = true)) do={ :set dyndnsForce false :set previousIP $currentIP /tool fetch user=$username password=$password mode=http address="members.dyndns.org" src-path="/nic/update?hostname=$hostname&myip=$currentIP" dst-path="/dyndns.txt" :local result [/file get dyndns.txt contents] :log info ("dyndns-update: Dyndns update needed") :log info ("dyndns-update: Dyndns Update Result: ".$result) :put ("Dyndns Update Result: ".$result)} else={ :log info ("dyndns-update: No dyndns update needed")} Script "dyndns-force". Intended to update dyndns only once every 24 hrs. If you run this too much, you may get locked out of dyndns. :global dyndnsForce true/system script run dyndns-update Setup the schedulers. Run dyndns-update every 15 minutes and dyndns-force once every 24 hours: /system scheduler add comment="" disabled=no interval=15m name=dyndns-update on-event=\ dyndns-update start-date=jan/01/1970 start-time=00:00:00/system scheduler add comment="" disabled=no interval=1d name=dyndns-force on-event=\ dyndns-force start-date=jan/01/1970 start-time=02:00:00 ΟΥΑ! (Διωρθωστε και εκεινο στο wiki του ΤWMN γιατι δεν παιζει με 3.30.) Cheers, GV Link to comment Share on other sites More sharing options...
antonis Posted January 11, 2011 #2 Share Posted January 11, 2011 το εχεις καψει . Link to comment Share on other sites More sharing options...
SkySurfer Posted January 11, 2011 #3 Share Posted January 11, 2011 well done GV! τα wiki είναι για να γράφουν ουλοι! Μπορείς κι εσύ να το κάνεις edit Link to comment Share on other sites More sharing options...
Vatos_locos Posted January 13, 2011 #4 Share Posted January 13, 2011 στα mipsbe ακόμα δεν παίζει το dyndns αλλά παίζουν όλα τα άλλα Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.