ddclient is a very useful tool for most of us who run servers, or any kind of service, from home with a dynamic IP address. ddclient is capable of working with many dynamic dns providers, but I found that documentation was lacking for using with Namecheap DNS which is who I use. So here's a short little guide for installing and setting up ddclient to automatically update your dynamic dns address for a domain hosted with Namecheap, specifically with a sub-domain.
Let's Get Started!
1.) installation:
yum -y install epel-release && yum -y update # Install EPEL repository, and update
yum -y install ddclient # Install ddclient from EPEL
2.) configure ddclient:
mv /etc/ddclient.conf /etc/ddclient.conf.orig # Backup default config
vi /etc/ddclient.conf
---
################
### ddclient.conf
### namecheap
##################
daemon=300 # Time, in seconds, to check for IP change and to send update
ssl=yes # Whether to use ssl to send update; you want this
use=web, web=checkip.dyndns.com/, web-skip='IP Address' # Leave these settings as is
protocol=namecheap # This tells ddclient that we are using namecheap
server=dynamicdns.park-your-domain.com # Server name for namecheap's dynmic dns service; do not modify
login=deviantengineer.com # Your root domain name that you want to update dynamic dns on
password=randomstringofcharacters # This is your dynamic dns password, provided by namecheap
photoalbum # OPTIONALLY, set a HOST value if you want to apply this to a sub-domain
---
So this is really all it takes to make ddclient work with Namecheap. A few of these settings were ambiguous when I was first setting up ddclient, and I had a lot of trial and error, which lead me to throwing this blog together.
Most important here is login
, password
, and the HOST value below that (if used). login
is where you set the root of your domain. For me and this blog, I would use deviantengineer.com
and nothing else. In this scenario, I am wanting to set ddclient to update my IP for photoalbum.deviantengineer.com
, but I still only want to list the base domain in this login
field.
The password
field comes from namecheap. In your dns settings area of a domain, under the DYNAMIC DNS
section, you will find the Dynamic DNS Password
. Put that password on this key.
Lastly is the optional sub-domain field. This was something I struggled with finding, but finally figured out. Since ddclient already knows about deviantengineer.com
, all I need to set here is photoalbum
in order to have dynamic dns update the photoalbum.deviantengineer.com
(no, this is not a real sub-domain of mine; made up for this blog only). If you are setting dynamic dns on the base domain, delete this line in ddclient.conf
.
4.) cleanup:
systemctl enable ddclient.service
systemctl restart ddclient.service
And that's it. Pretty straightforward and simple, but surprisingly difficult to find clear and concise documentation. Now if you are using this with a different dynamic dns provider, I'm afraid I can't help with that. I exclusively use Namecheap so that were my experience and knowledge ends.
Enjoy!