Ddclient installation and configration Tutorial–use dynu as an example

Ddclient is a dynamic dns client. I use it with dynu and it has been working well for years(even in china). In china, dynu’s official website is blocked but the api server is not.

Installation

If you want to install ddclient on a Debian-based system (such as ubuntu、raspberry, of course debian),use the following command:

$sudo apt-get install ddclient -y

Configration

Here is my configuration on Raspberry:

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

# check every 60 seconds
daemon=60
# log update msgs to syslog
syslog=yes
# mail all msgs to root
#mail=root
# mail failed update msgs to root
#mail-failure=root
# record PID in file.
pid=/var/run/ddclient.pid
# use ssl-support.  Works with ssl-library
ssl=yes
# get ip from server.
use=web, web=ip.cip.cc/
# default server
server=api.dynu.com
# default login
login=lightzhan
# default password
password=***********
protocol=dyndns2
****.lightzhan.xyz

Note that ‘#’ is used to comment, “ip.cip.cc” is a website that will give you your ip address when you access it(When you access it through browser, you will know what it is). It is very useful when our computer is behind a router and cannot get public ip from adapter. The server item is the ip address of the api server. For dynu, it is “api.dynu.com” (the ddns service provider will tell you) . The login and the password is the username and password of api server respectively. The api server may be not the same with the webisite of the service provider, for example, for dynu, there is a “api.” in front of “dynu.com”(It is a subdomain).

the config file need to be put in” /etc/” directory. In addition, we need to set ddclient run as a daemon, so modify the file “/etc/default/ddclient”, here is mine:

# Configuration for ddclient scripts
# generated from debconf on Tue 13 Mar 08:49:09 UTC 2018
#
# /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"

Note that I set “run_daemon” to true and daemon_interval to 300(5 minutes).

Check update log

Run the following command to start ddclient or restart ddclient, this will make it load new config we set:

$sudo service ddclient start/restart

Then use a edit tool or cat command to open update log:

$cat /var/cache/ddclient/ddclient.cache

If you have a right config, you will find it says the ip update successfully. If you can not find the file /var/cache/ddclient/ddclient.cache, please check whether run_daemon is true in /etc/default/ddclient.

Problems

I have tried many times before succeeding, so you may run into some problems too. Here are some aspects to check:

  • Whether your computer can get public ip successfully?
  • Are your login information correct?
  • Are your api server is correct? can your computer get ip address?
  • Or you can check the log information!

Thanks for your reading!

Leave a Reply

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