Automatic DNS entries update.
DDclient is a Perl client used to update dynamic DNS records.
Very useful if not having a static IP from the ISP.
It makes sure that if you reset your router, or have a power outage,
and you get a new public IP assigned, this IP gets automaticly set
in the DNS records for your domains.
This setup runs directly on the host machine.
It works by checking every 10 minutes
checkip.dyndns.org,
and if the IP changed from the previous one, it logs in to the DNS provider and
updates the DNS records.
/etc/
└── ddclient/
└── ddclient.conf
Install ddclient from your linux official repos.
Official ddclient config example here.
This setup assumes the DNS records are managed on Cloudflare.
Make sure all subdomains in the config have A-records.
ddclient.conf
daemon=600
syslog=yes
mail=root
mail-failure=root
pid=/var/run/ddclient.pid
ssl=yes
use=web, web=checkip.dyndns.org/, web-skip='IP Address'
##
## CloudFlare (www.cloudflare.com)
##
protocol=cloudflare, \
zone=example.com, \
ttl=1, \
[email protected], \
password=<global-api-key-goes-here> \
example.com,*.example.com,subdomain.example.com
##
protocol=cloudflare, \
zone=example.org, \
ttl=1, \
[email protected], \
password=<global-api-key-goes-here> \
example.org,*.example.org,whatever.example.org
sudo systemctl enable --now ddclient
If it would timeout on start, check the real location of ddclient.pid
sudo find / -name ddclient.pid
If it is correctly set in the ddclient.conf
.
During host linux packages update.
Using borg that makes daily snapshot of the /etc directory which contains the config file.
Replace the content of the config file with the one from the backup.