NO-IP Script Problem

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

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

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.

2 mistry7:

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

excellent script… :slight_smile: God Bless You!!!

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

scheduler was the answer… great…now next hurdle…

this script cannot work behind NAT…

how can we achieve that??