Page 1 of 1

NO-IP Script Problem

Posted: Fri Feb 24, 2012 9:32 am
by mistry7
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

Re: NO-IP Script Problem

Posted: Sat Feb 25, 2012 11:52 am
by mistry7
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

Re: NO-IP Script Problem

Posted: Mon Mar 05, 2012 11:22 am
by donmirko
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.

Re: NO-IP Script Problem

Posted: Wed Apr 11, 2012 3:55 pm
by dimdjd
2 mistry7:

Thank you for posting the script, for me is very useful and timely.

Re: NO-IP Script Problem

Posted: Wed Jul 03, 2013 2:19 pm
by saintofinternet
excellent script.... :) God Bless You!!!!

any idea how to schedule it to run every 30 mins??

Re: NO-IP Script Problem

Posted: Sat Aug 24, 2013 8:04 am
by saintofinternet
scheduler was the answer.... great...now next hurdle...

this script cannot work behind NAT....

how can we achieve that??