In order for this to work properly, it is preferable to have a system powered on continuously. For example , I have a Raspberry Pi which is connected to my home router .

Download these files to your PC: server-dyndns.pl , server-dyndns.sh, dyndns.cgi, client-dyndns.sh

The idea is this:
The client script will verify if ping in your www.domain.tld works.
If ping is successful, it issues a POST request to the webpage www.domain.tld/cgi-bin/dyndns.cgi with a predefined user and a password.
The CGI file will collect the client IP address stored in REMOTE_ADDR environment variable. If you picked up a pretty strong CGI password, the client should be the only machine to successfully authenticate, providing the dynamic public IP address from your home.
The CGI file writes the client IP address in a file stored in /home/<LINUX-USER>/bin/pc.domain.tld .
The server-dyndns.sh verifies if the file created by the CGI script really exist and compares the IP stored with another stored in a previous version of the same file (terminated in .old extension) .
If the IP addresses differ, it will issue the server-dyndns.pl API to the CPanel of your website and will update the “pc.domain.tld” DNS record. Otherwise, it will only overwrite the previous version with the current version of the pc.domain.tld file .

In my tutorial all the steps are performed every 15 minutes, with 1 minute delay between the client script and the server script, so the pc.domain.tld file could be created before issuing the server script.

Server side

Upload server-dyndns.pl and server-dyndns.sh files on the CPanel server in /home/<LINUX-USER>/bin/ .
Create a DNS record named “pc.domain.tld”.
Create a BASE64 encoded text of the CPanel credentials:

 <CPanel-user>:<CPAnel-password>

Edit server-dyndns.pl and modify these lines with the corresponding values:

my $cpanel_domain = "domain.tld";
my $auth = "Basic <BASE64-PASSWORD>";

Edit server-dyndns.sh and modify “<LINUX-USER>” and “domain.tld” strings with the corresponding values.

Create the cronjob to update the DNS zone:

01,16,31,46 * * * * /bin/bash /home/<LINUX-USER>/bin/server-dyndns.sh >/dev/null 2>&1

Upload dyndns.cgi file to the cgi-bin/ folder of your website. It is a Perl script.
Edit dyndns.cgi and change “<LINUX-USER>”, “<CGI-USER>”, “<CGI-PASSWORD>” with the proper values.

Client side

Upload the client-dyndns.sh file on the home server which behind the DHCP router.
Edit client-dyndns.sh and replace “domain.tld”, “<CGI-USER>”, “<CGI-PASSWORD>” with the proper values.

Create the cronjob to check-up the current public IP address:

00,15,30,45 * * * * /bin/bash /path/to/client-dyndns.sh >/dev/null 2>&1

Notice: You might need to install some Perl modules , like CGI.

P.S. Don’t hesitate to contact me by e-mail if you encounter difficulties.