Skip to content

Dynamic DNS Client using ddclient on CentOS 7

Richard Harmonson edited this page Mar 5, 2019 · 5 revisions

Dynamic DNS Client using ddclient on CentOS 7


Published: October 8, 2017


Repository & Packages

The ddclient package is found in the EPEL repository; yum install -y epel-release.

$ sudo yum install ddclient

Results

================================================================================
 Package                     Arch        Version                Repository
                                                                           Size
================================================================================
Installing:
 ddclient                    noarch      3.8.3-2.el7            epel       61 k
Installing for dependencies:
 perl                        x86_64      4:5.16.3-292.el7       base      8.0 M
 perl-Carp                   noarch      1.26-244.el7           base       19 k
 perl-Digest-SHA1            x86_64      2.13-9.el7             base       50 k
 perl-Encode                 x86_64      2.51-7.el7             base      1.5 M
 perl-Exporter               noarch      5.68-3.el7             base       28 k
 perl-File-Path              noarch      2.09-2.el7             base       26 k
 perl-File-Temp              noarch      0.23.01-3.el7          base       56 k
 perl-Filter                 x86_64      1.49-3.el7             base       76 k
 perl-Getopt-Long            noarch      2.40-2.el7             base       56 k
 perl-HTTP-Tiny              noarch      0.033-3.el7            base       38 k
 perl-IO-Socket-IP           noarch      0.21-4.el7             base       35 k
 perl-IO-Socket-SSL          noarch      1.94-6.el7             base      114 k
 perl-Net-LibIDN             x86_64      0.12-15.el7            base       28 k
 perl-Net-SSLeay             x86_64      1.55-6.el7             base      285 k
 perl-PathTools              x86_64      3.40-5.el7             base       82 k
 perl-Pod-Escapes            noarch      1:1.04-292.el7         base       51 k
 perl-Pod-Perldoc            noarch      3.20-4.el7             base       87 k
 perl-Pod-Simple             noarch      1:3.28-4.el7           base      216 k
 perl-Pod-Usage              noarch      1.63-3.el7             base       27 k
 perl-Scalar-List-Utils      x86_64      1.27-248.el7           base       36 k
 perl-Socket                 x86_64      2.010-4.el7            base       49 k
 perl-Storable               x86_64      2.45-3.el7             base       77 k
 perl-Text-ParseWords        noarch      3.29-4.el7             base       14 k
 perl-Time-HiRes             x86_64      4:1.9725-3.el7         base       45 k
 perl-Time-Local             noarch      1.2300-2.el7           base       24 k
 perl-constant               noarch      1.27-2.el7             base       19 k
 perl-libs                   x86_64      4:5.16.3-292.el7       base      688 k
 perl-macros                 x86_64      4:5.16.3-292.el7       base       43 k
 perl-parent                 noarch      1:0.225-244.el7        base       12 k
 perl-podlators              noarch      2.5.1-3.el7            base      112 k
 perl-threads                x86_64      1.87-4.el7             base       49 k
 perl-threads-shared         x86_64      1.43-6.el7             base       39 k

Transaction Summary
================================================================================
Install  1 Package (+32 Dependent packages)

Total download size: 12 M
Installed size: 38 M
Is this ok [y/d/N]:

Configuration

Default configuration file is found /etc/ddclient.conf. Backup then edit the file to identify the external IP address and update your records with your DDNS provider.

External IP Address

$ sudo cp /etc/ddclient.conf /etc/ddclient.conf.bak
$ sudo vi /etc/ddclient.conf

Select the method to obtain external IP address. In my case, my firewall does not have a status page, so I remove the "#" before the provided use=web option for checkip. If your firewall does have a status page with the external IP address, I would advise using it. See the configuration file the list of currently supported firewalls.

use=web, web=checkip.dyndns.org/, web-skip='IP Address' # found after IP Address

Also, update the frequency from 300 to 600 seconds due to threat of being banned by dyndns.org.

daemon=600

DDNS Provider

ddclient supports:

  • DynDNS (dyndns.org)
  • ZoneEdit (zoneedit.com)
  • EasyDNS (easydns.com)
  • Hammernode (hn.org)
  • DSLReports (dslreports.com)
  • OrgDNS (orgdns.org)
  • DNSPark (dnspark.com)
  • NameCheap (namecheap.com)

NameCheap Example

Using NameCheap, update its stanza as follows:

##
## NameCheap (namecheap.com)
##
protocol=namecheap,                             \
server=dynamicdns.park-your-domain.com,         \
login=mydomain.com,                            \
password=[youkeyfromyouranamecheapaccountwithoutthesebrackets]       \
@, www, mail, [host4], [host5]

Enable & Start

$ sudo systemctl enable ddclient && sudo systemctl start ddclient && sudo systemctl status ddclient

Results

Created symlink from /etc/systemd/system/multi-user.target.wants/ddclient.service to /usr/lib/systemd/system/ddclient.service.
● ddclient.service - A Perl Client Used To Update Dynamic DNS
   Loaded: loaded (/usr/lib/systemd/system/ddclient.service; enabled; vendor preset: disabled)
   Active: active (running) since Sun 2017-10-08 15:29:06 PDT; 13ms ago
  Process: 9359 ExecStart=/usr/sbin/ddclient $DDCLIENT_OPTIONS (code=exited, status=0/SUCCESS)
  Process: 9357 ExecStartPre=/bin/touch /var/cache/ddclient/ddclient.cache (code=exited, status=0/SUCCESS)
 Main PID: 9361 (ddclient - slee)
   CGroup: /system.slice/ddclient.service
           └─9361 ddclient - sleeping for 300 seconds

Oct 08 15:29:06 dd.intranet.harmonson.net systemd[1]: Starting A Perl Client ...
Oct 08 15:29:06 dd.intranet.harmonson.net systemd[1]: PID file /var/run/ddcli...
Oct 08 15:29:06 dd.intranet.harmonson.net systemd[1]: Started A Perl Client U...
Hint: Some lines were ellipsized, use -l to show in full.

Done!

At this point if everything went well, you should see your host records update.

Clone this wiki locally