Electronox Blog Electronox Photo Gallery Electronox Forum
updates
most recent blog posts
most recent comments
most recent forum posts

Update multiple domains with Namecheap and ddclient August 18th, 2012 by Justin

 

ddclient is a dynamic DNS client for multiple services, however Namecheap support is lacking in that multiple domain names are not handled correctly. If you are running into problems, here is a guide to fixing ddclient, tested on Debian, so that all your hosted domains are updated.

Note: this has been taken and modified from http://robertianhawdon.me.uk/2010/09/03/making-ddclient-work-with-multiple-domains-on-namecheap/

Copy the DDClient binary to the directory you’re working in:

$ sudo cp /usr/sbin/ddclient .

Open your copy of ddclient

$ sudo nano ddclient

Find this code section at line 3376 in the nic_namecheap_update section:

 my $url;
 $url = "http://$config{$h}{'server'}/update";
 $url .= "?host=$h";
 $url .= "&domain=$config{$h}{'login'}";
 $url .= "&password=$config{$h}{'password'}";
 $url .= "&ip=";
 $url .= $ip if $ip;

And change it to:

 my $url;
 $url = "http://$config{$h}{'server'}/update";
 my $domain = $config{$h}{'login'};
 my $host = $h;
 $host =~ s/(.*)\.$domain(.*)/$1$2/;
 $url .= "?host=$host";
 $url .= "&domain=$domain";
 $url .= "&password=$config{$h}{'password'}";
 $url .= "&ip=";
 $url .= $ip if $ip;

Write the changes and save.

Copy modified ddclient back:

$ sudo cp ddclient /usr/sbin/ddclient

For good measure, delete the ddclient cache (may be in different location):

$ sudo rm /var/cache/ddclient.cache

Edit your /etc/ddclient.conf file to include the top-level domain name with every subdomain. For example, if your domain name is example.com you would change your sub-domain line from:

@, www, subdomain

to

@.example.com, www.example.com, subdomain.example.com

An example for two domains would look like this:

protocol=namecheap
use=web, web=checkip.dyndns.com, web-skip='IP Address'
server=dynamicdns.park-your-domain.com
login=electronox.net
password='password'
@.electronox.net,www.electronox.net,pix.electronox.net,forum.electronox.net,forums.electronox.net
protocol=namecheap
use=web, web=checkip.dyndns.com, web-skip='IP Address'
server=dynamicdns.park-your-domain.com
login=website2.org
password='password'
@.website2.org,www.jryder.org

Now you can restart ddclient:

$ sudo /etc/init.d/ddclient restart

DDClient should now be patched and able to work with multiple namecheap domains.

This process will need to be done every time DDClient is updated on your system, unless, of course, the patch has been merged in a later version of ddclient (last updated Nov 2011).

So, you can block ddclient updates with these few lines:

$ sudo echo "ddclient hold" | sudo dpkg --set-selections

And:

$ sudo aptitude hold ddclient

 

No Comments »

No comments yet.

Leave a comment

updates
most recent blog posts
most recent comments
most recent forum posts