This article describes the methods available for programmatically updating dynamic DNS at Cloudflare without relying upon manual changes via the Cloudflare dashboard UI.
Some hosting providers dynamically update their customer's IP addresses. These customers must then update the new origin server IPs in their Cloudflare DNS. Below are several methods for automatically updating dynamic IPs in Cloudflare DNS.
Cloudflare DNS can be updated via the Cloudflare API. For example, a Cloudflare customer can create a script to monitor for IP address changes and then have the script push those changes to the Cloudflare API.
ddclient is a third-party Perl client used to update dynamic DNS entries for accounts on various DNS providers. For details, refer to the ddclient documentation on sourceforge.net.
DNS-O-Matic is a third-party tool that provides a way to announce dynamic IP changes to multiple services. DNS-O-Matic allows a user to pick and choose what Dynamic DNS services to notify about the update and is configurable from a UI. Refer to the documentation for DNS-O-Matic.
Configuration of DNS-O-Matic requires prior knowledge of the following information. Content within <> brackets below must be determined for the particular domain:
- Email: <CLOUDFLARE ACCOUNT EMAIL ADDRESS>
- API Token: <CLOUDFLARE GLOBAL API KEY>
- Domain: <example.com>
- Hostname: dynamic
Email is the email address corresponding to the account used to log in to Cloudflare. If using Cloudflare’s Multi-user account feature, this email address must have sufficient privileges for managing DNS.
To find your API Token the Cloudflare UI:
- Log in to the Cloudflare dashboard.
- Select My Profile from the dropdown located in the top right.
- Under API Keys, click View beside Global API Key.