useful dynamic DNS Script

Hi ,

As I know a guy who develops a DYNDNS free alternative, I asked him to make it’s software available for Mikrotik.

Here are the results, please comment :

http://www.techtorials.ro/2013/04/19/duia-custom-url-mikrotik/

If you need translation, google is your friend.

Nice tutorial. But I did all the things and RB still didn’t update dynDNS. When I manualy create an URL - everythings work fine.
Is it possible to make tracing of mikrotik’s script while it runnig?

what i see in my logs is that you’re using v4 only and your script is running every 5 minutes. nothing wrong here !

did you correctly define your variables (don’t forget the quotes “..”) ?
https://www.duia.ro/account/custom_url.html

Define User Variables

:global duiauser “”
:global duiapassmd5 “”
:global duiahost “”

what errors do you see in mikrotik logs ?
also, please pay attention to quotes (" .. ") when you copy - paste the code.

I’m sorry. Everything works.
I can’t connect to my router from outside, but I think it’s because of my ISP.
Thanks for your help.

here’s a full example of a dynamic DNS script that i use with my http://www.duia.ro free DNS account.

script for IPv4 address update:

Define User Variables # put your own credentials here, this is just an example !

find your own details here: https://www.duia.ro/account/account_info.html

:global duiapassmd5 “22dcrwdfe4cadasd07c4fae3dc5a13” # replace with your own MD5 pass
:global duiahost “david.duia.us” # replace with your own hostname
:global duiaForce false

Define Global Variables

:global currentIP;

:log info “DynDNS: $currentIP”

:tool fetch url=“http://ipv4.duia.ro” dst-path=“/duia.checkip.html”
:delay 1
:local result [/file get duia.checkip.html contents]

parse the current IPv4 result

:local resultLen [:len $result]
:local endLoc [:find $result “\n” -1]
:local newIP [:pick $result 0 $endLoc]
:file remove duia.checkip.html

:if (($newIP != $currentIP) || ($duiaForce = true)) do={
:set duiaForce false
:put “ip address $currentIP changed to $newIP”;
:set currentIP $newIP;
:log info “DynDNS update: $newIP”
:tool fetch
url=“https://www.duia.ro/dynamic.duia?host=$duiahost&password=$duiapassmd5&ip4=$newIP
}


script for IPv6 address update:

Define User Variables # put your own credentials here, this is just an example !

find your own details here: https://www.duia.ro/account/account_info.html

:global duiapassmd5 “22dcrwdfe4cadasd07c4fae3dc5a13” # replace with your own MD5 pass
:global duiahost “david.duia.us” # replace with your own hostname
:global duiaForce false

Define Global Variables

:global currentIP;

:log info “DynDNS: $currentIP”

:tool fetch url=“http://ipv6.duia.ro” dst-path=“/duia.checkip.html”
:delay 1
:local result [/file get duia.checkip.html contents]

parse the current IPv6 result

:local resultLen [:len $result]
:local endLoc [:find $result “\n” -1]
:local newIP [:pick $result 0 $endLoc]
:file remove duia.checkip.html

:if (($newIP != $currentIP) || ($duiaForce = true)) do={
:set duiaForce false
:put “ip address $currentIP changed to $newIP”;
:set currentIP $newIP;
:log info “DynDNS update: $newIP”
:tool fetch
url=“https://www.duia.ro/dynamic.duia?host=$duiahost&password=$duiapassmd5&ip6=$newIP
}

then go to System → Scripts and PASTE the code for IPv4 or IPv6 address update.
at the end go to System → Scheduler and add this script to run every 5 minute.

v4/v6 versions of mtk script that works with https://www.duiadns.net but can be adapted for any other dynamic dns provider that gives you the ‘url update’.
https://github.com/duiadns/download/tree/master/console/mikrotik
https://www.duiadns.net/download-mikrotik