gandi-dynamic-dns/README.md

34 lines
1.3 KiB
Markdown
Raw Normal View History

2020-02-27 13:48:28 +00:00
# Gandi Dynamic DNS
Cron job to auto update a DNS record when WAN IP changes using Gandi Live DNS API on Debian GNU/Linux
## To install
```
git clone https://gitlab.com/lab.8916100448256/gandi-dynamic-dns.git ./gandi-dynamic-dns
cd ./gandi-dynamic-dns
sudo bash ./install.sh
```
Then configure DNS record info and API key in file /etc/live-dns/live-dns.conf
## How it works
### /etc/cron.d/live-dns-update
Cron job definition to check for WAN IP change and call Live DNS API to update the DNS record if necessary. By default runs the check/update script 2 times per hour, at every hour past 12 and 42 minutes.
### /etc/live-dns/live-dns.conf
Configuration file for the check/update script
Needs to contains 3 environment variable definitions
+ DOMAIN="domain.tld" : Replace domain.tld with your domain name
+ RECORD="host" : Replace host with the sub domain you want to update when WAN IP changes
+ APIKEY="Your-API-Key" : Replace with you API key generated on the Gandi web interface.
Check this page if you don't know your APIKey : https://docs.gandi.net/en/domain_names/advanced_users/api.html
2020-02-27 13:48:28 +00:00
### /usr/local/bin/live-dns-update.sh
2020-02-29 18:20:14 +00:00
This is the script that is called by the cron job.
2020-02-27 13:48:28 +00:00
This script is based on the sample provided on Gandi GitHub : [mywanip.sh](https://github.com/Gandi/api-examples/blob/master/bash/livedns/mywanip.sh)
2020-02-23 22:12:44 +00:00