Last updated on July 9, 2022

If you have a domain and you are running your servers from home the IP-address will change from time to time, this is called dynamic DNS. In this guide you will learn how to automatically let a Raspberry Pi running Ubuntu server keep your IP-address up to date so that your domain names always are working.

Start by installing ddclient.

sudo apt install ddclient

Next step is to edit the config file.

sudo nano /etc/ddclient/ddclient.conf

To set the number of seconds between updates add the following line. 600 seconds is 10 minutes. You can change the number of seconds based on the recommendations of your domain name provider.

daemon=600

To use secure SSL connections, add the following line.

ssl=yes

Depending on which domain name provider you use, the configuration file will be a little different. Here are two examples, one for Cloudflare and one for Namecheap.

## Cloudflare
##
protocol=cloudflare
use=web
login=your-login
password=your-password
zone=your-domain.com
your-domain.com
subdomain.your-domain.com
zone=your-second-domain.net
your-second-domain.net
zone=your-third-domain.org
your-third-domain.org
## Namecheap
use=web, web=dynamicdns.park-your-domain.com/getip
protocol=namecheap
server=dynamicdns.park-your-domain.com
login=your-domain.com
password='your-password'
subdomain

To test that the configuration are correct and working, run the ddclient manually with the following command

sudo ddclient -daemon=0 -debug -verbose -noquiet

You should see lines at the end saying SUCCESS, which means it’s working.

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 the config. To verify it’s running, run

sudo service ddclient status