Skip to content

Instantly share code, notes, and snippets.

@briangordon
Last active Mar 11, 2021
Embed
What would you like to do?
ddclient for Cloudflare DNS / DO

This is a ddclient setup for updating Cloudflare DNS from a DO droplet.

You do get one free floating IP which makes dynamic DNS pointless, but you'll get charged if you want to turn off the droplet. Running ddclient lets you keep using Cloudflare DNS without manually updating your A records.

Debian Buster (current stable) only has ddclient 3.8.3 which has trouble with the v4 Cloudflare API, so we get ddclient from GitHub.

apt install perl libdata-validate-ip-perl libjson-any-perl
tar xzf ddclient-3.9.1.tar.gz
cp ddclient/ddclient /usr/sbin/
nano /etc/ddclient/ddclient.conf
nano /etc/systemd/system/ddclient.service
systemctl enable ddclient
systemctl start ddclient

Note that the included systemd unit configuration doesn't work, I think because systemd tries to remap the default /var/run pidfile path to /run. So I modified the .service file.

daemon=890
ssl=yes
protocol=cloudflare
use=web, web=169.254.169.254/metadata/v1/interfaces/public/0/ipv4/address
login=brian@brian-gordon.name
password='CLOUDFLARE-GLOBAL-API-KEY-GOES-HERE'
zone=brian-gordon.net
ludi.brian-gordon.net
[Unit]
Description=Dynamic DNS Update Client
After=network.target
[Service]
Type=forking
PIDFile=/run/ddclient.pid
ExecStart=/usr/sbin/ddclient -pid /run/ddclient.pid -daemon 890
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment