IP Management With PHPIP

Want to support HowtoForge? Become a subscriber!
 
Submitted by abhandari (Contact Author) (Forums) on Tue, 2009-11-24 13:22. :: Linux

IP Management With PHPIP 

Phpip is an IP Management tool which helps to manage your network with the detailed information of your client or network IP at the distributed point. This is basically useful for ISPs as well as large networks.

Now we are going to install this system with the  following steps, here we go...

=============================================================================

  • phpIP Management requires that the following software is installed on your system.

    mySQL 4.0 or greater
    PHP 4.4 or greater

    Packages for RPM-based Operating Systems
    • Httpd
    • Php
    • Php-mysql
    • Mysql
    • Mysql-server

    Packages for DEB-based Operating Systems
    • Apache
    • Php4 or php5
    • Php4-mysql or php5-mysql
    • Mysql
    • Mysql-server

  •  (In case of rpm based installation check whether the following additional packages are installed or not otherwise your install.php process won't be successfull.

    • php-pear-<ver>.rpm, php-ldap-<ver>.rpm, automake-<ver>.rpm,php-mysql-<ver>.rpm

      Ports for FreeBSD
      • www/apache2
      • www/php4-cgi
      • lang/php4 (With MySQL Support)
      • databases/mysql323-server

  • Package downloads

(http://www.phpip.net/download.php or

http://jaist.dl.sourceforge.net/sourceforge/phpip/phpip-4.3.2-build-200611081420.tar.gz

  • Installation (RHEL4AS/Fedora/CentOS5.2/other linux flavour + Mysql 4x/5x+ Apache 2.x) In my installation I have used mainly (RHEL4AS + MySql 4.1.x + Apache/2.0.52)
  • Configuration (PHPIP configuration on file includes/install.database.php + MySQL server)

=============================================================================

 

 Fresh Installation

 1. Extract the distribution tarball. (default web root directory /var/www/html/)

# cd /var/www/html/
# wget http://jaist.dl.sourceforge.net/sourceforge/phpip/phpip-4.3.2-build-200611081420.tar.gz
# tar –xzvf phpip-version.tar.gz

2. Rename the directory.

# mv phpip-4.3.2-build-200611081420/ phpip/

3. Edit your Apache configuration:

# vi /etc/httpd/conf/httpd.conf

Add the following lines according to your settings in your httpd.conf:

<VirtualHost 192.168.10.100>
    ServerName ipmanager.ispexperts.com.np
    ServerAdmin ipmanager@ispexperts.com.np
    DocumentRoot /var/www/html/
    DirectoryIndex index.php
<Directory /var/www/html/phpip>
Order deny,allow
Deny from all
Allow from 192.168.10.20 192.168.10.20 192.168.30.0/24
</Directory>
</VirtualHost>

# service mysqld restart

# mysqladmin -u root password testpassword

+++++++++++++++++++++++++++++++++++++

(Some time the following command may need to grant the useraddress to the database if previously created otherwise the web interface will perform it automatically.)

# mysql -u root -p

mysql>use phpip_management;

mysql>show privileges;

mysql>grant all privileges on phpip_managemnet.* to 'root'@'localhost' identified by 'mypassword';

mysql>grant all privileges on phpip_managemnet.* to 'phpip'@'localhost' identified by 'phpip';

mysql>flush privileges;

mysql>quit

++++++++++++++++++++++++++++++

Now access your  web interface after restarting the httpd service:

# service httpd restart

http://your-server/phpip/

or

http://192.168.10.100/phpip/

Follow the step by step install instructions there might come some problem due to incomplete package installation that I have stated above like php-ldap,php-pear,php-mysql etc. Here you will create phpip admin user with database login access for phpip_management (database).

After successful installation you can rename the following file.

Follow the step by step install instructions.

4. Rename the following file: includes/install.database.php

#mv includes/install.database.php includes/database.php

#vi database.php 

<?php
   /*
   +-------------------------------------------------------------------------+
   | Copyright (C) 2006 Michael Earls |
   | |
   | This program is free software; you can redistribute it and/or |
   | modify it under the terms of the GNU General Public License |
   | as published by the Free Software Foundation; either version 2 |
   | of the License, or (at your option) any later version. |
   | |
   | This program is distributed in the hope that it will be useful, |
   | but WITHOUT ANY WARRANTY; without even the implied warranty of |
   | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
   | GNU General Public License for more details. |
   +-------------------------------------------------------------------------+
   | - phpIP - http://www.phpip.net/ |
   +-------------------------------------------------------------------------+
   */
   
   // Create database connection and select database
   mysql_select_db('ip_management', mysql_pconnect('localhost','root','mypassword')) or die (mysql_error());
   
   ?>

Now check your mysql database there you can find a phpip_management database created by web based php interface.

===================================================

 

Upgrade

NOTE:-This is all about the PHPip installation but it hurts when you are going to upgrade your previous phpip to the latest version of phpip which is not facilitated by the software vendor. Ok, let's follow the steps to upgrade:

  1. First take the backup of your MySql phpip_management database; eg.

    # mysqladmin --add-drop-table -u mysqluser -pmypassword phpip_management > /backup/phpipmgmt.sql

  2. Install fresh/new PHPip   ADD the individual CIDR that were created on older PHPip                              
  3.  Now restore the backup but still the Actual IP detail doesn't display until you edit NetMenu and Adderess tables in phpip_management database. eg.

    # mysql -u mysqluser -pmypassword phpip_management < /backup/phpipmgmt.sql

    1. You have to update the field NetID of Address table checking every records of Net_CIDR Net_IPs of NetMenu NetMenuID
    2. eg.

      # mysql> select * from NetMenu;

    3. eg.

      # select * from Address limit 0,30;

      (list first 30 records)
    4. mysql -dump addresses /backup/test.sql;

    5. mysql -dump

    6. eg.

      # update Address set NetID=3 where NetID=16;

    7. update addresses set NetID=3 where NetID=16;

    8. update addresses set NetID=13 where NetID=17;

    9. update addresses set NetID=14 where NetID=18;

    10. update addresses set NetID=15 where NetID=19;

    11. update addresses set NetID=16 where NetID=20;

    12. update addresses set NetID=18 where NetID=22;

    13. update addresses set NetID=17 where NetID=21;

    14. update addresses set NetID=12 where NetID=23;

    15. update addresses set NetID=11 where NetID=24;

    16. update addresses set NetID=10 where NetID=25;

    17. update addresses set NetID=9 where NetID=26;

    18. update addresses set NetID=8 where NetID=27;

    19. update addresses set NetID=7 where NetID=28;

    20. update addresses set NetID=6 where NetID=29;

    21. update addresses set NetID=4 where NetID=31;

    22. update addresses set NetID=24 where NetID=35;

    23. update addresses set NetID=19 where NetID=44;

    24. update addresses set NetID=20 where NetID=43;

    25. update addresses set NetID=21 where NetID=42;

    26. update addresses set NetID=26 where NetID=47;

    27. update addresses set NetID=27 where NetID=48;

    28. update addresses set NetID=28 where NetID=49;

    29. update addresses set NetID=30 where NetID=30;

      (NetID=3 is from NetMenu cidr id and NetID=16 which is to be changed according to New NetMenu     CIDR id. ). In previous versions of PHPip some table names are changed like (user changed to users in latest versions)
  4. Restart your mysql server and httpd server.

    service mysqld restart
    service httpd restart

    Good! Now CIDR value will be updated with the previous IP details.

SNAPSHOTS:-Check URL below for my installation process.

http://www.ispexperts.com.np/ipmgmt2

 =======================

                       ***********************ENJOY***************************


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by Anonymous (not registered) on Thu, 2009-11-26 13:59.

Hello.

How should I mantain subnets smaller than /24 - i.e. /25. I don't want to define two CIDRs - any way to add /24 network and divide it to subnets?

Submitted by abhandari (registered user) on Sun, 2009-12-27 08:19.

Yes, we can do it for smaller subnets like /25 - /30. I have been doing this in an ISP for this kind of network.

Plz try this out first.