Shell scripts and instructions to update Gandi DNS record
56bfb71d — georgr 8 months ago
013646a1 — georgr 8 months ago
f3bfc178 — georgr 8 months ago


browse log



You can also use your local clone with git send-email.

DDNS updates for domains on Edgerouter X

The Edgerouter X ddnsclient does not support the API. To update the ip of the A record of your domain on this script gets your current external IP, checks if it matches the configured IP on the A record of your domain and if not it updates the A record to your current external IP. The script also works if you are behind a NATed internet connection because it gets the current ip form an external service.

  • Create an A record for your subdomain (e.g. on gandi. Choose any IP (e.g. to fill the required ip field.
  • Generate an API key for the gandi api under<your_username>/security
  • Log via ssh into your edgerouter: ssh ubnt@
  • Get root: sudo su
  • Create bash script in the user space of your edgerouter: vi /config/user-data/
  • Copy the content of into the file and save it
  • Make the script executable: chmod a+x /config/user-data/
  • Test your script: sh /config/user-data/ YOUR_API_KEY
  • If it works you´ll see something like {"message": "DNS Record Created"}
  • You can now check on the gandi web interface if your current external IP matches the A record ip of your subdomain.
  • If your current ip matches the configured A record ip, there is no script output, to test ist you can configure any other ip on the A record on the gandi web interface.
  • Set a cronjob to run the script every minute and check if your external ip got updated: (crontab -l ; echo "* * * * * /config/user-data/ YOUR_API_KEY") | crontab -