I have a MikroTik router (RouterOS v4.x) with an ADSL connection at work, unfortunately it comes with dynamic public IP address. I need to connect to my office workstation or simply the MikroTik router from home or elsewhere but I need to know its latest IP address all the time, so I decided to use ZoneEdit’s Dynamic DNS service.
Add a new script to the MikroTik router (replace those in bold):
- /system script add name=zoneedit-dyndns source=”/tool fetch url=\”http://dynamic.zoneedit.com/auth/dynamic.html\?host=dyndns.example.com&dnsto=127.0.0.1\” user=ZEUser password=ZEPass keep-result=no\r\n/delay 30\r\n/tool fetch url=\”http://dynamic.zoneedit.com/auth/dynamic.html\?host=dyndns.example.com\” user=ZEUser password=ZEPass keep-result=no” policy=read
Test the script by running it manually:
- /system script run zoneedit-dyndns
If it shows 2 lines of “status: finished”, then the script works properly.
Schedule the script to run regularly (in this case, every 10 minutes):
- /system scheduler add name=”zoneedit-dyndns” interval=10m on-event=”/system script run zoneedit-dyndns” policy=read,test
Why does it require 2 “fetch” commands to update? I think there is a bug in ZoneEdit’s Dynamic DNS updater, so it needs to be forced. The new dynamic DNS change entry has to be significantly different from the previous dynamic DNS entry before the ZoneEdit backend would really update it.
6 thoughts on “MikroTik simple script to update ZoneEdit Dynamic DNS”
“I think there is a bug in ZoneEdit’s Dynamic DNS updater, so it needs to be forced. The new dynamic DNS change entry has to be significantly different from the previous dynamic DNS entry before the ZoneEdit backend would really update it.”
This isn’t the case. The new IP will be accepted and stored regardless of the previous setting. The primary restriction on use of the dynamic update URL is frequency of update. Your IP should only be updated if it actually changes or, at most, once per hour. The double setting above could be more a problem than a “fix”.
Really? My Linux server at home also runs a script that checks its current IP address and sends an update ONLY if it has changed (the IP address change was so rare, I didn’t notice that the script had failed me for quite sometime until a few weeks ago), but it was also showing the same problem. The reply I got was a success code of 201 “No records need updating” when the IP address HAD changed, but ZoneEdit server didn’t do any update until I force-changed it using the dnsto parameter.
I will try and update the MikroTik script to be smarter and send update only when its IP address has changed.
For me that script is not working … Does you have some update ? zoneedit is made changes to their system …
Although this works almost perfectly with ADSL PPPoE connections, only a few times I found my domain pointing to “127.0.0.1” instead of the Real IP, on a cable modem DHCP Client connection type it simply won’t work, most times it just won’t change the last IP, and more then often when I ping my domain it returns “127.0.0.1”.
Any development on the script? New changes or a new script altogether that would work for other connection types?
They could have fixed it by now. Maybe you can drop the first “/tool fetch url=\”http://dynamic.zoneedit.com/auth/dynamic.html\?host=dyndns.example.com&dnsto=127.0.0.1\” user=ZEUser password=ZEPass keep-result=no\r\n/delay 30\r\n” part.