I've been using CloudFlare for quite a while now and generally found that it is a good service, even the free plans — my sites load faster for people around the world, especially since I host most of my content in New Zealand which has a high latency to practically everywhere.

I host a couple of local off-site backup servers connected using consumer-level internet connections, and the IP address occasionally changes. Fortunately, CloudFlare provides a comprehensive client API for accessing and updating DNS records. I was previously using ddclient, but found that it wasn't easy to get it working with CloudFlare 1 .

So, using the incredibly easy CloudFlare Ruby bindings, I created the CloudFlare DNS Update gem which can be used to update a DNS records.

To set up the tool to perform dyndns-like updates, make sure you have a recent version of Ruby (2.0+ is ideal), then install the cloudflare-dns-update gem:

$ gem install cloudflare-dns-update Successfully installed cloudflare-dns-update Parsing documentation for cloudflare-dns-update 1 gem installed

Then, you need to grab your CloudFlare email address and API key from the CloudFlare My Account page and setup the configuration:

$ cloudflare-dns-update -c home.example.com.yml This configuration file appears to be new, we require some details. CloudFlare Key: 8afbe6dea02407989af4dd4c97bb6e25 CloudFlare Email: sample@example.com What zone do you want to modify? e.g. 'oriontransfer.co.nz' DNS Zone: example.com Getting list of domains for example.com... Finished. (0) direct.example.com A 0.0.0.0 (1) home.example.com A 0.0.0.0 (2) example.com A 0.0.0.0 (3) test.example.com A 0.0.0.0 (4) yay.example.com CNAME direct.example.com. Which record to update? 1 What command to get content for record? e.g. 'curl ipinfo.io/ip' Command to get latest IP address: curl ipinfo.io/ip

Once you've done this much, everything is saved and you can just run the command directly to update the remote record in CloudFlare's DNS servers.

Further Reading