, 1 min read
Updating IP Address in Dynu
Original post is here eklausmeier.goip.de/blog/2019/07-06-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:
- Go to API Credentials to get your "API-key"
- Go to API and authorize using your "API-key"
- 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:
{"statusCode":200,"domains":[{"id":12345678,"name":"eklausmeier.mywire.org","unicodeName":"eklausmeier.mywire.org","token":"aaaaaaaaa","state":"Complete","location":"office","group":"office","ipv4Address":"109.90.226.205","ipv6Address":null,"ttl":90,"ipv4":true,"ipv6":false,"ipv4WildcardAlias":false,"ipv6WildcardAlias":false,"createdOn":"2019-05-25T08:37:16","updatedOn":"2019-06-29T12:33:04.707"}]}%
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>) {
print;
}
close(F) || die("Cannot close dynu.com");
If all goes well then output is:
{"statusCode":200}