Skip to main content

Configuring cloudflare as DDNS with ddclient

Step 1: Install ddclient

sudo apt install ddclient

Step 2: get Cloudflare API key

Go to https://dash.cloudflare.com/profile/api-tokens and click 'Create Token'

Next to 'Edit Zone DNS' template click 'Use Template'

On the next page leave everything as default but set Zone Resources to Include > All zones from an account > 'your account name'

Click 'continue to summary' to get API key

 

Step 3: Edit ddclient.conf

Where ddclient was installed open ddclient.conf

sudo nano /etc/ddclient.conf

add the following details

# ddclient.conf
#

use=web, web=ipify-ipv4 \
protocol=cloudflare, \
zone=yourdomain.com, \
ttl=1, \
login=token, \
password=cloudflareapikey \
vpn.yourdomain.com

Step 4: Add as service

From console run

sudo nano /etc/default/ddclient

Ensure the following lines are present:

run_daemon="true"
daemon_interval="300"

Then from console run

sudo systemctl start ddclient.service
sudo update-rc.d ddclient enable

Note: second line is to ensure the service runs after restart

 

 

Sources:

https://www.reddit.com/r/SelfHosting/comments/16wnu3s/ddclient_and_cloudflare_dynamic_dns/