Open source IP address management

Please, no more excel docs with all our IP address, vlan information… etc. In the times of the AI, blockchain and lots of cool technologies a lot of companies (including some of the big ones) still don’t use a tool for manage their servers and network inventory.

There are some open source tools like phpipam which make our inventory maintenance easier.

So, let’s see how to install phpipam.

First of all we will start installing apache and php.

root@labo1234:~ $ yum install httpd
root@labo1234:~ $ yum install php-cli php-common php-json php php-pdo php-gd php-mysqlnd php-mcrypt libmcrypt php-mbstring php-pear

Clone the official phpipam git repositories

root@labo1234:~ $ git clone https://github.com/phpipam/phpipam.git /var/www/phpipam
Cloning into '/var/www/phpipam'...
remote: Enumerating objects: 149, done.
remote: Counting objects: 100% (149/149), done.
remote: Compressing objects: 100% (105/105), done.
remote: Total 21520 (delta 61), reused 85 (delta 44), pack-reused 21371
Receiving objects: 100% (21520/21520), 15.16 MiB | 3.35 MiB/s, done.
Resolving deltas: 100% (15642/15642), done.
root@labo1234:~ $ 

Checkout the branch 1.3 (latest stable)

root@labo1234:~ $ cd /var/www/phpipam
root@labo1234:/var/www/phpipam $ git checkout 1.3
Note: checking out '1.3'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

HEAD is now at 9a5f0b9... Added devices API controller #1173
root@labo1234:/var/www/phpipam $ 

Install other phpipam modules

root@labo1234:/var/www/phpipam $ git submodule update --init --recursive
Submodule 'functions/PHPMailer' (https://github.com/PHPMailer/PHPMailer.git) registered for path 'functions/PHPMailer'
Submodule 'functions/php-saml' (https://github.com/onelogin/php-saml.git) registered for path 'functions/php-saml'
Cloning into 'functions/PHPMailer'...
remote: Enumerating objects: 23, done.
remote: Counting objects: 100% (23/23), done.
remote: Compressing objects: 100% (17/17), done.
remote: Total 6742 (delta 9), reused 12 (delta 6), pack-reused 6719
Receiving objects: 100% (6742/6742), 4.70 MiB | 1.48 MiB/s, done.
Resolving deltas: 100% (4363/4363), done.
Submodule path 'functions/PHPMailer': checked out 'f97b9cd3c2dcf348d110d17613a82614d1163ab5'
Cloning into 'functions/php-saml'...
remote: Enumerating objects: 124, done.
remote: Counting objects: 100% (124/124), done.
remote: Compressing objects: 100% (81/81), done.
remote: Total 4493 (delta 49), reused 80 (delta 29), pack-reused 4369
Receiving objects: 100% (4493/4493), 2.83 MiB | 1.41 MiB/s, done.
Resolving deltas: 100% (2607/2607), done.
Submodule path 'functions/php-saml': checked out '97eb229922be90914797b512d578e791e8bba5b9'
root@labo1234:/var/www/phpipam $ 

Create a MySQL database for the tool. I’ll use MySQL 8.0.

mysql> create database phpipam;
Query OK, 1 row affected (0.01 sec)

mysql> create user phpipam@localhost identified with mysql_native_password by 'the_fuc***_amazing_password';
Query OK, 0 rows affected (0.01 sec)

mysql> grant all on phpipam.* to phpipam@localhost;
Query OK, 0 rows affected (0.01 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> 

As note… If you want to use MySQL v8 like this example, you will need configure some variables in /etc/my.cnf because 8.0 is disruptive in somethings with versions 5.6 or 5.7.

default-authentication-plugin=mysql_native_password
character-set-server=utf8

Create the configuration file

root@labo1234:/var/www/phpipam $ cp -a config.dist.php config.php

Edit the config.php with your database connection data.

Create a basic virtualhost in apache

root@labo1234:/var/www/phpipam $ cat /etc/httpd/conf.d/phpipam.conf
<VirtualHost *:80>
    ServerName inventory.local
    ServerAdmin root@inventory.local
    DirectoryIndex index.php
    DocumentRoot /var/www/phpipam
</VirtualHost>

And restart apache.

root@labo1234:/var/www/phpipam $ systemctl restart httpd

Now, go to the web-browser and select the option 1, “New phpipam installation”

Select the option 1, “Automatic database installation”.

Add the database data created beforeā€¦ and install the database. I highly recommend enter in “Show advanced options” and uncheck all.

Now create the admin user and configure the url of the site.

Once we saved settings we can now enter in the login page.

And that’s all.