0% found this document useful (0 votes)
1K views16 pages

Php-Ipam Setup Guide

This document provides steps to install and configure Phpipam, an IP address and DNS management tool. It outlines downloading and setting up the Phpipam application files, configuring the database connection, enabling modules, creating an API key, and setting up PowerDNS integration. The key steps are: 1. Installing required packages like Apache and MariaDB. 2. Configuring the Apache web server and firewall. 3. Cloning the Phpipam files, setting permissions, and changing the document root. 4. Configuring the database connection in the config.php file and installing the Phpipam database.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views16 pages

Php-Ipam Setup Guide

This document provides steps to install and configure Phpipam, an IP address and DNS management tool. It outlines downloading and setting up the Phpipam application files, configuring the database connection, enabling modules, creating an API key, and setting up PowerDNS integration. The key steps are: 1. Installing required packages like Apache and MariaDB. 2. Configuring the Apache web server and firewall. 3. Cloning the Phpipam files, setting permissions, and changing the document root. 4. Configuring the database connection in the config.php file and installing the Phpipam database.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 16

PHPIPAM Setup Guide

Phpipam is an IP address and DNS management tool that is commonly deployed in large
IT departments.Often,it is used in conjunction with Vmware or other private clouds for ip
allocationa and de allocation.
Below are the steps to install phpipam server application,
 Setting locale:
Add following to file /etc/environment for en_US coding, add your encoding if you will
Use different.
#add in the file :
LC_ALL=en_US.utf-8
LANG=en_US.utf-8

 Install all required packages for phpipam:


yum install httpd mariadb-server php php-cli php-gd php-common php-ldap
php-pdo php-pear php-snmp php-xml php-mysql php-mbstring git

 If you need crypt method for API you need to install also php-mcrypt php extension, which is
available on epel-release package:
yum install epel-release
yum install php-mcrypt

 Set correct timezone to php.ini to avoid php warnings:

vi /etc/php.ini
#add at:
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = Asia/Kolkata

 Configuring and running MySQL (MariaDB) database server:

1. First start MariaDB server and make it start at boot time:


service mariadb start
chkconfig mariadb on
2. Now, we need to set the root password by executing the following command.
mysql_secure_installation
 Configuring and running Apache webserver

Main apache configuration is in file /etc/httpd/conf/httpd.conf, open and do the following


changes.

1. We also need to set server name, for now we will use localhost, change it to your FQDN
ServerName locahost:80

2. Save file and exit.

 Firewall rule is also needed to pass http/https traffic to webserver from external interfaces if
needed with following command:
yum install firewalld
systemctl start firewalld
systemctl enable firewalld
Check the firewall is running or not with below command
systemctl status firewalld
Add the ports in firewall, when the below commands has ran it should show as success.
firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --permanent --add-port=443/tcp
firewall-cmd --reload

 Now start apache webserver, and also make sure it starts at boot:

service httpd start


chkconfig httpd on

 Downloading phpipam installation files.

1. Using github is preferred and easiest way to setup and maintain phpipam.

cd /var/www/html/

2. Clone the phpipam files in seperate folder, follow the below command to do that

git clone https://github.com/phpipam/phpipam.git phpipam

3. Then we have to change the document root by opening the file /etc/httpd/conf/httpd.conf ,

DocumentRoot "/var/www/html/phpipam"
4. Then add one Directory in the same file,

<Directory "/var/www/html/phpipam">
Options FollowSymLinks
AllowOverride all
Order allow,deny
Allow from all
</Directory>

5. Save and exit from the file

All the files are downloaded in /var/www/html/phpipam folder as mentioned in the above
command.
I
 phpipam code is now downloaded in /var/www/html, which is our document root.

1. To use latest phpipam development version leave out the "git checkout –b 1.4" command

2. Also make sure upload folders are accessible for xls/csv imports by opening the folder
phpipam and execute the below commands,

cd phpipam
git checkout -b 1.4 #To use latest phpipam development version

chown apache:apache -R /var/www/html/phpipam


chcon -R -t httpd_sys_content_t /var/www/html/phpipam
find . -type f -exec chmod 0644 {} \;
find . -type d -exec chmod 0755 {} \;

chcon -R -t httpd_sys_rw_content_t app/admin/import-export/upload/


chcon -R -t httpd_sys_rw_content_t app/subnets/import-subnet/upload/
chcon -R -t httpd_sys_rw_content_t css/images/logo/

 Configuring database connection

1. To do it we first need to copy over sample config file to config.php that phpipam uses:

cp config.dist.php config.php

2. Now open config.php file and set settings for database connection. Do not use root user/pass,
whatever you put here will be used for further connections to database and users from
config.php will be automatically created.

$db['host'] = 'localhost';
$db['user'] = 'phpipamadmin';
$db['pass'] = 'phpipampass';
$db['name'] = 'phpipamdata';
$db['port'] = 3306;
3. Restart httpd using below command,
systemctl restart httpd

 Phpipam Installation

1. Open browser and go to http://publicip of your instance/

2. click on new phpipam installation block .

