Dynamic IP Auto Updater for Debian / Ubuntu ISPConfig 3 Server

Discussion in 'General' started by ahrasis, Apr 29, 2015.

  1. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    Welcome to Dynamic IP Auto Updater!
    This Dynamic IP Auto Updater is designed and created especially for those who are using dynamic ipv4 IP for their Debian / Ubuntu ISPConfig 3 Server instead of static ipv4 IP as usually required. When it is setup using cron job as described in the how to guides below, the IP Updater will update the dynamic ipv4 IP in ISPConfig 3 Server and resync it accordingly.

    The How To Guide

    Whether you are using ISPConfig version 3.0 or 3.1 and too busy to copy, create, rename or edit all relevant files manually, then simply use wget to get ip_updater.php into /usr/local/ispconfig/interface/lib/ folder together with ip_updater for cron job.

    The new script file will be checking for your ip_updater.php file before executing it. The reason for this addup checking is if you install and uninstall or upgrade ISPConfig, there is a chance that the whole folder including ip_updater will be deleted. If that happens, the script will get all the files again before executing ip_updater. Just copy paste these lines unto your terminal and you are good to go:
    Code:
    cd /usr/local/ispconfig/interface/lib
    sudo wget https://raw.githubusercontent.com/ahrasis/IP_Updater/master/ip_updater.php
    cd /etc/cron.d
    sudo wget https://raw.githubusercontent.com/ahrasis/IP_Updater/master/ip_updater
    mkdir /usr/share/ip_updater
    cd /usr/share/ip_updater
    sudo wget https://raw.githubusercontent.com/ahrasis/IP_Updater/master/ip_updater.sh
    sudo chmod +x ip_updater.sh
    exit
    
    This how to guides are also posted in its site at http://ipupdater.sch.my.

    Important Note
    As an important note, this ip updater is only changing the ipv4 ip address for ISPConfig 3 database and websites 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 are promoting the use our site at http://ip.sch.my for updating dynamic ipv4 ip using ddclient or this ip updater. Below is sample for /etc/ddclient.conf that is using Zoneedit.
    Code:
    daemon=600
    pid=/var/run/ddclient.pid
    ssl=yes
    protocol=zoneedit1
    
    use=web, web=ip.sch.my
    server=dynamic.zoneedit.com
    login=username
    password='password'
    domain.tld
    
    License
    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.

    I hope you will find these tips and tricks useful. Do report if there is any problem, thank you.
     
    Last edited: Dec 10, 2017
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    You better use the ispconfig remote api. The procedure that you use above will not result in a proper IP update for several reasons:

    1) Data in sys_datalog may never be modified. The data there is transaction data, so you can not modify a existing transaction.
    2) You dont update the serial of the zone, so your change will get ignored by all external dns servers and clients.

    To do a dynamic IP update corrrectly, use the ispconfig remote apt function dns_a_update.
     
  3. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    Ok. So, I should not modify sys_datalog? But, I should update the serial and ip address of the zone instead? I can try to update the php script to conform with that.

    But using your advised method, how do I use dns_a_update.php? As I can see, it relates to a soap_config.php file.

    I did the following:
    1. Edit the soap_config.php with ispconfig cp admin login and password.
    2. Change soap_config.php ip address to localhost or local ip address.
    3. Upload both files to ispconfig web / server folder.
    4. Run dns_a_update.php in via ssh.
    5. I got SOAP error.

    Do I need to edit dns_a_update.php? Or can I used dns_a_edit.php?

    Thanks a million in advance.
     
  4. cypriot

    cypriot New Member

    Hi There,
    I would love to hear from you ahrasis , i am looking for kind of same thing but we want to create subdomains on our VPS and keep the ip updated same as our Home IP(dynamic) , would you be able to help please ,? i dont mind contributing
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    and which error do you got?
     
  6. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    @cypriot I am playing with it. The latest one is in the github. I use a modified resync.php and modified app.inc.pho.

    @till I will test it again and report the error with better details. My guess is may be because I ssh from localhost.
     
  7. cypriot

    cypriot New Member

    @ahrasis
    Thank you for your reply, do you mean it is okay to use for subdomains as it is to update their IP record as the local IP changes at home server ?
     
  8. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    Yes. It should work just fine as I am using one myself. The only hiccup will be the time for dns propagation which is unavoidable in most cases.
     
  9. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    Updated to compliment php5.6 and php7.0 (previously php 5.5). Feel free to comment, report any errors or improvise further.
     
  10. sjau

    sjau Local Meanie Moderator

    I wrote my own little script a while back but that seems a lot better. When I need it for something new I'll probably use yours.
     
    ahrasis likes this.
  11. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    Updated as ip_updater.php sometime miss updating soa zone files. Do report if you are facing errors with the new one.
     
  12. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    Updated to use only ip_updater.php. No need to use ipu_resync.php and ipu_app.inc.php anymore and dns resync code is already included the ip_updater.php.
     

Share This Page