Page 1 of 1

Chateau LTE12 cant update ddns using changeip script. error: connection timeout

Posted: Mon May 10, 2021 5:04 pm
by nachannon
Hi Here is my script im using for changeip DDNS using OS version mt-7.1beta4. the script works fine until it reaches line :log info [ :put [/tool dns-update name=$ddnshost address=[:pick $ddnsip 0 [:find $ddnsip "/"] ] key-name=$ddnsuser key=$ddnspass dns-server=$changeipsvr zone="nic.changeip.com" ] ]
if I remove dns-server=$changeipsvr zone="nic.changeip.com" I get missing parameters error when I enter these values I get script error: connection timeout
the original script works fine on os version 6.4 with out using dns-server=$changeipsvr zone="nic.changeip.com" but in version 7.1 without these values the script fails
I also added a static DNS entry for nic.changeip.com which is 170.178.190.178 at this point I think I have dns-server value wrong or zone wrong any help would be appreciated

Here is my script im using
:global ddnsuser "username"
:global ddnspass "password"
:global ddnshost "mydomain.changeip.com"
:global ddnsinterface "lte1"
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# END OF USER DEFINED CONFIGURATION
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:global ddnssystem ("mt-" . [/system package get [/system package find name=routeros] version] )
:global ddnsip [ /ip address get [/ip address find interface=$ddnsinterface] address ]
:global ddnslastip


:if ([:len [/interface find name=$ddnsinterface]] = 0 ) do={ :log info "DDNS: No interface named $ddnsinterface, please check configuration." }

:if ([ :typeof $ddnslastip ] = "nothing" ) do={ :global ddnslastip 0.0.0.0/0 }


:if ([ :typeof $ddnsip ] = "nothing" ) do={

:log info ("DDNS: No ip address present on " . $ddnsinterface . ", please check.")

} else={
 :if ($ddnsip != $ddnslastip) do={

    :log info "DDNS: Sending UPDATE!"
    :global changeipsvr [:put [:resolve nic.changeip.com]]
    :log info $"changeipsvr"
    # PROBLEM is here times out #
    :log info [ :put [/tool dns-update name=$ddnshost address=[:pick $ddnsip 0 [:find $ddnsip "/"] ] key-name=$ddnsuser key=$ddnspass dns-server=$changeipsvr zone="nic.changeip.com" ] ]

  :log info ("DDNS Updated")
   :global ddnslastip $ddnsip
 
  } else={ 
    :log info "DDNS: No changes necessary."
  }
}

Re: Chateau LTE12 cant update ddns using changeip script. error: connection timeout

Posted: Mon Jan 17, 2022 10:07 pm
by seventhsky
Hello!
Well, better late than never. Maybe it's not help you but help somebody else.

I had the same issue with DDNS on changeip.com after updating to RouterOS 7.1.1 from 6.x

I found two variants of solving problem.
First you can switch to using native ddns (/ip cloud).
Second switch to using "/tool fetch" instead of "/tool dns-update" for updating your record on changeip.com

For example my script:
:local interfacename "interfacename";
:local ddns "example.ChangeIP.com";
:local login "login";
:local password "password";
:local url "https://nic.ChangeIP.com/nic/update";

:local CurrentDynDNSIP [/resolve $ddns];
:local TMPDynDNSIP [/ip address get [/ip address find interface=$interfacename] address];
:local RealDynDNSIP [:pick $TMPDynDNSIP 0 ([:len $TMPDynDNSIP]-3)];
:if ($CurrentDynDNSIP!=$RealDynDNSIP) do={
/tool fetch url=($url . "?ip=$RealDynDNSIP&hostname=$ddns") mode=https user=$login password=$password http-method=post output=none;
/log info "Host $ddns updated on changeip.com with IP $RealDynDNSIP";
}

Re: Chateau LTE12 cant update ddns using changeip script. error: connection timeout

Posted: Fri Feb 16, 2024 10:02 pm
by zhangfeilaile123
Successfully tested on 7.12, changeip User Agent now displays Mikrotik/7.x Fetch. Thank you very much!