How to set up ddclient with no-ip ddns in a FreeBSD (FreeNAS jail) or Ubuntu Server

So it’s been a couple of months since my last post so to kick things off I thought that I would share this little gem that I discovered while surfing the net.

In previous tutorials, I have covered using the no-ip client to get a FQDN (fully qualified domain name) pointing to your server. In this tutorial we will do the same thing but this time we will use ddclient.

Get your network card details

Before you start, take the time out to get your network card name from the server, or from the iocage jail. This can be achieved by running the following command:

ifconfig

You should see something like epair0b or eth0. Take a note of the name as it will be required during the setup.

Download the ddclient

To download ddclient for FreeBSD, simply enter the following:

 pkg install ddclient  

If you are installing on Ubuntu server, then enter the following:

sudo apt-get install ddclient

Manually configure the ddclient

If you are installing on Ubuntu server, there is a GUI which will prompt you for your network details. If, you wish to change the configuration at a later date you can run the following:

sudo nano /etc/ddclient.conf

You can use the template below as a guide.

protocol=dyndns2
ssl-yes
use=web, web=checkip.dyndns.com/, web-skip='Current IP Address: '
server=www.no-ip.com
login=yourusername
password=yourpassword
yourhostname.no-ip.org

Save the settings with CTRL & X followed by Y and then restart the service with:

sudo /etc/init.d/ddclient restart

FreeBSD Configuration

The configuration for FreeBSD is slightly different, first, run the following:

sudo nano /usr/local/etc/ddclient.config

You will now see a list of configuration scripts that can be uncommented and used depending on your ddns host. If you are using no-ip then just use the following config script and paste it at the bottom of the file.

protocol=dyndns2
ssl-yes
use=web, web=checkip.dyndns.com/, web-skip='Current IP Address: '
server=www.no-ip.com
login=yourusername
password=yourpassword
yourhostname.no-ip.org 

Save the file with CTRL & X followed by Y. Now start ddclient with:

sudo sysrc ddclient_enable="YES"

If you want to force the client to check for DNS changes on a daily basis then run the following:

sysrc daily_ddclient_force_enable="YES"

Don’t forget to set up port forwarding on your router, but that is essentially it. This method feels a bit cleaner than running the no-ip dynamic updater as you do not have to compile it and better still, this can be used on both Linux and FreeBSD systems.