How to use Cloudflare for Dynamic DNS on Ubuntu 22.04

From: jacobjangles.com/free-dd…
Good too: github.com/mcblum/ddclie…

Prepare

  • Create the subdomain in Cloudflare, and set to DNS only. Unless you are hosting a website at that subdomain.
  • Grab your Global API found under “My profile –> API tokens”
  • On the server install ddclient.
sudo apt install ddclient libdata-validate-ip-perl

Grab the latest version (No longer needed in 22.04)

wget https://github.com/ddclient/ddclient/archive/v3.9.1.tar.gz
tar -xf v3.9.1.tar.gz
sudo cp ddclient-3.9.1/ddclient /usr/sbin/ddclient
rm -rf v3.9.1.tar.gz ddclient-3.9.1/
sudo mkdir /etc/ddclient
sudo mv /etc/ddclient.conf /etc/ddclient/

Configuration

sudo nano -w /etc/ddclient/ddclient.conf

# Configuration file for ddclient generated by debconf
#
# /etc/ddclient.conf
# Configuration file for ddclient

##
## Global Config
##
daemon=500
ssl=yes

##
## sub.domain.tld - Cloudflare ## Update Me
##
protocol=cloudflare
use=web
[email protected] ## Update Me with cloudflare login email
password=abcredactedxyz ## Update Me with cloudflare Global API found under "My profile --> API tokens"
zone=domain.tld ## Update Me with the domain
sub.domain.tld ## Update Me with the subdomain

To test:

sudo ddclient -query
sudo ddclient -daemon=0 -verbose -noquiet
sudo service ddclient status

1 thought on “How to use Cloudflare for Dynamic DNS on Ubuntu 22.04

  • Your guide is extremely helpful and helped me solve an issue I had – thank you very much for taking the time to document this.
    Just wanted to let you know of one errata:
    Typo – under configuration your directory for ddclient.conf has an extra ddconf string in it.
    States: sudo nano -w /etc/ddclient/ddclient.conf
    Should be: sudo nano -w /etc/ddclient.conf

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.