Dynamic DNS Using Gandi
Dynamic DNS is a way to associate a changing Dynamic IP address (usually residential xDSL connections) to a static domain name (DNS record)
This allows you to connect to home.example.com -> DNS Lookup & Resolution -> 203.0.113.78. The DNS entry for home.example.com is updated automatically at set intervals or when an IP address change is detected.
Dynamic DNS Providers
There are a number of Dynamic DNS providers that can be used, a well known provider is https://dyn.com/, but unfortunately some of these services come with a cost.
Gandi Live DNS
LiveDNS is Gandi’s upcoming DNS platform, a completely new service that offers its own API and its own nameservers.
The new platform offers powerful features to manage DNS Zone templates that you can integrate into your own workflow. Features include bulk record management, association with multiple domains, versioning and rollback.
The below instructions will show you how to create a Dynamic DNS system using a single script and Gandi’s LiveDNS.
Make sure you have the following applications installed:
- curl - https://curl.haxx.se/
- jq - https://stedolan.github.io/jq/
- Gandi LiveDNS API Key - Retrieve your API Key from the “Security” section in the Account Admin Panel
Create a bash script and put it under “/usr/local/bin/dyndns_update.sh”. (This can of course be kept wherever you want)
Add the API key you got from the Gandi Account Panel.
Run The Script
I would set this script to run via crontab every 30 minutes. This ensures with an IP change the Dynamic DNS would only be out of date for a maximum of 30 minutes.
Edit crontab with the following command
[root@server ~]# crontab -e
Add the following lines to run the script every 30 minutes.
*/30 * * * * /bin/bash /usr/local/bin/dyndns_update.sh
Once the script runs it should update the dynamic.example.com dns entry with the external IP that was found by the script.