Community discussions

MikroTik App
 
komy14
just joined
Topic Author
Posts: 1
Joined: Sun Jul 07, 2024 4:49 pm

no-ip not update

Sun Jul 07, 2024 5:00 pm

I use this script for 2 years<It's work well,But I found some problem,

I found that for many days the router did not update the script. I checked the settings and they were fine. Tried creating a new script, but it still doesn't update.

I tried to get the real IP. Followed by the port you want to enter, you can enter normally. But if you enter from ddns you will not be able to enter.

Please help check if I have set anything incorrectly or if the script has been changed from the website.

I user mikrotik model Rb4011 V6.45

# No-IP automatic Dynamic DNS update

#--------------- Change Values in this section to match your setup ------------------

# No-IP User account info
:local noipuser "user"
:local noippass "password"

# Set the hostname or label of network to be updated.
# Hostnames with spaces are unsupported. Replace the value in the quotations below with your host names.
# To specify multiple hosts, separate them with commas.
:local noiphost "XXXX.ddns.net"

# Change to the name of interface that gets the dynamic IP address
:local inetinterface "pppoe-out2"

#------------------------------------------------------------------------------------
# No more changes need

:if ([/interface get $inetinterface value-name=running]) do={
# Get the current IP on the interface
  :local currentIP [/ip address get [find interface="$inetinterface" disabled=no] address]

# Strip the net mask off the IP address
  :for i from=( [:len $currentIP] - 1) to=0 do={
     :if ( [:pick $currentIP $i] = "/") do={ 
        :set currentIP [:pick $currentIP 0 $i]
     } 
  }

# The update URL. Note the "\3F" is hex for question mark (?). Required since ? is a special character in commands.
  :local url "http://dynupdate.no-ip.com/nic/update\3Fmyip=$currentIP"
  :local noiphostarray
  :set noiphostarray [:toarray $noiphost]
  
  :foreach host in=$noiphostarray do={
    # Check 1 - resolved IP
    :local resolvedIP [:resolve $host];

    # Check 2 - Saved response from NO-IP
    :local filename ("no-ip_ddns_update-" . $host . ".txt")
    :local savedMatch -1
    :local savedIP "No File";

    if ( [:len [/file find name=$filename]] > 0 ) do={
      :set savedIP [/file get $filename contents]
      :set savedMatch [:find $savedIP $currentIP -1]
    }

    # If either check fails, update IP	
    :if (($currentIP = $resolvedIP) && ($savedMatch >= 0)) do={
      :log info "No-IP: Host $host already on No-IP with IP $resolvedIP"
    } else={
      :log info "No-IP: Sending update for $host - $resolvedIP saved as $savedIP"
      /tool fetch url=($url . "&hostname=$host") user=$noipuser password=$noippass mode=http dst-path=$filename
      :log info "No-IP: Host $host updated on No-IP with IP $currentIP"
    }
  }
} else={
  :log info "No-IP: $inetinterface is not currently running, so therefore will not update."
}

Thank you so much
Last edited by tangent on Sun Jul 07, 2024 5:12 pm, edited 1 time in total.
Reason: Changed "quote" tags to "code"
 
User avatar
rafie
just joined
Posts: 3
Joined: Wed Jun 20, 2018 1:00 am

Re: no-ip not update

Sun Dec 22, 2024 9:03 pm

Hello same here, since i upgraded routerOS to 7.16.2
Any advice please?

Regards,
Rafie
 
optio
Forum Veteran
Forum Veteran
Posts: 948
Joined: Mon Dec 26, 2022 2:57 pm

Re: no-ip not update

Sun Dec 22, 2024 9:37 pm

I'm using similar script without issues to refresh IP on No-IP, but in my script URL has https scheme, also mode=http param is not needed for fetch in this case.

Try over Terminal if works:
/tool fetch url="https://dynupdate.no-ip.com/nic/update?myip=<PUBLIC_IP_ADDRRESS>&hostname=<NOIP_HOST>" user=<NOIP_USERNAME> password=<NOIP_PASSWORD> output=user
If request was successful response should be:
      status: finished
  downloaded: 0KiB
    duration: 0s
        data: good <PUBLIC_IP_ADDRRESS>
and then try to adjust in script what I written above: :local url "https://..." and remove mode=http for /tool fetch command.

If there are other issues be more specific what is not working, like is there some script error, request is failing, wrong public IP is set to No-IP, etc...

Who is online

Users browsing this forum: No registered users and 9 guests