Dynamic DNS on Ubuntu 16.04

With these settings I can plug my RPi into a router and it will configure a web URL to it’s routers IP address.
EDIT: updated for Ubuntu 18.04

I’m using Namecheap so I simply combine this with this..
and it works! 🙂

From here,

sudo apt-get install ddclient

For NameCheap the onscreen installer ui is redundant, after it finishes just manually edit the config files

sudo nano "/etc/ddclient.conf"

Edit this file as here.
Test with the following:

sudo ddclient -daemon=0 -debug -verbose -noquiet
SUCCESS:  rpi: skipped: IP address was already set to 'My WAN IP'.

Then set as a service:

sudo systemctl enable ddclient

Then edit:

/etc/default/ddclient

EDIT: perhaps ^ this is redundant. at the very least the following is required in ubuntu 18.04:
(sudo nano “/etc/ddclient.conf”)

#ddclient configuration for Dyn
#
#/etc/ddclient.conf
daemon=300                      # Check every 60 seconds.
syslog=yes                      # Log update msgs to syslog.
mail=root                       # Mail all msgs to root.
mail-failure=root               # Mail failed update msgs to root.
 

Here’s my config in ubuntu 18.04:

Configuration file for ddclient
 #
 /etc/ddclient.conf
 ssl=yes
 mail=root
 use=web, web=dynamicdns.park-your-domain.com/getip
 protocol=namecheap
 server=dynamicdns.park-your-domain.com
 login=DOMAIN_HERE
 password=DOMAIN_PASSWORD
 HOST

 protocol=namecheap
 server=dynamicdns.park-your-domain.com
 login=DOMAIN_HERE
 password=DOMAIN_PASSWORD
 @.DOMAIN_HERE, www.DOMAIN_HERE

 protocol=namecheap
 server=dynamicdns.park-your-domain.com
 login=DOMAIN_HERE
 password=DOMAIN_PASSWORD
 @.DOMAIN_HERE, www.DOMAIN_HERE
 daemon=100
 check every 100 seconds, DNS record has ttl 5 mins

After adding the above, I get a sleeping timer here:
sudo systemctl status ddclient.
Success..

The below is likely redundant in new versions of Ubuntu

also using sudo rm /var/cache/ddclient/ddclient.cache before testing will allow me to force an update. I needed to install this for SSL (/ssh or whatever..??)

sudo apt-get install ssh libio-socket-ssl-perl

getting this to run as a service (with systemd) I used

sudo update-rc.d ddclient enable

sudo systemd start ddclient

then

sudo systemd enable ddclient

Also I edited my SSH config since apparently my home NAT router didn’t like keeping the connections alive. These settings went at the bottom of sshd_config – initially I used ServerAlive, which stopped SSH from working :/

ClientAliveInterval 300
ClientAliveCountMax 24

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.