ddclient
It is important to keep your domain(s) pointing at the right IP address, some ISPs provide dynamic ip address to customers which means occasionally updating your services to keep them working. Cloudflare recomends ddclient to update the DNS record(s), it also supports many other providers so is a good place to start.
Dynamic DNS services supported
List correct at time of writing for ddclient v4.0.0
- 1984.is
- ChangeIP
- Cloudflare
- ClouDNS
- DDNS.fm
- DigitalOcean
- dinahosting
- Directnic
- DonDominio
- DNS Made Easy
- DNSExit
- dnsHome.de
- Domeneshop
- DslReports
- Duck DNS
- DynDNS.com
- EasyDNS
- Enom
- Freedns
- Freemyip
- Gandi
- GoDaddy
- Hurricane Electric
- Infomaniak
- INWX
- Loopia
- Mythic Beasts
- NameCheap
- NearlyFreeSpeech.net
- Njalla
- Noip
- nsupdate - see nsupdate(1) and ddns-confgen(8)
- OVH
- Porkbun
- regfish.de
- Sitelutions
- Yandex
- Zoneedit
Setup
Get an API Token from Cloudflare
- Click “Create Token”
- Use the “Edit zone DNS” template
- Set two permissions with “Zone” “DNS” “Read” and “Zone” “DNS” “Edit”
- Set Zone Resources to “Include” “All zones from an account” “<YOUR ACCOUNT>”
- Client IP Address Filtering and TTL can be left blank
- Continue to summary
- Create Token
- Copy the token into a notepad and test that it works from the system that will be updating the DNS using the provided script
Installation
Most package managers have a version that will install under the name ddclient
however it many versions are not up to date and some come under a slightly
different name. It is therefore best to install by cloning the repo and running
the commands listed to make and install the package yourself.
More info on step 3 below
Configuration
Using your favourite editor open /etc/ddclient/ddclient.conf It will be full
of templates for all of the supported services, this can all be deleted as we
are focusing on Cloudflare.
## Use encryption (TLS) when the scheme (either "http://" or "https://") is
## missing from a URL. Defaults to "yes".
ssl=yes
daemon=300 # check every 300 seconds
syslog=yes # log update msgs to syslog
mail=root # mail all msgs to root
mail-failure=root # mail failed update msgs to root
# mail-from=root # set the email "From:" header to "root". If
# unset (the default) or empty, the from address
# depends on your system's default behavior.
pid=/var/run/ddclient.pid # record PID in file.
# postscript=script # run script after updating. The new IP is
# added as argument.
use=web, web=api.ipify.org # Obtain an IP address from Web status page
#
# Cloudflare (www.cloudflare.com)
#
protocol=cloudflare, \
zone=mostdiv.co.uk, \
ttl=1, \
login=token, \ # Only needed if you are using your global API key. If you are using an API token, set it to "token" (without double quotes).
password=<API Token> \ # This is either your global API key, or an API token. If you are using an API token, it must have the permissions "Zone - DNS - Edit" and "Zone - Zone - Read". The Zone resources must be "Include - All zones".
mostdiv.co.uk, www.mostdiv.co.uk <Other subdomains here>
protocol=cloudflare, \
zone=mostdiv.uk, \
ttl=1, \
login=token, \
password=<API Token> \ # This is either your global API key, or an API token. If you are using an API token, it must have the permissions "Zone - DNS - Edit" and "Zone - Zone - Read". The Zone resources must be "Include - All zones".
mostdiv.uk, www.mostdiv.uk <Other subdomains here>