Menu Close

How to best configure ddclient for joker.com and UDM

Learn how to install and configure a ddclient on a Linux server to update your dynamic DNS registration at joker.com.

I know this is a specific blog about the combination of using ddclient on Debian to update your domain with external WAN IP at www.joker.com. But this blog might contain interesting information for you about setup and configure ddclient on a Ubuntu or Debian Linux server. Joker.com is a very nice DNS hosting provider with a lot of nice DNS features. It has for example DNSSec and DynamicDNS next to all the default DNS stuff.

I have a UDM (Unifi Dream Machine) and it has a DDNS service on board that uses DDclient under the hood. But there are issues with it and I could not get it to work with a custom DDNS provider. It comes with some pre-configured providers which I don’t use. So there is a (relative) simple solution and that is running ddclient on a Linux server or client.

This article will show you how I setup ddclient on a Debian 9 Linux server and configured it with the joker.com DNS provider. I assume you have some Debian server running in your network and it has access to internet.

Please leave me a comment when this was useful for you 🙂

Install ddclient

Login to your Debian / Ubuntu server and sudo to root or use ‘sudo’ in front of all your commands.
Install ddclient with the following command:

apt install ddclient

During the installation the setup wizard will start to enter some DDNS information. You can enter bogus information because we will edit this information later on and change the properties. The wizard will not do the right setup.

Validate ddclient installation

ddclient is written in perl. To check if you can run ddclient without issues run the help:

ddclient -help | more

It can also be run as a service. Type:

service ddclient start

Check the status of the running service, type:

service ddclient status

It will show you something like this:

 ddclient.service - LSB: Update dynamic domain name service entries
   Loaded: loaded (/etc/init.d/ddclient; generated; vendor preset: enabled)
   Active: active (running) since Fri 2021-07-30 11:57:33 CEST; 22h ago
     Docs: man:systemd-sysv-generator(8)
    Tasks: 1 (limit: 19660)
   CGroup: /system.slice/ddclient.service
           └─23086 ddclient - sleeping for 10 seconds

Perl locale warning

If you get a perl locale warning like this while running perl:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = "en_US:en",
	LC_ALL = (unset),
	LC_CTYPE = "UTF-8",
	LC_TERMINAL = "iTerm2",
	LC_TERMINAL_VERSION = "3.4.8",
	LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").

You can fix this by set the (in this case) LC_ALL locale with this command:

export LC_ALL=en_US.UTF-8

Now the error should be gone.

Configuring

After the installation you have access to the following interesting files:

Config filePurpose
/etc/ddclient.confYour personal configuration file where your setup questions went to.Use this file to setup other dynamic DNS providers
/etc/init.d/ddclientThe daemon file which can run the ddclient as a daemon (service)
/default/ddclient/etcThe global parameter file
/usr/share/doc/ddclient/examples/sample-etc_rc.d_init.d_ddclient.ubuntuSome documentation which came with the package

The most interesting file is the ddclient.conf. Open this one with nano, pico, vi or whatever text editor. I will be using nano:

nano /etc/ddclient.conf

Depending on what you entered in the installation wizard the ddclient.conf is filled with information. I suggest you wipe all text and replace it with the following setup:

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

protocol=dyndns2                        # Using the DynDNS v2 protocol
use=web                                 # Using the web to determine my external internet IP
web=https://svc.joker.com/nic/checkip   # The actual web url to determine the WAN IP
server=svc.joker.com                    # The URL to send and update the WAN IP to
login=****************                  # Your Joker DDNS user account
password='****************'             # Your Joker DDNS password
vpn.mydomain.com                        # Your DDNS record to dynamically update the WAN IP

One interesting part is the way ddclient needs to detect your WAN IP of your hosted service. The hole reason behind it is to update your domain DDNS record with the latest known internet WAN IP. In my config I am using the web method and call the url https://svc.joker.com/nic/checkip to check my WAN IP. If you paste this url in a browser you will see a webpage with only your WAN IP. This string is used by ddclient to pass on Joker.com with the server parameter. But what if you don’t want to use the web method but just want to pick the IP address of a network interface from your server.

If for instance you are running a server at DigitalOcean all the droplets (servers) are directly attached to the internet. With a firewall in between of course. Let’s assume your ‘en32’ or ‘eth0’ interface does have a public IP. In this case you could tell ddclient to capture the IP address from the interface. You would use ‘if’ in place of ‘web’ at the use parameter:

use=if, if=eth0                         # Using interface eth0 to determine my external internet IP

But this is up to you to determine the way you want to pick your WAN IP. Next step is to save the config and start ddclient and check the outcome of your config.

Test your config

There are different ways to test your setup. The first thing is to see if getting your WAN IP is working. Use:

ddclient -query

Check your results:

Can't exec "ifconfig": No such file or directory at /usr/sbin/ddclient line 1426.
WARNING:  cannot connect to ipdetect.dnspark.com:80 socket: IO::Socket::INET: Bad hostname 'ipdetect.dnspark.com'
use=web, web=dnspark address is NOT FOUND
use=web, web=dyndns address is NOT FOUND
use=web, web=loopia address is 62.163.232.24
use=web, web=https://svc.joker.com/nic/checkip address is xxx.yyy.zzz.aaa

What you see here is six ways how ddclient is trying to get your external IP. Some are not working but the last one is the specific way we enabled by checking by ‘web’ and provide the url for web checking.
The reason why I get a ifconfig error is because I used a Debian server and the network tooling is nog installed by default. The error for dnsspark.com is because I blocked the DNS lookup for that domain.

