Purchase a domain name for your website or application (if you haven’t already). You will need to make sure you have access to your domain’s DNS settings and that it supports Dynamic DNS. Namecheap, the registrar I use, provides both of these options.
Enable dynamic DNS in your domain’s DNS settings and note the login/password that will be used to update your IP. If you use Namecheap, this can be found in “Advanced DNS” section of your domain.
Make sure to enable the dynamic DNS for your domain. You will need to note the login and password that’s used to update your DDNS (Dynamic DNS password). Namecheap uses your domain name as login. Make sure to note/copy your domain name and the password, you will need them later to configure ddclient.
2. This takes you to the Proxmox Virtual Environment Archive that stores ISO images and official documentation. Select ISO Images to continue.
Install ddclient on your Linux machine. To install on Ubuntu or any Debian-based system, simply run
sudo apt install ddclient
Once installed, a configuration wizard will automatically start. The configuration wizard did not work for me as it does not provide all options in the GUI. To configure ddclient properly, we will have to manually edit configuration files. For now, just enter anything random or leave the fields blank in the wizard when prompted just to complete it. Don’t worry about entering correct values; we will manually configure them in the next step.
Once the wizard completes, it’ll generate two config files (/etc/ddclient.conf and /etc/default/ddclient) with the values you entered. We will now edit those files and enter correct configuration values.
The first config file is located at /etc/ddclient.conf. Edit this file with a text editor of your choice, I use nano:
sudo nano /etc/ddclient.conf
The file will have the settings you provided during the wizard, we will delete them and replace with the following:
# /etc/ddclient.conf
syslog=yes # log the output to syslog
mail=root # send email notifications to root
mail-failure=root # send email when failed
ssl=yes # use ssl when updating IP
use=web, web=dynamicdns.park-your-domain.com/getip # look up external IP from this URL
protocol=namecheap
server=dynamicdns.park-your-domain.com
login=your-domain.com
password=your-ddns-password
@,* # wildcard, to update all subdomains, like a.your-domain.com, b.your-domain.com
The above configuration assumes you’re using Namecheap as your DDNS provider. You will only need to change the login (your domain name) and password (your DDNS password obtained in step 2). If you’re using a provider other than Namecheap, you will also need to change the protocol and server parameters. You will have to obtain the server name from your DDNS provider. For full list of protocols supported by ddclient and examples of how to configure each one, run
ddclient -help
If you only want to run ddclient on demand, you are done. You can run it withsudo ddclient
and it will pull your current external IP and update your DNS server. However, this is pretty useless as you will most likely want it to run in the background and periodically check/update your IP without manual intervention. To do that, you need to configure ddclient to run as daemon by editing the file /etc/default/ddclient.
sudo nano /etc/default/ddclient
Set run_daemon="true"
and set your daemon_interval
to how often you want ddclient to update dynamic DNS (in seconds). Setting it to 300 will make ddclient run every 5 minutes which should be sufficient. You can configure yours to run more (or less) often to your liking.
# /etc/default/ddclient
# Set to "true" if ddclient should be run every time DHCP client ('dhclient'
# from package isc-dhcp-client) updates the systems IP address.
run_dhclient="false"
# Set to "true" if ddclient should be run every time a new ppp connection is
# established. This might be useful, if you are using dial-on-demand.
run_ipup="false"
# Set to "true" if ddclient should run in daemon mode
# If this is changed to true, run_ipup and run_dhclient must be set to false.
run_daemon="true"
# Set the time interval between the updates of the dynamic DNS name in seconds.
# This option only takes effect if the ddclient runs in daemon mode.
daemon_interval="300"
Verify the configuration by running ddclient manually:
sudo ddclient
If everything is configured correctly, you should get this:
SUCCESS: updating @: good: IP address set to 45.123.789.13
If you receive errors, make sure your configuration is correct in both /etc/ddclient.conf and /etc/default/ddclient files. It’s also useful to run ddclient with -debug
or -verbose
option to get more information on the error.
Finally, once you verify ddclient is configured correctly, run ddclient as a service. It may already be running, but you will want to restart it to make sure it loads the updated configuration:
sudo service ddclient restart
The service will run in the background and update your domain’s DNS according to the interval you set in daemon_interval
. To verify it’s running, run
sudo service ddclient status
or run htop
and verify ddclient process is running.
It will also log to syslog anytime it updates the IP and send an email notification to root’s email address.
If at any point you get an error saying something about /var/cache/ddclient/ddclient.cache, simply delete the cache file and restart the ddclient service:
sudo rm /var/cache/ddclient/ddclient.cache
sudo service ddclient restart