Mikrotik Dyndns update IP address

:global ddnsuser “dyndnsuser”
:global ddnspass “dyndnspass”
:global ddnshost “mycam.dvrdns.org”
:global theinterface strongvpn-germany

:global ipddns [:resolve $ddnshost];
:global ipfresh [ /ip address get [/ip address find interface=$theinterface ] address ]
:if ([ :typeof $ipfresh ] = nil ) do={
:log info (“DynDNS: No ip address on $theinterface .”)
} else={
:for i from=( [:len $ipfresh] – 1) to=0 do={
:if ( [:pick $ipfresh $i] = “/”) do={
:set ipfresh [:pick $ipfresh 0 $i];

:if ($ipddns != $ipfresh) do={
:log info (“DynDNS: IP-DynDNS = $ipddns”)
:log info (“DynDNS: IP-Fresh = $ipfresh”)
:log info “DynDNS: Update IP needed, Sending UPDATE…!”
:global str “/nic/update\?hostname=$ddnshost&myip=$ipfresh&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG”
/tool fetch address=members.dyndns.org src-path=$str mode=http user=$ddnsuser \
password=$ddnspass dst-path=(“/DynDNS.”.$ddnshost)
:delay 1
:global str [/file find name=”DynDNS.$ddnshost”];
/file remove $str
:global ipddns $ipfresh
:log info “DynDNS: IP updated to $ipfresh!”
} else={
:log info “DynDNS: dont need changes”;

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s