Page 1 of 1

No-Ip and Dyndns

Posted: Sun May 19, 2013 9:50 pm
by Sigma721
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")
}

Re: No-Ip and Dyndns

Posted: Mon Jul 01, 2013 12:33 am
by gabak

Re: No-Ip and Dyndns

Posted: Tue Oct 22, 2013 12:00 am
by Sigma721
Yes I have tried this, but it returns the LAN address for Eth1(connected to an ADSL modem, which is doing the PPPOE connection).

Anyone managed to sort out the NO IP script? MY DynDns works without any issues

Re: No-Ip and Dyndns

Posted: Tue Oct 22, 2013 1:10 pm
by nikolasc
Try this
}
else={
edit to
} else={

Re: No-Ip and Dyndns

Posted: Tue Oct 22, 2013 5:28 pm
by Sigma721
Try this
}
else={
edit to
} else={

Thank you, but my log just shows this now and the host name is not being updated:

Update No-Ip DNS : username = myusername
Update No-Ip DNS : hostname = myhostname
Update No-Ip DNS : previousIP = the current ip of the RB

Any thoughts?

Re: No-Ip and Dyndns

Posted: Wed Oct 23, 2013 6:42 am
by rviteri
Hi try this script, this one works behind a NAT. Just modify the lines where you need to update to No-IP DNS

# Set needed variables
:local username "xxx"
:local password "xxx"
:local hostname "xxx.dyndns.info"

: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")
}


This is the part that gets your IP address, afterwards you need to parse it.
# 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]

Re: No-Ip and Dyndns

Posted: Fri Nov 15, 2013 9:38 pm
by Sigma721
Hi try this script, this one works behind a NAT. Just modify the lines where you need to update to No-IP DNS

# Set needed variables
:local username "xxx"
:local password "xxx"
:local hostname "xxx.dyndns.info"

: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")
}


This is the part that gets your IP address, afterwards you need to parse it.
# 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]
Thank you but how do I change this to work with No Ip?