https://developers.cloudflare.com/dns/manage-dns-records/how-to/managing-dynamic-ip-addresses/
Assuming you have a clean raspberry pi installation, you will need to install:
sudo apt install autoconf
Clone their repo and follow their instructions, in this step, the best is to follow their latest instructions:
https://github.com/ddclient/ddclient
Go to https://dash.cloudflare.com/profile/api-tokens and click:
- [API Tokens]
- [Create Token]
- Edit Zone DNS -> [Use Template]
- Select if you want the token to control a specific zone or have edit access to all your zones
- [Continue to summary]
- [Create Token]
After we have installed ddclient, we must now adjust its configuration file. The path of the file is:
/etc/ddclient/ddclient.conf
Search for the word "Cloudflare" and edit that section as follows:
##
## CloudFlare (www.cloudflare.com)
##
protocol=cloudflare, \
zone=___DOMAIN___, \
ttl=1, \
login=token, \
use=web, \
web=https://cloudflare.com/cdn-cgi/trace, \
web-skip="ip=", \
password=___CLOUDFLARE_TOKEN_GOES_HERE___ \
__SUBDOMAIN__.___DOMAIN___
Check if your configuration is working properly by executing:
ddclient -daemon=0 -debug -verbose -noquiet
Note that this will try to Update your DNS record, so the record must already exist, else it will not create it for you.