Community discussions

MUM Europe 2020
 
Sigma721
Member Candidate
Member Candidate
Topic Author
Posts: 109
Joined: Sat Nov 19, 2011 5:47 pm

No-Ip and Dyndns

Sun May 19, 2013 9:50 pm

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")
}
 
User avatar
gabak
Frequent Visitor
Frequent Visitor
Posts: 61
Joined: Fri Sep 01, 2006 7:10 am

Re: No-Ip and Dyndns

Mon Jul 01, 2013 12:33 am

 
Sigma721
Member Candidate
Member Candidate
Topic Author
Posts: 109
Joined: Sat Nov 19, 2011 5:47 pm

Re: No-Ip and Dyndns

Tue Oct 22, 2013 12:00 am

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
 
nikolasc
just joined
Posts: 11
Joined: Wed Jun 04, 2008 10:30 am

Re: No-Ip and Dyndns

Tue Oct 22, 2013 1:10 pm

Try this
}
else={
edit to
} else={
 
Sigma721
Member Candidate
Member Candidate
Topic Author
Posts: 109
Joined: Sat Nov 19, 2011 5:47 pm

Re: No-Ip and Dyndns

Tue Oct 22, 2013 5:28 pm

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?
 
rviteri
Frequent Visitor
Frequent Visitor
Posts: 84
Joined: Fri Nov 18, 2011 5:53 pm

Re: No-Ip and Dyndns

Wed Oct 23, 2013 6:42 am

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]
 
Sigma721
Member Candidate
Member Candidate
Topic Author
Posts: 109
Joined: Sat Nov 19, 2011 5:47 pm

Re: No-Ip and Dyndns

Fri Nov 15, 2013 9:38 pm

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?

Who is online

Users browsing this forum: No registered users and 16 guests