Community discussions

 
mistry7
Forum Guru
Forum Guru
Topic Author
Posts: 1244
Joined: Tue Oct 13, 2009 11:57 am
Location: Germany

NO-IP Script Problem

Fri Feb 24, 2012 9:32 am

Hi,

I´m searching for an solution,
I´m using this script, i removed section with defined Variables and my data:
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# END OF USER DEFINED CONFIGURATION
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# Define Global Variables
:global ddnssystem ("mt-" . [/system package get system version] )

:global ddnsip
:global ddnslastip
:if ([ :typeof $ddnslastip;] = "nil" ) do={ :set ddnslastip "0" }

:global ddnsprovname
:global str
:global ddnsprovaddress
:if ($ddnsprovider="NOIP") do={
  :set ddnsprovname "NoIP"
  :set str "/nic/update?hostname=$ddnshost&myip=$ddnsip"
  :set ddnsprovaddress "dynupdate.no-ip.com"
} 
if ($ddnsprovider="DYNDNS") do={
  :set ddnsprovname "DynDNS"
  :set str "/nic/update?hostname=$ddnshost&myip=$ddnsip&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG"
  :set ddnsprovaddress "members.dyndns.org"
}
if ($ddnsprovider="EVERYDNS") do={
  :set ddnsprovname "EveryDNS"
  :set str "/index.php?ver=0.1&ip=$ddnsip&domain=$ddnshost"
  :set ddnsprovaddress "dyn.everydns.net"
}


# Grab the current IP address on that interface.
:global ddnsip2 [/ip address get [/ip address find interface=$ddnsinterface ] address];
:set ddnsip [:pick $ddnsip2 0 [:find $ddnsip2 "/"]];

# Did we get an IP address to compare?
:if ([ :typeof $ddnsip;] = "nil" ) do={
   :log info ("NoIP: No ip address present on " . $ddnsinterface . ", please check.")
} else={
  :if ($ddnsip != $ddnslastip) do={
        :log info "$ddnsprovname: Sending UPDATE! $ddnsip"                               ---->> I See this Info in log with right IP address (I added the variable to see them)
         /tool fetch address=$ddnsprovaddress src-path=$str mode=http user=$ddnsuser password=$ddnspass dst-path=("/DDNS-".$ddnsprovname.".".$ddnshost)
  }
  :delay 1
  :set str [/file find name="DDNS-$ddnsprovname.$ddnshost"];
  /file remove $str
  :set ddnslastip $ddnsip
}

#:log info "DDNS Update script executed successfully."

But it don't updates my IP at NO-IP.com
what can i do to figure out the problem?


mistry7
Last edited by mistry7 on Sat Feb 25, 2012 11:53 am, edited 1 time in total.
 
mistry7
Forum Guru
Forum Guru
Topic Author
Posts: 1244
Joined: Tue Oct 13, 2009 11:57 am
Location: Germany

Re: NO-IP Script Problem

Sat Feb 25, 2012 11:52 am

nobody helps me, but i able to help myself...

found this script, working perfect...
# Set needed variables
:global username "your-username"
:global password "your-password"
:global hostname "your-hostname"
:global wanInt "your-Interface"
:global noipForce
:global previousIP2

# print some debug info 
#:log info ("DDNS: username = $username")
#:log info ("DDNS: password = $password")
:log info ("DDNS: hostname = $hostname")
:log info ("DDNS: previousIP = $previousIP2")


# Grab the current IP address on that interface.
:global ddnsip [/ip address get [/ip address find interface="$wanInt"] address]
:global currentIP [:pick $ddnsip 0 [:find $ddnsip "/"]]

#:log info ("DDNS: ddnsip = $ddnsip")
:log info ("DDNS: 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 No-IP!
#:set noipForce true

# Determine if no-ip update is needed
# more no-ip updater request details available at http://www.no-ip.com/integrate/request/
:if (($currentIP != $previousIP2) || ($noipForce = true)) do={
    :set noipForce false
    :set previousIP2 $currentIP
    :log info ("DDNS: No-IP update needed")
    :log info ("DDNS: Start of Fetch")
global tmp [/tool fetch mode=http port=80 address=dynupdate.no-ip.com host=dynupdate.no-ip.com src-path="/nic/update?hostname=$hostname&myip=$currentIP" user=$username password=$password dst-path="/noip2.txt"]
    :log info ("DDNS: End of Fetch")
    :global result [/file get noip2.txt contents]
    :log info ("DDNS: No-IP Update Result: $result")
    :put ("No-IP Update Result: $result")
# Update HE.net Tunnel
#   :execute script=HE-NET
} else={
    :log info ("DDNS: No No-IP update needed")
}

mistry7
 
donmirko
just joined
Posts: 18
Joined: Tue Oct 06, 2009 3:02 pm

Re: NO-IP Script Problem

Mon Mar 05, 2012 11:22 am

I'm trying to find/create script for updating ddns service no-ip.org from RB750 (OS 5.7). My Internet router doesn't support ddns so I must do it with MT.

All scripts I can find involve getting real IP from my interface, but I need to get the current IP address from the internet (case of double-NAT).

So, can somebody please help with this.
As the philosopher Jagger once said, "You can't always get what you want"
----- Ambition is the last refuge of failure -----
 
dimdjd
just joined
Posts: 3
Joined: Wed Jan 11, 2012 5:11 pm

Re: NO-IP Script Problem

Wed Apr 11, 2012 3:55 pm

2 mistry7:

Thank you for posting the script, for me is very useful and timely.
 
User avatar
saintofinternet
Forum Veteran
Forum Veteran
Posts: 757
Joined: Thu Oct 15, 2009 3:52 am

Re: NO-IP Script Problem

Wed Jul 03, 2013 2:19 pm

excellent script.... :) God Bless You!!!!

any idea how to schedule it to run every 30 mins??
by professionals, for professionals....
Don't forget to give KARMA!!!
 
User avatar
saintofinternet
Forum Veteran
Forum Veteran
Posts: 757
Joined: Thu Oct 15, 2009 3:52 am

Re: NO-IP Script Problem

Sat Aug 24, 2013 8:04 am

scheduler was the answer.... great...now next hurdle...

this script cannot work behind NAT....

how can we achieve that??
by professionals, for professionals....
Don't forget to give KARMA!!!

Who is online

Users browsing this forum: No registered users and 11 guests