Free IPAM solution – 1. Installing phpIPAM

Are you tired of using Excel for managing you IP addresses?

Why not use an IPAM DB to keep track of your VLANs, subnets and IP addresses?

An IPAM solution is a vital building block in an automated environment. Lets go through how you can setup a Free IPAM DB for use with vRealize Orchestrator and vRealize Automation.

In a later article I will go though how you integrate it with vRealize Orchestrator.

How to install a phpIPAM server using Ubuntu Server 18.04

Prerequisites: (This guide is based on the 1.4.0 version of phpIPAM)
Installed Ubuntu Server 18.04 LTS

Installation

Downloading phpIPAM

After installing the server and setting up an IP address, a hostname and DNS registration on the server, we need to install the prerequisites for phpIPAM. Unfortunately you might run into some trouble installing it using the install documentation.

Here is how I normally install it.

Installing prerequisites

Now we need to install all the packages that phpIPAM needs to run. Type the following commands to setup the environment. How you do this is up to you. Personally I installed openssh-server during the installation, and will be connecting to the server using SSH, but you can do it anyway you want. The only requirement is that you are logged in as root.

# Commands:

# Install Packages
apt install apache2 php7.2 mysql-server-5.7 php7.2-mysql php7.2-gmp php-pear libapache2-mod-php7.2 php-mbstring php-gd php-curl

# Enable Apache Rewrite Module
a2enmod rewrite

# Restart Apache2
service apache2 restart

# Get phpIPAM
git clone https://github.com/phpipam/phpipam.git /var/www/phpipam/
cd /var/www/phpipam
git checkout 1.4
git submodule update --init --recursive

# Move phpipam to webserver root dir. If you want to keep it in /phpipam on you webserver you can skip these commands, you just have to remember to change the “BASE” parameter in config.php
cd /var/www/html
rm index.html
mv ../phpipam/* ./
mv ../phpipam/.htaccess ./
rm ../phpipam -rf
mv config.dist.php config.php

#Enable Security (Firewall) if you intalled ufw
ufw allow OpenSSH
ufw allow "Apache Full"
ufw enable

Setup MYSQL

To setup MYSQL you need to run the following command. Set your password at accept pretty much all security enhancements that it suggests.

mysql_secure_installation

Change phpIPAM configuration

Edit the file /var/www/html/config.php in your favorite editor vi or nano if your are a newb… Oh I mean Windows user, to change the default phpIPAM password.Change the line:

$db[‘pass’] = “phpipamadmin”;

To:

$db[‘pass’] = “mynewpassword”;

Save the file.

Configure phpIPAM using your browser

Head to the Wizard and choose “Automatic database installation” using a browser to you phpipam server http://your-server.yourdomain .

Enter your mysql root credentials. And press Install phpipam database.

It should now create your database, and you should be able to click Continue.

Setup your phpipam admin password, title and site url. Site url should be the fqdn to your server. Ex: http://your-server.yourdomain Later you might want to setup SSL. For that reason you should not use short name.

Save Settings, and proceed to login.

You should now be able to login with your credentials. The default username is admin. It might take a while to login the first time.

Setup network scanning

If you want phpIPAM to check what IP addresses are already in use, you have to setup network scanning. This is done in two steps. First step is to activate “Check host status” and “Discover new hosts” on the subnet in phpIPAM web ui. Step two is to schedule a scan in the terminal on your phpIPAM server.Go to the terminal of you phpIPAM server and enter “crontab -e” as root. Choose you editor of choice

Add the following to the end of the file:

# update host statuses every 15 minutes
*/15 * * * * /usr/bin/php /var/www/html/functions/scripts/pingCheck.php
*/15 * * * * /usr/bin/php /var/www/html/functions/scripts/discoveryCheck.php

This will run the check every 15 minutes. If you enabled “Check host status” hosts will get a warning symbol if it does now respond to ping without 30 min, and an error if it has not responded for more than 60 minutes. Remember that phpIPAM server will need to be able to ping hosts on the subnet you define, or it will need to have a remote probe on that network. The timeout settings can be changed in phpIPAM ui under “Administrator and phpIPAM settings”

I hope that you found this useful

Remember to backup your IPAM server. You will quickly be depending on it.

Want replication? Check this link

Next Step

I am planning some followup articles:

  • Import and Export from and to your existing spreadsheets
  • Interacting with phpIPAM from vRealize Orchestrator

View Comments (1)

Related Post