Welcome to Dynamic IP Auto Updater - The Old Page!
This is the old page for the Dynamic IP Auto Updater which is designed and created especially for those who are using dynamic IP for their Debian / Ubuntu ISPConfig server instead of static IP as usually required. When it is setup using cron job as described in the how to guids below, the IP Updater will update the dynamic IP in ISPConfig 3 server and resync it accordingly.
To note, we are still using the same files for ISPConfig 3.0 and 3.1 server, so the new, easier and simpler instructions in the main page also work in ISPConfig 3.0 server and vice versa. This old page is kept to show how edits were done on the two main files that are taken from ISPConfig 3.0 for creating this Dynamic IP Auto Updater.
How To Guides #1
Firstly, you will need to copy resync.php to ipu_resync.php and app.inc.php to ipu_app.inc.php. In ubuntu-based server, to copy the files to new names, basically just type:
sudo cp /usr/local/ispconfig/interface/web/tools/resync.php /usr/local/ispconfig/interface/web/tools/ipu_resync.php
sudo cp /usr/local/ispconfig/interface/lib/app.inc.php /usr/local/ispconfig/interface/lib/ipu_app.inc.php
How To Guides #2
Secondly, in the newly copied file - ipu_resync.php, in /usr/local/ispconfig/interface/web/tools/, change require_once from app.inc.php to ipu_app.inc.php, (give both required files a full path to avoid errors), and disable admin check and tpl by commenting out the lines, as follows:
(you may ignore this if you use the last alternative step)
Then under: //* Check permissions for module
Then under: //* This is only allowed for administrators
// if(!$app->auth->is_admin()) die('only allowed for administrators.');
Then further down:
// $app->tpl->setVar('msg', $msg);
// $app->tpl->setVar('error', $error);
Lastly, further down:
How To Guides #3
Thirdly, in the other newly copied file - ipu_app.inc.php, in /usr/local/ispconfig/interface/lib/, disable start_session() by commenting out the line as follows:
How To Guides #4
Fourthly, create ip_updater.php file in /usr/local/ispconfig/interface/web/tools/ and paste ip_updater.php code to it or use wget to get it instead, as follows:
sudo wget https://raw.githubusercontent.com/ahrasis/IP_Updater/master/ip_updater.php
This upgraded code should work at least on php5.5, 5.6 and 7.0.
How To Guides #5
Lastly, create two cron jobs using sudo crontab -e in terminal or ssh (but not in via ISPConfig control panel). The timing is up to you but I would suggest to add one at every reboot and the other, at least every hour on selected minute e.g.:
@reboot php -q /usr/local/ispconfig/interface/web/tools/ip_updater.php
18 * * * * php -q /usr/local/ispconfig/interface/web/tools/ip_updater.php
As an important note, this ip updater is only changing the ip address for ISPConfig 3 and not for the server and not at the respective dynamic dns site such as Zoneedit. You will need to install a specific software utility to perform dynamic dns updates like ddclient of which its guides may be found in ubuntu help site and some blogs. We really suggest to use our site at http://ip.sch.my for updating ip using ddclient or this ip updater.
Below is sample for /etc/ddclient.conf that is using Zoneedit.
The license is as stated in the ip_updater.php file. Feel free to fork the code and improvise it to suit your needs accordingly.