I wanted to use DNS for a personal project and went down the Dynamic DNS rabbit hole. I settled on hosting a DNS zone in Cloudflare and using ddclient to keep a record updated.
I found some info online for using ddclient with Cloudflare, but it took some hacking to get everything working.
- Cloudflare deprecated the API that ddclient originally used.
- The version of ddclient in the ubuntu focal repo (3.8.3) still uses Cloudflare's deprecated API. To get the latest version, you have to install ddclient from Github.
- Have a Cloudflare account and DNS zone
- Create the DNS record ddclient should manage
- Create a Cloudflare API token. Use the 'Edit Zone DNS' template. For 'Zone Resources' select 'All zones' (ref)
- Clone this repo
- Update the following in ddclient.conf.
- password=
- zone=
- RECORD_TO_UPDATE
- Start the ddclient container.
docker-compose up -d
Check ddlient's logs for SUCCESS messages.
docker-compose logs -f ddclient
should yield:
SUCCESS: $record -- Updated Successfully to $ip
- To enable verbose logging, in ddclient.conf set
verbose=yes
then rundocker-compose restart ddclient
to restart the container. - To execute commands from the project's troubleshooting docs, open a shell in the container by running
docker-compose exec ddclient bash