Dynamic DNS Updates on FreeDNS from RouterOS

written on Saturday, July 23, 2016 by


FreeDNS ( offers free DNS hosting for up to 5 subdomains. You can set up a domain like and point it to any IP you want.

I wanted to set up Dynamic DNS updates, so that a certain subdomain would always point to my (potentially changing) home IP. The setup on FreeDNS is quite simple:

  1. Add a new subdomain (Type A) on
  2. Go to
  3. Select your subdomain and enable Dynamic DNS

Next to your subdomain, a sync URL is automatically generated. It looks like this:<random-token>/. If you request that URL with an HTTP client, the IP will automatically be updated:

$ curl<random-token>/
Updated from 46.38.XX.XX to 213.144.XX.XX

Note that the URL displayed in the FreeDNS web interface is using the insecure http:// protocol by default, you should change that to https:// instead.

Setup on Mikrotik RouterOS

Configuring your Mikrotik router to periodically update the IP is also very simple using the following one-line script:

/system script
    add comment="Update DynamicDNS on" name=dyndns-afraid \
    source="/tool fetch url=\"<random-token>/\""

Finally, schedule this script to be executed every 5 minutes:

/system scheduler
    add disabled=no start-time=startup interval=5m name=dyndns-afraid \
    on-event="/system script run dyndns-afraid"

(Small sidenote: The RouterOS "fetch" command does not verify the validity of the HTTPS certificate by default. You should probably add the root certificate used by the host to your certificate store and add the check-certificate=yes option to the fetch command.)

This entry was tagged dns, network, routeros and sysadmin