Why You Need DDNS

We are going to step back for a minute today and discuss the Dynamic Domain Name System or ddns for short. The first consideration that you have when self hosting is how users on the Internet will find the services that you host. Internet Service Providers grant home users a single IPv4 TCP/IP WAN address. This address can change.

Assuming you have purchased a domain name, you will want to have your domain name follow your WAN address and that’s what this video is about.

Unfortunately every Domain Name Service provider has a different way of defining a DDNS A-Record. Routers, Network Attached Storage Systems (NAS), and Linux all have ways to run a DDNS client to keep the DDNS A-Record for your domain up to date. In this video, I provided an example of the use of the DDNS client in Ubiquiti Unifi and QNAP NAS.

You can also run a DDNS Client in Linux. I created a simple LXD container in which to run the Linux DDNS Client:

lxc launch ubuntu:22.04 ddns -c boot.autostart=true

I connected to the container console:

lxc exec ddns bash

I installed the ddclient which works for all Debian derived distros of Linux:

sudo apt install ddclient

During the installation, you are asked for the host you want to update (your domain name), the username, and the password. Since I am using google domains, the address to contact for the change is domains.google.com.

After installation, you can edit the configuration file.

sudo nano /etc/ddclient.conf

Here is an example of the contents:

# Configuration file for ddclient generated by debconf
# /etc/ddclient.conf

protocol=googledomains \
use=web, web=https://domains.google.com/checkip \
login=f4ysqRsI81QIXlTX \
password='mO3JVu9LIQGRty7A' \

If you made any changes while editing.

sudo service ddclient restart

To check the status of your ddns service:

sudo service ddclient status

There are multiple ways to check your WAN address from a Linux terminal:

curl ifconfig.me
curl ipinfo.io/ip
curl api.ipify.org
curl icanhazip.com

This tutorial showed how to create a ddns A-Record for your domain and how to use a ddns client on your local network to keep the ddns A-Record up to date on your domain provider. I also mention that services that you host should have subdomain records that are CNAME records that point back to your domain name.

This design allows a reverse proxy client such as NginX Proxy Manager or Traefik to route an inbound request for a service such as https://chat.scottibyte.com/ to a private address on your LAN that is running the application. If there is sufficient interest, I may do a follow-on tutorial about the reverse proxy program.

1 Like