Community discussions

MikroTik App
 
stonie2oo4
newbie
Topic Author
Posts: 32
Joined: Fri Jan 30, 2015 10:15 am
Location: Germany

Dynamic DNS Update Script works no longer

Wed Jan 08, 2020 4:12 pm

Hi,

I have a puplic IP address from my ISP.
For external access over vpn I have a Domain with Dynamic DNS Update Function.

Sorry for my bad english, I hope its understandable :?

When I bought my Mikrotik Router a few years ago, I set up the following script that worked fine:
:global actualIP value=[/ip address get [find where interface=pppoe-out1] value-name=address];
:global actualIP value=[:pick $actualIP -1 [:find $actualIP "/" -1] ];
:if ([:len [/file find where name=ipstore.txt]] < 1 ) do={
 /file print file=ipstore.txt where name=ipstore.txt;
 /delay delay-time=2;
 /file set ipstore.txt contents="0.0.0.0";
};
:global previousIP value=[/file get [find where name=ipstore.txt ] value-name=contents];
:if ($previousIP != $actualIP) do={
 :log info message=("Try to Update DNS with actual IP ".$actualIP." -  Previous IP are ".$previousIP);
 /tool fetch mode=https keep-result=yes dst-path=dns-result.txt address=[:resolve dyndns.regfish.de] port=443 host=dyndns.regfish.de src-path=("/?fqdn=mydomain.eu.&forcehost=1&authtype=secure&token=myaccesstoken=".$actualIP);
 /delay delay-time=5;
 :global lastChange value=[/file get [find where name=dns-result.txt ] value-name=contents];
 :global previousIP value=$actualIP;
 /file set ipstore.txt contents=$actualIP;
 :if ($lastChange = "OK") do={:log warning message=("DNS update successfull with IP ".$actualIP);};
 :if ($lastChange = "KO") do={:log error message=("Fail to update DNS with new IP ".$actualIP);};
};
Now the script doesn't work anymore. The script should, in my understanding write a file "ipstore.txt" with the actual IP. But this doesn't work.
I don't know if there was any change in RouterOS. My system is up to Date with 6.46.1. But I think I have read anything, but I doesn't find it anymore.

Does anyone have an idea what could be the problem with this script?
 
Volans
newbie
Posts: 25
Joined: Fri Oct 18, 2013 3:27 pm

Re: Dynamic DNS Update Script works no longer

Mon Feb 01, 2021 6:12 pm

I guess Regfish updated their update URL/parameter. This script works without issues:
:global actualIP value=[/ip address get [find where interface=pppoe_interface] value-name=address];
:global actualIP value=[:pick $actualIP -1 [:find $actualIP "/" -1] ];
:if ([:len [/file find where name=ipstore.txt]] < 1 ) do={
 /file print file=ipstore.txt where name=ipstore.txt;
 /delay delay-time=2;
 /file set ipstore.txt contents="0.0.0.0";
};
:global previousIP value=[/file get [find where name=ipstore.txt ] value-name=contents];
:if ($previousIP != $actualIP) do={
 :log info message=("Try to Update DNS with actual IP ".$actualIP." -  Previous IP are ".$previousIP);
 /tool fetch mode=https keep-result=yes dst-path=dns-result.txt address=[:resolve dyndns.regfish.de] port=443 host=dyndns.regfish.de src-path=("/?fqdn=mydomain.net.&forcehost=1&token=421421412412421421&ipv4=".$actualIP);
 /delay delay-time=5;
 :global lastChange value=[/file get [find where name=dns-result.txt ] value-name=contents];
 :global previousIP value=$actualIP;
 /file set ipstore.txt contents=$actualIP;
 :if ($lastChange = "OK") do={:log warning message=("DNS update successfull with IP ".$actualIP);};
 :if ($lastChange = "KO") do={:log error message=("Fail to update DNS with new IP ".$actualIP);};
};
Source: https://www.regfish.de/domains/dyndns/dokumentation

Who is online

Users browsing this forum: Bing [Bot] and 25 guests