3. Then select Automatic database installation and login the database with "root user and
password " of mysql.
Then click on install pjpipam database, it will show Databse installed successfully then click
continue to next step.

4. Set the Admin Password for phpipam admin account.

Default username for phpipam admin account is ‘admin’

Save Settings and procced to login in to phpipam server.

 After Installing the phpipam, first thing to do is to enable the required modules shown below,

1. Open Administrator menu and click on phpipam settings,


2. Enable the modules shown below,

1. API
2. Ip request module
3. Enable PowerDNS
4. Resolve DNS Names and the required modules as per your use.

3. To communicate with phpipam server through rest api, we need to create an api in the
phpipam server application.

1. Go to Api module on clicking the Api module from the right side phpipam settings
menu. Then click on create API Key.
2. Save the settings after creating the api,

3. To communicate with phpipam server application using the user token with http requests,
we need to change one paremeter in config.php file.

Make api_allow_unsafe parameter as true


 PowerDns Setup in Phpipam Server Application:

1. Install powerdns and backend database,


yum -y install pdns pdns-backend-mysql
2. open mysql using root credentials
mysql -u root –p
3. create database

CREATE DATABASE powerdns;

4. Grant permissions to the user

GRANT ALL ON powerdns.* TO 'username'@’username' IDENTIFIED BY


'password';

FLUSH PRIVILEGES;

5. create tables to store the data of domains, records and etc of created ip addresses in each subnet.

1. Change database:

USE powerdns;
2. Create following tables in power dns db,

CREATE TABLE domains (


id INT AUTO_INCREMENT,
name VARCHAR(255) NOT NULL,
master VARCHAR(128) DEFAULT NULL,
last_check INT DEFAULT NULL,
type VARCHAR(6) NOT NULL,
notified_serial INT DEFAULT NULL,
account VARCHAR(40) DEFAULT NULL,
PRIMARY KEY (id)
) Engine=InnoDB;

CREATE UNIQUE INDEX name_index ON domains(name);

CREATE TABLE records (


id BIGINT AUTO_INCREMENT,
domain_id INT DEFAULT NULL,
name VARCHAR(255) DEFAULT NULL,
type VARCHAR(10) DEFAULT NULL,
content VARCHAR(64000) DEFAULT NULL,
ttl INT DEFAULT NULL,
prio INT DEFAULT NULL,
change_date INT DEFAULT NULL,
disabled TINYINT(1) DEFAULT 0,
ordername VARCHAR(255) BINARY DEFAULT
NULL
auth TINYINT(1) DEFAULT 1,
PRIMARY KEY (id)
) Engine=InnoDB;

CREATE INDEX nametype_index ON records(name,type);


CREATE INDEX domain_id ON records(domain_id);
CREATE INDEX recordorder ON records (domain_id, ordername);

CREATE TABLE supermasters (


ip VARCHAR(64) NOT NULL,
nameserver VARCHAR(255) NOT NULL,
account VARCHAR(40) NOT NULL,
PRIMARY KEY (ip, nameserver)
) Engine=InnoDB;

CREATE TABLE comments (


id INT AUTO_INCREMENT,
domain_id INT NOT NULL,
name VARCHAR(255) NOT NULL,
type VARCHAR(10) NOT NULL,
modified_at INT NOT NULL,
account VARCHAR(40) NOT NULL,
comment VARCHAR(64000) NOT NULL,
PRIMARY KEY (id)
) Engine=InnoDB;

CREATE INDEX comments_domain_id_idx ON comments (domain_id);


CREATE INDEX comments_name_type_idx ON comments (name, type);
CREATE INDEX comments_order_idx ON comments (domain_id, modified_at);

CREATE TABLE domainmetadata (


id INT AUTO_INCREMENT,
domain_id INT NOT NULL,
kind VARCHAR(32),
content TEXT,
PRIMARY KEY (id)
) Engine=InnoDB;

CREATE INDEX domainmetadata_idx ON domainmetadata (domain_id, kind);

CREATE TABLE cryptokeys (


id INT AUTO_INCREMENT,
domain_id INT NOT NULL,
flags INT NOT NULL,
active BOOL,
content TEXT,
PRIMARY KEY(id)
) Engine=InnoDB;

CREATE INDEX domainidindex ON cryptokeys(domain_id);

CREATE TABLE tsigkeys (


id INT AUTO_INCREMENT,
name VARCHAR(255),
algorithm VARCHAR(50),
secret VARCHAR(255),
PRIMARY KEY (id)
) Engine=InnoDB;

CREATE UNIQUE INDEX namealgoindex ON tsigkeys(name, algorithm);


3. create one domain in table
INSERT INTO domains (name, type) values ('example.com', 'NATIVE');
6. start pdns service
systemctl start pdns.service
systemctl status pdns.service

7. In phpipam application select powerdns from the phpipam settings menu and configure the db
details and default settings for powerdns.
8. Then enable powerdns in subnets and refresh the threshold ttl.

9. when its successfully edited then refresh the zone.

10. Click on regenerate to get ptr records.


Scroll down to check the ptr records for the existing ip addresses.

You might also like