Page 1 of 1
dynDNS SCRIPT THAT WORKS
Posted: Wed Feb 10, 2016 2:00 am
by nemke
Hello
Can someone please post script for dynDNS ip update which work.
I used one but after ROS upgrade to 6.30 ver she stop to work. I try many scripts from forum but no luck, nothing work...
My router is 6.34.1 ver, so some script which work, would be vary helpfull. I need script for double NAT (MT is behind ISP router).
Thank you
Re: dynDNS SCRIPT THAT WORKS
Posted: Wed Feb 10, 2016 2:16 pm
by mpreissner
First, try not to double NAT...always causes problems. Either get rid of the ISP router, or put it in bridge mode. Second...here's my script.
:global ddnsuser "username"
:global ddnspass "password"
:global theinterface "name of external interface, i.e. ether-1-gateway"
:global ddnshost1 your.dyndns.hostname
:global ipddns
: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 str1 "/nic/update\?hostname=$ddnshost1&myip=$ipfresh&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG"
/tool fetch address=members.dyndns.org src-path=$str1 mode=http user=$ddnsuser password=$ddnspass dst-path=("/DynDNS.".$ddnshost1)
:delay 1
:global str1 [/file find name="DynDNS.$ddnshost1"];
/file remove $str1
:global ipddns $ipfresh
:log info "DynDNS: IP updated to $ipfresh!"
} else={
:log info "DynDNS: dont need changes";
}
}
Re: dynDNS SCRIPT THAT WORKS
Posted: Sun Feb 14, 2016 1:58 pm
by nkourtzis
First, try not to double NAT...always causes problems. Either get rid of the ISP router, or put it in bridge mode.
Or, if you cannot do any of the above, setup the MT router as a DMZ host on the first router. This will *usually* forward all ports of the ISP router to the respective ports of the MT router.
Re: dynDNS SCRIPT THAT WORKS
Posted: Thu Feb 18, 2016 3:24 pm
by simobeliata
If you are behind NAT, that means your WAN interface has PRIVATE IP address. That causes this complicate scripts to not work, because they depend on address, assigned directly to your port.
You need to update your dynamic hostname with your PUBLIC address.
According to DynDNS guide the syntax of the update "command" is as follows:
http://username:password@members.dyndns.org/nic/update?hostname=yourhostname&myip=ipaddress&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG
"myip" is the parameter, which is responsible to provide actual address. The good part is, that if you skip it, the DynDNS server will guess the address, based on request source address. Thus it will assign your PUBLIC address to your host.
In short the request should be:
http://username:password@members.dyndns.org/nic/update?hostname=yourhostname&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG
Here is a short script:
# Define User Variables
:global ddnsuser "DYNDNSUSER"
:global ddnspass "DYNDNSPASS"
:global ddnshost "DYNDNSHOST"
:log info "DynDNS: Sending UPDATE!"
:local str "/nic/update?hostname=$ddnshost&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)
Re: dynDNS SCRIPT THAT WORKS
Posted: Thu Feb 18, 2016 9:29 pm
by scampbell
For simple DDNS requirements there is the built in DDNS under /ip cloud ? It's free and it works
It's url is
serial_numer.sn.mynetname.net
Re: dynDNS SCRIPT THAT WORKS
Posted: Wed Feb 24, 2016 10:17 am
by mgx
Re: dynDNS SCRIPT THAT WORKS
Posted: Tue Mar 28, 2017 2:01 am
by jo2jo
For simple DDNS requirements there is the built in DDNS under /ip cloud ? It's free and it works
It's url is
serial_numer.sn.mynetname.net
Great solution! i had forgot about this feature that MT added a while back! tks
Re: dynDNS SCRIPT THAT WORKS
Posted: Tue Mar 28, 2017 3:42 pm
by th0massin0
IMHO RouterOS should have native DynDns and NO-IP support. It's not allways possible to get rid of ISP device or use it as a bridge.
Re: dynDNS SCRIPT THAT WORKS
Posted: Tue Mar 28, 2017 3:53 pm
by jarda
It has ip cloud. You can link whatever your dns to it. If you are a fan of such things... I am against so I am using my own scripts that do not rely on fact whether ip cloud works or not...
Re: dynDNS SCRIPT THAT WORKS
Posted: Tue Mar 28, 2017 8:52 pm
by jo2jo
IMHO RouterOS should have native DynDns and NO-IP support. It's not allways possible to get rid of ISP device or use it as a bridge.
RouterOS *DOES* already have a solution to this/your issue- (via winbox) its under IP -> CLOUD (enable ddns) or via the CLI: /IP Cloud Print
Re: dynDNS SCRIPT THAT WORKS
Posted: Tue Apr 04, 2017 2:16 pm
by th0massin0
Could you have a soulution for multi WAN enviorment? Can I choose what WAN interface would be bind to that service?
Re: dynDNS SCRIPT THAT WORKS
Posted: Wed Apr 05, 2017 12:16 am
by scampbell
Could you have a solution for multi WAN enviromment? Can I choose what WAN interface would be bind to that service?
IP Cloud will use the WAN with the smallest distance by default.
If you want to specifically use a different WAN then you would need to use a Mangle Rule on the Output Chain to capture the IP Cloud traffic and give it a route mark that uses the required wan interface.
When enabled '/ip cloud' will send encrypted UDP packets to port 15252 to hosts that resolves from cloud.mikrotik.com.
You could use an address-list entry of cloud.mikrotik.com in a list called Cloud and then
/ip firewall mangle add chain=output protocol=udp dst-port=15252 dst-address-list=Cloud action=mark-routing new-routing-mark=wanx
where "wanx' is a default route using the required wan interface. e.g
/ip route add gateway=pppoe-wan3 routing-mark=wan3
Re: dynDNS SCRIPT THAT WORKS
Posted: Mon Nov 05, 2018 12:45 pm
by camarguesol
Thanks "mpreissner",
Script works perfectly on 6.43.4 and Long Term 6.42.9
Lately we have found that the Mikrotik IP Cloud Update returns "updated" and shows correct current IP, but it does not actually update on the Cloud Server.
A ping from the router or any other device returns the old dynamic IP address.
It is a pity the Cloud DDNS has become so flakey. Using the DynDNS service is getting more expensive each year since the Oracle purchase of the company. It appears they are ratcheting up the price until the proverbial "pip's squeak".
It seems that a "NEW" cloud is arriving.
viewtopic.php?t=135603
With any luck it will resolve these issues
Re: dynDNS SCRIPT THAT WORKS
Posted: Wed Nov 14, 2018 1:45 am
by jmerlos282
Thanks, this script works fine for me
If you are behind NAT, that means your WAN interface has PRIVATE IP address. That causes this complicate scripts to not work, because they depend on address, assigned directly to your port.
You need to update your dynamic hostname with your PUBLIC address.
According to DynDNS guide the syntax of the update "command" is as follows:
http://username:password@members.dyndns.org/nic/update?hostname=yourhostname&myip=ipaddress&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG
"myip" is the parameter, which is responsible to provide actual address. The good part is, that if you skip it, the DynDNS server will guess the address, based on request source address. Thus it will assign your PUBLIC address to your host.
In short the request should be:
http://username:password@members.dyndns.org/nic/update?hostname=yourhostname&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG
Here is a short script:
# Define User Variables
:global ddnsuser "DYNDNSUSER"
:global ddnspass "DYNDNSPASS"
:global ddnshost "DYNDNSHOST"
:log info "DynDNS: Sending UPDATE!"
:local str "/nic/update?hostname=$ddnshost&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)