Hi everyone
I have a problem updating my external IP on both Dyndns and No-Ip. Eth 1 is connected to a DSL modem, so I need a script that runs behind a NAT. I have been looking and trying different scripts for almost a week now!
I run the scripts below but nothing updates. For the dyndns host, in the Routeros log it shows that the new IP must be loaded onto dyndns but when I log onto Dyndns the host name has not updated.
I need to fix this ASAP as I am setting up remote locations, help will be greatly appreciated!!!
NO-IP SCRIPT
#Dynamic DNS Update Script for No-IP DNS behind nat
# Set needed variables
:local username "MY USERNAME TO LOGIN TO NO-IP"
:local password "MY PASSWORD"
:local host "MY NO-IP HOST NAME"
:global previousIP
# print some debug info
:log info ("Update No-IP DNS: username = $username")
:log info ("Update No-IP DNS: hostname = $host")
:log info ("Update No-IP DNS: previousIP = $previousIP")
#
# behind nat - get the publòic address using dyndns url http://checkip.dyndns.org
/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 "No-IP DNS: currentIP = $currentIP"
:if ($currentIP != $previousIP) do={
:log info "No-IP: Current IP $currentIP is not equal to previous IP, update needed"
:set previousIP $currentIP
:local url "http://dynupdate.no-ip.com/nic/update\3 ... name=$host"
:log info "No-IP DNS: Sending update for $host"
/tool fetch url=$url user=$username password=$password mode=http dst-path=("no-ip_ddns_update.txt")
:log info "No-IP DNS: Host $host updated on No-IP with IP $currentIP"
}
else={
:log info "No-IP: update not needed "
}
# end
# Set needed variables
:local username "DYNDNS SITE LOGIN"
:local password "DYNDNS SITE PASSWORD"
:local hostname "HOST NAME"
:global dyndnsForce
:global previousIP
# print some debug info
:log info ("UpdateDynDNS: username = $username")
:log info ("UpdateDynDNS: password = $password")
:log info ("UpdateDynDNS: hostname = $hostname")
:log info ("UpdateDynDNS: 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"
:delay 1
: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 "UpdateDynDNS: currentIP = $currentIP"
# Remove the # on next line to force an update every single time - useful for debugging,
# but you could end up getting blacklisted by DynDNS!
#:set dyndnsForce true
# Determine if dyndns update is needed
# more dyndns updater request details http://www.dyndns.com/developers/specs/syntax.html
:if (($currentIP != $previousIP) || ($dyndnsForce = true)) do={
:set dyndnsForce false
:set previousIP $currentIP
:log info "$currentIP or $previousIP"
/tool fetch user=$username password=$password mode=http address="members.dyndns.org" \
src-path="nic/update?system=dyndns&hostname=$hostname&myip=$currentIP&wildcard=no" \
dst-path="/dyndns.txt"
:delay 1
:local result [/file get dyndns.txt contents]
:log info ("UpdateDynDNS: Dyndns update needed")
:log info ("UpdateDynDNS: Dyndns Update Result: ".$result)
:put ("Dyndns Update Result: ".$result)
} else={
:log info ("UpdateDynDNS: No dyndns update needed")
}