b2ap3_thumbnail_images.jpg

 

A quick and easy guide on how to update Cpanel A records automatically from a Linux server with your current ip address . This can be used to give a perminant DNS hostname to a Dynamic Ip address.

 

Info : What i am trying to acomplish - I have a home server which i like to remote into every now and then , because my ISP uses dynamic Ip addressing this causes my IP to change and i cant remote in . Dyndns.org used to offer the service which allowed you to use a hostname instead of your ip address and most home routers would automatically update this . The Free Dyndns service has now ceased so heres a guide on how to acomplish the same using Cpanel.

1.) To acomplish this task you need a domain hosted on cpanel . My domain Luketaylor.org uses cpanel.


2.) Inside Cpanel i set up a new Host A record and point this to my home server IP e.g. " Remote.Luketaylor.org" >> 92.66.77.54

3.) On any Linux based server ( or Linux based Router ) make a directory in the root called scripts

4.) Place the following script inside DOWNLOAD HERE

5.) Remove the .txt from the end of the file

5.) Edit the following lines

Place your working email in the line below

CONTACT_EMAIL=""

Put your domain name excluding any record before the domain name

}DOMAIN="DOMAIN.org"

This field should be the Hosta record you placed in cpanel , mine for e.g. was "Remote"

SUBDOMAIN="Remote"

}

Ip of your CPANEL host

CPANEL_SERVER="0.0.0.0"

USERNAME of your cpanel server

CPANEL_USER="username"

password of your cpanel server

CPANEL_PASS="password"

 

Creating the Config File

1.) Goto /Etc in root and create a file called cpdyndns.conf

2.) place the following information inside , you can copy it from what you wrote above

Place your working email in the line below

CONTACT_EMAIL=""

Put your domain name excluding any record before the domain name

DOMAIN="DOMAIN.org"

This field should be the Hosta record you placed in cpanel , mine for e.g. was "Remote"

SUBDOMAIN="Remote"

Ip of your CPANEL host

CPANEL_SERVER="0.0.0.0"

USERNAME of your cpanel server

CPANEL_USER="username"

password of your cpanel server

CPANEL_PASS="password"

 

 

Creating the crontask

1.) use the command " Crontab -e " in a command shell

2.) insert the following command ( will execute the script every 45 mins)

 0/45 * * * * /Scripts/cpanel-dynamic-dns.sh