Home

Awesome

cloudflare-ddns

This is a continued version of thatjpk's cloudflare-ddns.

Introduction

A script for dynamically updating Cloudflare DNS records. If you have a dynamic IP and you're hosting servers behind it, it's an easy way to make it 'pseudo-static'.

Dependencies

You'll need a Python interpreter and the following libraries:

You can install them with pip: pip install -r requirements.txt

Features

Usage

First, a few assumptions:

To use this utility, create a copy of the example.com.yml file inside the zones folder and rename it to your zone name. To do a one-off update of your DNS record, simply run python cloudflare-ddns.py -z example.com from your terminal. The script will determine your public IP address and automatically update the records along with it and the settings you provided.

If the program encounters an issue while attempting to update Cloudflare's records, you can check the the logs folder for more informations.

Because dynamic IPs can change regularly, it's recommended that you run this utility periodically in the background to keep your records up-to-date.

Just add a line to your crontab and let cron run it for you at a regular interval.

# Every 30 minutes, update my Cloudflare records.
*/30 * * * * python /path/to/cloudflare-ddns.py -z example.com

This example will update your records every 30 minutes. You'll want to be sure that you insert the correct paths to reflect where the codebase is located.

If you want to learn more about the Cloudflare API, you can read on here.

Credits and Thanks