×
Dustin Lennon

Dustin Lennon

Applied Scientist

2648A NW 57th St
Seattle, WA 98107
(206) 291-8893

Namecheap, Dynamic IP Addresses, and Hosting Multiple Sites

namecheap ddclient dynamic ip address multiple sites

This work was originally published as an Inferentialist blog post.

Introduction

Introduction

Last week, I went looking for a solution to the following problem: I have a single Linux server with a dynamically assigned IP address and I want to host several sites on this server. My registrar is Namecheap.com , and their advice is to use a Linux tool called ddclient.

Unfortunately, namecheap.com’s example doesn’t cover multiple hosts. A Google search pointed me to thornelabs.net , where the author describes a patch that can be applied to ddclient. Ddclient is written in Perl, so patching is a possibility, but one that feels a bit unsatisfactory.

Ddclient: The Post-execution Hook

Ddclient: The Post-execution Hook

Digging into the Perl script, I discovered that it provides a post-execution hook. This suggests a non-patch strategy: simply chain subsequent ddclient calls.

Here’s my base ddclient.conf file:

ddpost

ddpost

ddpost is the following python script, to be edited for your particular use case.

This will dynamically update four sites. inferentialist.com is handled by the initial call to ddclient. blog.inferentialist.com, api.inferentialist.com, and dlennon.org are updated via the ddpost script.

Note that each site specified in this pipeline should have a corresponding “A” record on namecheap.com. Moreover, subdomains should use the same password as “@” (e.g. root) domains.

The python script also pushes event records to /var/log/syslog.