BIND server in ISPConfig general question...

Discussion in 'Server Operation' started by BorderAmigos, Jul 15, 2008.

  1. BorderAmigos

    BorderAmigos New Member

    All the named sites under ISPConfig are up and running well and accessible by domain.name. But the system says BIND is not running on boot up. I can manually start it and all still runs well. This isn't a problem just a general configuration question as ISPConfig seems to be running a separate DNS than the main BIND one. I want to write some code that does dynamic DNS updating of the sites on my server.

    Does ISPConfig use the same DNS configuration files as the default BIND? I'm curious how the names are still resolving when the BIND9 server is stopped.
     
  2. falko

    falko Super Moderator Howtoforge Staff

    Which distribution are you using?
     
  3. BorderAmigos

    BorderAmigos New Member

    Debian Etch, Kernel 2.6.18
    ISPConfig 2.2.23 (I think)
     
  4. falko

    falko Super Moderator Howtoforge Staff

    ISPConfig uses the default BIND. Its configuration can be found in /etc/bind/.
     
  5. BorderAmigos

    BorderAmigos New Member

    There is no folder /etc/bind on my system. The configuration files are in /var/lib/named/etc/bind/. This is how it was installed by the 'Perfect Server' instructions.
     
  6. falko

    falko Super Moderator Howtoforge Staff

    But /etc/bind should be a symlink to /var/lib/named/etc/bind...
     
  7. BorderAmigos

    BorderAmigos New Member

    Indeed there is, thanks.

    I need a script that updates the IP of primary zone files when the IP changes. One way is using nsupdate to directly modify them. But if I'm not mistaken, ISPConfig would wipe out those changes next time it re-creates the VHOSTS.

    So, maybe a better idea to write a php script that will update the values in the ispconfig database then trigger a rewrite of the vhosts and a restart of the name server. Does this make sense?

    I'm using DynDNS service for the main nameserver domain updates but don't want to pay an account for every domain name I use in addition to that one.

    I guess my concern is that ISPConfig would re-read the IP addresses from MySQL before re-writing the zone files, rather than having them already stored in memory. True?

    Have a great weekend.
     
    Last edited: Jul 25, 2008
  8. BorderAmigos

    BorderAmigos New Member

    Something like this maybe...???

    Code:
    <?php
    //
    // Configuration
    //
    $dbhost = '';    // MySQL Host Name
    $dbuser = '';    // MySQL User Name
    $dbpass = '';    // MySQK Password
    $remoteip = '';  // Some remote site that will echo your IP address
    //
    // Update Script
    //
    $ip = file_get_contents($remoteip);
    if ($ip !== false)
    {
     $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die('Error connecting to mysql');
     mysql_select_db('db_ispconfig');
     $query = "UPDATE dns_isp_dns SET dns_soa_ip = $ip WHERE dns_soa_ip = *";
     mysql_query($query) or die('IP update failed.');
     $query = "UPDATE dns_a SET ip_adresse = $ip WHERE ip_adresse = *";
     mysql_query($query) or die('A update failed.')
     $query = "UPDATE dns_isp_dns SET status = 'u' WHERE status = *";
     mysql_query($query) or die('DNS update failed.');
     mysql_close($conn);
     $update = shell_exec('touch /home/admispconfig/ispconfig/.run');
    }
    else
    {
     die('Error getting IP address.');
    }
    ?>
    
    I have a remote server that echos the IP using SSI. The intent of this is to update the main external IP and any A records (which I'm using for www.).
     
    Last edited: Jul 26, 2008

Share This Page