Setting Up DDClient With CloudFlare on Ubuntu 14.04 LTS

In this guide, we will walk through the steps to install and configure DDClient on Ubuntu 14.04 LTS to work with CloudFlare. DDClient is a dynamic DNS update client that allows you to automatically update your DNS records on CloudFlare when your IP address changes. This can be useful if you are hosting a server on a dynamic IP address.

Prerequisites

Before you begin, make sure you have the following:

  1. A domain registered on CloudFlare, e.g., mycomputer.example.com.
  2. Access to your CloudFlare account.
  3. A Ubuntu 14.04 LTS server.

Step 1: Create a Domain Entry on CloudFlare

  1. Log in to your CloudFlare account.
  2. Create a domain entry for your dynamic DNS, e.g., mycomputer.example.com. Note down your CloudFlare login email and API key; you will need these later.

Step 2: Install Required Dependencies

Open a terminal on your Ubuntu server and install the necessary Perl modules:

1
2
sudo apt-get update
sudo apt-get install perl libjson-any-perl libio-socket-ssl-perl

Step 3: Download DDClient Files

Download the latest DDClient files from the official project on SourceForge:

1
wget http://downloads.sourceforge.net/project/ddclient/ddclient/ddclient-3.8.2/ddclient-3.8.2.tar.gz

Step 4: Extract DDClient Files

Extract the downloaded DDClient files:

1
2
tar -xzf ddclient-3.8.2.tar.gz
cd ddclient-3.8.2

Step 5: Apply the CloudFlare Patch

Download the CloudFlare patch file:

1
wget http://blog.peter-r.co.uk/uploads/ddclient-3.8.0-cloudflare-22-6-2014.patch

Apply the patch:

1
patch < ddclient-3.8.0-cloudflare-22-6-2014.patch

Step 6: Manual Installation

Create necessary directories and copy files:

1
2
3
4
5
sudo mkdir /etc/ddclient
sudo mkdir /var/cache/ddclient
sudo cp ddclient /usr/sbin/
sudo cp sample-etc_ddclient.conf /etc/ddclient/ddclient.conf
sudo cp sample-etc_rc.d_init.d_ddclient.ubuntu /etc/init.d/ddclient

Step 7: Edit DDClient Configuration

Edit the DDClient configuration file to match the following settings:

1
sudo vi /etc/ddclient/ddclient.conf

Or:

1
sudo vi /etc/ddclient.conf

Ensure your configuration file looks like this (make special note of where commas are placed):

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
daemon=300
syslog=yes
mail=root
mail-failure=root
pid=/var/run/ddclient.pid
ssl=yes
protocol=cloudflare,
use=web
server=www.cloudflare.com,
zone=example.com,  # Replace with your CloudFlare zone name
login=[email protected],  # Replace with your CloudFlare login email
password=your-api-key-here
mycomputer.example.com,  # Replace with your dynamic DNS hostname

Step 8: Start the DDClient Service

Start the DDClient service:

1
sudo service ddclient start

To check the logs, use the following command:

1
tail /var/log/syslog

Step 9: Set DDClient to Run at Startup

To ensure DDClient runs at startup, remove any existing links and then add DDClient to the startup sequence:

1
2
sudo update-rc.d -f ddclient remove
sudo update-rc.d ddclient defaults

That’s it! You’ve successfully set up DDClient to work with CloudFlare on your Ubuntu 14.04 LTS server. DDClient will now automatically update your DNS records on CloudFlare whenever your IP address changes.

0%