How to use Cloudflare for Dynamic DNS on Ubuntu 22.04

Good too:…


  • 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)

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/


sudo nano -w /etc/ddclient.conf

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

## Global Config

## sub.domain.tld - Cloudflare ## Update Me
[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

2 thoughts 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

  • For others who struggled with this in ubuntu 22 and didn’t want to use the Global API key and wanted to use API Tokens, the issue is ddclient must be version 3.10 not 3.9. I installed ubuntu 23 which has the needed version.

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.