MikroTik simple script to update ZoneEdit Dynamic DNS

22 04 2010

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.

Thanks, ZoneEdit!


Actions

Informations

6 responses to “MikroTik simple script to update ZoneEdit Dynamic DNS”

23 04 2010
zeguy (23:22:24) :

“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”.

24 04 2010
Andryan (11:25:12) :

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.

24 11 2011
Damir (18:25:26) :

For me that script is not working … Does you have some update ? zoneedit is made changes to their system …

23 01 2012
Aaron Scheiner (21:20:12) :

Thanks!

19 08 2012
Coizado (04:02:58) :

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?

Thanks.

23 08 2012
Andryan (16:54:46) :

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.

Leave a comment

You can use these tags : <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>