Updating IP Address in Dynu

Dynu is a free dynamic DNS service. As described in Microsoft Brought Down No-IP.org I have to cope with big business just pushing their own interest and not caring on small business or private customers.

I tried to update IP address for Dynu using ddclient using package ddclient. This failed. The version 2 of Dynu’s API allows to do that with curl/wget.

Steps to set it up:

  1. Go to API Credentials to get your “API-key”
  2. Go to API and authorize using your “API-key”
  3. Run first “GET /dns” to gather your so called “id”. Alternatively, run the below curl command

The curl command to get your “id” is as follows:

curl -X GET "https://api.dynu.com/v2/dns" -H  "accept: application/json" -H  "API-Key: yyyyyyyyyy"

Output is like this:


Once you know your “API-key” and “id” you can set-up a simple script to run periodically. I use a Perl script which first fetches my current internet address, $remoteIP, and then updates Dynu.

open(F,"curl -sX POST \"https://api.dynu.com/v2/dns/XXXXXXXX\" "
        . "-H \"accept: application/json\" "
        . "-H \"API-Key: yyyyyyyyyyyyyyyyyyyyyyyy\" "
        . "-H \"Content-Type: application/json\" "
        . "-d \"{\\\"name\\\":\\\"eklausmeier.mywire.org\\\","
                . "\\\"group\\\":\\\"office\\\","
                . "\\\"ipv4Address\\\":\\\"${remoteIP}\\\","
                . "\\\"ttl\\\":90,\\\"ipv4\\\":true}\" |")
        || die("Cannot curl to dynu.com");
while (<F>) {
close(F) || die("Cannot close dynu.com");

If all goes well then output is: