https://www.dynu.com/DynamicDNS/IPUpdateClient/Mikrotik-Dynamic-DNS
Trying to get this script working with my hAP AC2. All the info is filled in properly, I have tested on my openwrt. When I use winbox and paste it in the script box, then hit run, nothing happens. When I check the logs, there still absolutely nothing. I have tried telnetting in and running the script but it doesn’t paste properly. I suppose I could try from web interface terminal?
elico
May 13, 2021, 12:10pm
2
Do you still need help with this?
Got it working by adding MikroTiks built in cloud hostname to the cname DNS record on dynu. Also had to disable the a record
Sela69
February 1, 2022, 8:23pm
4
https://www.dynu.com/DynamicDNS/IPUpdateClient/Mikrotik-Dynamic-DNS
Trying to get this script working with my hAP AC2. All the info is filled in properly, I have tested on my openwrt. When I use winbox and paste it in the script box, then hit run, nothing happens. When I check the logs, there still absolutely nothing. I have tried telnetting in and running the script but it doesn’t paste properly. I suppose I could try from web interface terminal?
Hi , is there anyone able to run this script provided by dynu ? I’m on 7.1.1 stable and even if I run the script apparently nothing happens. No logs so I’m guessing that is not running …
mozerd
February 1, 2022, 8:53pm
5
I use dynu and the following script works in RoS 7.xxx
I have identified the following parameters that you must change to your data by using search and replace ,
When you do the search and replace make sure to not copy the “blank spaces at the beginning or end of each term”
owner=XXXXXXXXXX [your Tik admin account name]
ddnsuser "idIDidIDid" [your dynu account name]
ddnspass "pwdpwdpwdpwdpwdpwd" [your dynu account passwors]
theinterface "ether#" [Yout Tik WAN interface usually ether1]
ddnshost "nnnnnnnnn.myddns.sssss" [your Dynu host name you chose]
/system script add dont-require-permissions=no name=Dynu owner=XXXXXXXXXX policy=read,write,policy,test source=“:global ddnsuser "idIDidIDid"
\n:global ddnspass "pwdpwdpwdpwdpwdpwd"
\n:global theinterface "ether#"
\n:global ddnshost "nnnnnnnnn.myddns.sssss"
\n:global ipddns [:resolve $ddnshost];
\n:global ipfresh [ /ip address get [/ip address find interface=$theinterface ] address ]
\n:if ([ :typeof $ipfresh ] = nil ) do={
\n:log info ("DynuDDNS: No IP address on $theinterface .")
\n} else={
\n:for i from=( [:len $ipfresh] - 1) to=0 do={
\n:if ( [:pick $ipfresh $i] = "/") do={
\n:set ipfresh [:pick $ipfresh 0 $i];
\n}
\n}
\n:if ($ipddns != $ipfresh) do={
\n:log info ("DynuDDNS: IP-Dynu = $ipddns")
\n:log info ("DynuDDNS: IP-Fresh = $ipfresh")
\n:log info "DynuDDNS: Update IP needed, Sending UPDATE…!"
\n:global str "/nic/update?hostname=$ddnshost&myip=$ipfresh"
\n/tool fetch address=api.dynu.com src-path=$str mode=http user=$ddnsuser password=$ddnspass dst-path=("/Dynu.".$ddnshost)
\n:delay 1
\n:global str [/file find name="Dynu.$ddnshost"];
\n/file remove $str
\n:global ipddns $ipfresh
\n:log info "DynuDDNS: IP updated to $ipfresh!"
\n} else={
\n:log info "DynuDDNS: does not need changes";
\n} }
\n\r
\n”
Sela69
February 1, 2022, 9:16pm
6
Hi, first of all thank you for answering me,
It does work (or at least it seems to me !)
Shahid
October 8, 2022, 10:12pm
7
Latest Updated Script Working on Mikrotik v 7.5
/tool fetch mode=http url="http://api.ipify.org" src-path="" dst-path=/dyn.html
:local currentIP [/file get dyn.html contents]
:log warning "Public IP Detected $currentIP"
######################################################
:global ddnsuser "username"
:global ddnspass "password"
:global ddnshost "host.mywire.org"
:global ipddns [:resolve $ddnshost];
:log warning "Current DNS $ipddns"
/file/remove dyn.html
:if ($ipddns != $currentIP) do={
:log warning ("Updating IP = $currentIP")
:global str "/nic/update?username=$ddnsuser&password=$ddnspass&hostname=$ddnshost&myip=$currentIP"
/tool fetch address=api.dynu.com src-path=$str mode=https dst-path=("/Dynu.".$ddnshost)
:delay 1
:global str [/file find name="Dynu.$ddnshost"];
/file remove $str
:global ipddns $currentIP
:log info "DynuDDNS: IP updated to $currentIP!"
} else={
:log info "No Need to change, IP Already Updated";
} }
Better do some cleaning up on that mess, including removing the useless logging…
http://forum.mikrotik.com/t/dynu-com-script-for-dynamic-dns/104448/11
Shahid
October 9, 2022, 6:49am
9
Logging is very helpful for newbies. It helps a lot to understand what is going on.
Is rigth, but excessive logging, after the script works, do the opposite..
Query on security:
Could someone explain to me please, why it is safe to send username and password as GET parameters?
?username=$ddnsuser&password=$ddnspass&hostname=$ddnshost&myip=$currentIP
Many thanks,
Roberts
optio
June 17, 2023, 1:16pm
12
Could someone explain to me please, why it is safe to send username and password as GET parameters?
?username=$ddnsuser&password=$ddnspass&hostname=$ddnshost&myip=$currentIP
Because there is no difference when sending as URL parameters or POST/PUT body, both can be read if you intercept traffic. GET request is more convinant since you don’t need to create body which complicates creating HTTP request, depending which HTTP client is used and system. Safety concern regarding GET request is when URL logging, history, analytics… is involved, like browser history, it is better to avoid performing such requests with credentials in URL directly in browser without private mode or you will need to manually clear history.
Query on security:
Could someone explain to me please, why it is safe to send username and password as GET parameters?
?username=$ddnsuser&password=$ddnspass&hostname=$ddnshost&myip=$currentIP
Many thanks,
Roberts
Since the mode is httpS, it is impossible to detect the URL on both GET and POST.
Thanks Optio and Rextended,
If I understand correctly, then the router makes a https request and as long the line for connection to api says so, it is safe
/tool fetch address=api.dynu.com src-path=$str mode=https dst-path=("/Dynu.".$ddnshost)
The $str variable contains the sensitive information, but because mode is https, we are safe from network monitoring.
I think what confused me was someone in a script above wrote:
\n/tool fetch address=api.dynu.com src-path=\$str mode=http user=\$ddnsuser password=\$ddnspass dst-path=(\"/Dynu.\".\$ddnshost)\
and I thought - what if the api server (for performance reasons) only accepts http connections.
Thanks again,
Roberts