Hi to all,
search on the net for a DDNS script for Mikrotik v4.9, but I have'nt find something.
Does anybody know where / and how, can I find the script to update the DDNS (free dns provider dyndns)?
Thank you in advance.
Costas
# Set needed variables
:local username "yourusername"
:local password "yourpassword"
:local hostname "yourdomain.dyndns.info"
: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)
/blink duration=10s
/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) do={
: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)
/blink duration=10s
} else={
:log info ("dyndns-update: No dyndns update needed")
}