Start using ddclient
For more than 10 years, I’ve been a happy client of Tweak (how long will that link work?). One of the many features it offered was a fixed IP address.
Now that I’m forced to switch to Odido, I will lose this affordance, which serves me greatly whenever I need to connect to my VPN at home. In fact, my phone and laptop are configured to just connect to a subdomain of lanzani.nl, which pointed to my home address, and that address never changed.
I then started looking for ways to update my IP address automatically. Luckily, there seems to be a service that’s been designed for this, ddclient that I’ve set up in my home server as follows:
- First of all, as my DNS is managed by Porkbun, I have to enable API access to change DNS parameters programatically;
- Configuring it is as easy as writing in
~/code/ddclient
the following
# ddclient.conf
daemon=600
use=web
protocol=porkbun
apikey=APIKey
secretapikey=SecretAPIKey
subdomain.lanzani.nl
- Then, as I don’t want to install Perl and what not, I decided to leverage docker to run the script. The
yaml
fordocker-compose
couldn’t be easier:
services:
ddclient:
image: lscr.io/linuxserver/ddclient:latest
container_name: ddclient
environment:
- PUID=1000
- PGID=1000
- TZ=Etc/UTC
volumes:
- /path/to/code/ddclient:/config
restart: unless-stopped
- Start the service and see the logs coming in
[migrations] no migrations found
usermod: no changes
───────────────────────────────────────
██╗ ███████╗██╗ ██████╗
██║ ██╔════╝██║██╔═══██╗
██║ ███████╗██║██║ ██║
██║ ╚════██║██║██║ ██║
███████╗███████║██║╚██████╔╝
╚══════╝╚══════╝╚═╝ ╚═════╝
Brought to you by linuxserver.io
───────────────────────────────────────
To support LSIO projects visit:
https://www.linuxserver.io/donate/
───────────────────────────────────────
GID/UID
───────────────────────────────────────
User UID: 1000
User GID: 1000
───────────────────────────────────────
[custom-init] No custom files found, skipping...
Setting up watches.
Watches established.
[ls.io-init] done.
/config/ddclient.conf MODIFY
ddclient has been restarted
Setting up watches.
Watches established.
SUCCESS: updating ipv4: skipped: subdomain.lanzani.nl address was already set to ...
That’s it. Just a few lines of code, and the problem is gone!