we have a self written dynDNS script running on our routers that work 99% of the time but doesn't in some cases.
We use dns as a means to get a heartbeat from all our routers, so its important that they phone home every minute or so.
I've checked erverything i can think of but can't figure out why in some cases it doesn't update dns.
The script itself runs just fine, it logs that it has checked for an updated ip and so on but the update doesn't make it to the server.
Does anyone have experience with dyndns scripts and their behaviour?
Code: Select all
# set mandatory variables
:local username [/system identity get name ]
:local password "nrtestcase1"
:global dyndnsForce
:global previousIP
:log info ("previous IP is $previousIP")
# get currentIP to file currentip.txt
/tool fetch mode=http url="http://ddns.xxxx.xx/nic/checkip" dst-path=/currentip.txt
# parse file currentip.txt for current IP
:local currentIP [/file get currentip.txt contents]
:set dyndnsForce true
# Update dynlan1.de
# The following checks first whether or not the currentIP matches the previousIP and based on that information either in case they don't match updates $username.dynlan1.de with the currentIP or in case they do match logs that no update was needed
:if (($currentIP != $previousIP) || ($dyndnsForce = true)) do={
:set dyndnsForce true
:set previousIP $currentIP
/tool fetch mode=http url="http://$username:$password@ddns.xxxx.xx/nic/update?hostname=$username&myip=$currentIP&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG" dst-path=/dyn.txt
:set previousIP $currentIP
:log info ("Updated $username.xxxx.xx to $currentIP")
:log info ("current IP is $currentIP")
} else={
:log info ("$currentIP = $previousIP No update needed!")
}