The next one we can use is just following the config in the /etc/ddclient.conf:

ddclient -daemon=0 -noquiet -debug

You should see something like this:

DEBUG:    proxy  =
DEBUG:    url    = https://svc.joker.com/nic/checkip
DEBUG:    server = svc.joker.com
DEBUG:    get_ip: using web, https://svc.joker.com/nic/checkip reports xxx.yyy.zzz.aaa

This means you have successfully determined your external IP again. Now check your DDNS setting at joker for the domain and check if the new IP was set successfully.

To get more output from your ddclient use the -verbose argument:

ddclient -daemon=0 -noquiet -debug -verbose

You will see a lot more information.

To use verbose with a smaller output use:

ddclient -verbose

Results:

CONNECT:  svc.joker.com
CONNECTED:  using SSL
SENDING:  GET /nic/checkip HTTP/1.0
SENDING:   Host: svc.joker.com
SENDING:   User-Agent: ddclient/3.8.3
SENDING:   Connection: close
SENDING:
RECEIVE:  HTTP/1.1 200 OK
RECEIVE:  Server: nginx
RECEIVE:  Date: Sat, 31 Jul 2021 11:00:34 GMT
RECEIVE:  Content-Type: text/html
RECEIVE:  Content-Length: 104
RECEIVE:  Connection: close
RECEIVE:
RECEIVE:  <html><head><title>Current IP Check</title></head><body>Current IP Address: xxx.yyy.zzz.aaa</body></html>
SUCCESS:  vpn.mydomain.com: skipped: IP address was already set to xxx.yyy.zzz.aaa.

The last line in this report is the one you are looking for. In this case the IP was already successfully set. You can confirm that your ddclient is working.

Other nice to have parameters

Some other nice to have parameters in /etc/ddclient.conf can be:

syslog=yes                              # Log the ddclient info to /var/log/syslog
ssl=yes                                 # Use Secure Socket Layer when sending the IP to Joker.com
mail=jack                               # Send an e-mail notification to user Jack
mail-failure=jack                       # Send an e-mail in case the update failed to user Jack

Run as a service

We have updated our WAN IP successfully by hand but this is insufficient. We need to check and update the IP more often and automatically. This can be done by configuring ddclient daemon file. Type:

nano /etc/default/ddclient

Set the ‘run_daemon’ parameter to true and both ‘run_dhclient’ and ‘run_ipup’ to false’. You can also set a time interval. Your configuration should look like:

# Configuration for ddclient scripts
# generated from debconf on Fri Jul 30 11:57:32 CEST 2021
#
# /etc/default/ddclient

# Set to "true" if ddclient should be run every time DHCP client ('dhclient'
# from package isc-dhcp-client) updates the systems IP address.
run_dhclient="false"

# Set to "true" if ddclient should be run every time a new ppp connection is
# established. This might be useful, if you are using dial-on-demand.
run_ipup="false"

# Set to "true" if ddclient should run in daemon mode
# If this is changed to true, run_ipup and run_dhclient must be set to false.
run_daemon="true"

# Set the time interval between the updates of the dynamic DNS name in seconds.
# This option only takes effect if the ddclient runs in daemon mode.
daemon_interval="300"

Now restart the client daemon with:

service ddclient restart

Congratulations, you have successfully implemented a ddclient for updating one specific DDNS record (vpn.mydomain.com) at one DDNS provider (joker.com). What if I need to update more (sub)domains at the same hoster or more (sub)domains at more providers? Read on…

Update more than one subdomain at the same DDNS provider

If we want to update more sub domains at the same DDNS provider we can easily add all the subdomains to the ddclient.conf last row. For example:

...
password='****************'             # Your Joker DDNS password
vpn.mydomain.com, www.mydomain.com, blog.mydomain.com

You could also update all needed subdomains at once with a wildcard, like:

...
password='****************'             # Your Joker DDNS password
@.mydomain.com

To see more information about DDNS for Joker.com check out: https://joker.com/faq/index.php?action=artikel&cat=11&id=427&artlang=en

Update more than one domain at the same DDNS provider

What if we need to update more domains at the same DDNS provider? Every DNS registration has its own configuration at a DNS provider. Therefore you need to enable the DDNS option for that specific domain and you will receive an additional username and password to set an IP address. Your config could look like this if we would update two separate domains like mydomain.com and jacksdomain.com:

use=web
web=https://svc.joker.com/nic/checkip

protocol=dyndns2
server=svc.joker.com
login=****************
password='****************'
@.mydomain.com                          # Your first domain

protocol=dyndns2
server=svc.joker.com
login=****************
password='****************'
@.jacksdomain.com                       # Your second domain

Update DDNS records at different DDNS providers

Now, lets assume you have two DNS providers and want to update all domains at those two DNS providers with your new external IP. This can also be done in the same ddclient.conf. You can even use different protocols. In this example we will be using joker.com and Cloudflare:

ssl=yes

protocol=dyndns2
use=web
web=https://svc.joker.com/nic/checkip
server=svc.joker.com
login=****************
password='****************'
@.mydomain.com                          # Your first domain at joker.com

protocol=cloudflare                     # Cloudflare has its own protocol in ddclient :)
use=web
login=****************                  # At Cloudflare this is an e-mail address
password='****************'             # At Cloudflare this is an API key
zone=jacksdomain.com                    # Your DNS zone at Cloudflare
sub.jacksdomain.com                     # The actual domain to update

There you have it all. Please leave me a comment when this was useful for you 🙂

Related Posts

Leave a Reply

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