search
HomeDatabaseMysql TutorialHow to manage ip addresses and subnets with phpIPAM_MySQL

A typical network/system admin is responsible for managing one or more subnets within the network under control. For example, when a LAN segment is assigned a /24 subnet, a total of 254 IP addresses can be used for different purposes. To keep track of what IP addresses are assigned to which hosts, some sort of documentation is needed. The easiest way to do it would be maintaining a single spreadsheet which documents IP address allocation information. This works like a charm for a small network with only one admin. However, relying on a spreadsheet is not convenient and error-prone with multiple large networks. Worse, if there are multiple admins involved, updating the spreadsheet could be tricky as each admin could often end up with different versions of the document.

One way to manage IP address allocations more systematically is using a web based IP address management tool. Not only can the web based tool be accessed from anywhere, but a backend database also ensures that all updates to the database are properly synchronized and applied in real time. While there are many web applications available, we will be focusing on setting upphpIPAM(IP Address Manager) in this tutorial. phpIPAM is an open source, efficient IP address management application with the following features.

  • Support for both IPv4 and IPv6 (unlike many other tools, IPv6 support is very good)
  • Built in IPv4 and IPv6 calculator
  • Supports CIDR notations
  • MySQL support
  • Nested subnets
  • User/group based permissions
  • Visual reporting tool
  • Import/export using .xls files
  • Device, VRF, and VLAN support
  • Powerful search engine
  • Email notifications
  • Supports AD/LDAP based authentication

The demo site for phpIPAM is available athttp://demo.phpipam.net.

In this tutorial, we will besetting up phpIPAM along with Apache web server in theUbuntuenvironment.

Installing phpIPAM on Ubuntu

First of all, install required packages usingapt-get.

# apt-get install apache2 mysql-server php5 php5-gmp php-pear php5-mysql php5-ldap wget

If MySQL has been installed for the first time, please set the root password using the following command.

# mysqladmin -u root password NEWPASSWORD

phpIPAM can be set up with any web server directory. We will set it up in the /phpipam/ sub directory under the root directory of Apache web server.

Download phpIPAM package.

# wget http://kent.dl.sourceforge.net/project/phpipam/phpipam-1.0.tar

Extract the package into the web server directory.

# cp phpipam-1.0.tar /var/www/
# cp /var/www/
# tar xvf phpipam-1.0.tar
# rm phpipam-1.0.tar

Now, specify the MySQL username and password, as well as its base directory.

# vim /var/www/phpipam/config.php

$db['host'] = "localhost";## MySQL user for ipam ##$db['user'] = "phpipam";## password for the MySQL user ##$db['pass'] = "phpipamadmin";## database for MySQL ##$db['name'] = "phpipam";## base directory ##define('BASE', "/phpipam/");

The base directory needs to be defined in the provided .htaccess file.

# vim /var/www/phpipam/.htaccess

RewriteBase /phpipam/

Preparing Apache Web Server

phpIPAM needs therewritemodule for operation. The module can be enabled in an Ubuntu or Debian machine usinga2enmodcommand as follows.

# a2enmod rewrite

Next, Apache's default configuration needs to be changed as well. Please add/modify your configuration to look like the one below.

# vim /etc/apache2/sites-enabled/000-default

<directory></directory>Options Indexes FollowSymLinks MultiViewsAllowOverride allOrder allow,denyallow from all

Finally, restart Apache web service.

# service apache2 restart

Finalizing Installation

We can finalize the installation of phpIPAM by using the web browser. Pointing the browser to the URL: http:///phpIPAM will show the following phpIPAM installation page. We can proceed to automatic database installation.

How to manage ip addresses and subnets with phpIPAM_MySQL

How to manage ip addresses and subnets with phpIPAM_MySQL

Now phpIPAM should be up and running. We can login using the following default credentials.

  • URL: http:///phpipam
  • User: Admin
  • Pass: ipamadmin

Manage IP Addresses with phpIPAM

In the rest of the tutorial, we will walk you through how to manage subnets and IP addresses with phpIPAM.

Creating a section

Let us start by adding a section for our network. Click on Administration > Sections.

How to manage ip addresses and subnets with phpIPAM_MySQL

Click on "Add Section". Now we can name our section as we want it to be displayed. Fill in the details of the section.

How to manage ip addresses and subnets with phpIPAM_MySQL

Creating a subnet

Next, we add a new subnet 172.16.1.0/24 under the section 'Our Network'. Click on Our Network > Add Subnet

How to manage ip addresses and subnets with phpIPAM_MySQL

How to manage ip addresses and subnets with phpIPAM_MySQL

Now we can easily add IP addresses in the subnet. One method of adding IP addresses is to add them one by one. phpIPAM provides an alternative method to scan all the hosts and add them automatically without much hassle. It can scan the local subnet located in the same broadcast domain, as well as remote subnets reachable through routing. After selecting a subnet, click on 'scan subnet for new hosts' to scan IP addresses as shown below.

How to manage ip addresses and subnets with phpIPAM_MySQL

After the scan is performed, the discovered IP addresses can be added into the database by clicking the 'Add discovered hosts' button at the bottom.

Creating an IPv6 subnet

IPv6 subnets can also be created in a similar process. We specify the IPv6 network as showed in the screenshot.

How to manage ip addresses and subnets with phpIPAM_MySQL

All the tools available for IPv4 can be used for IPv6 as well.

Creating a nested subnet

phpIPAM also provides the option of creating nested subnets for both IPv4 and IPv6. For example, we will be dividing our IP block 172.16.1.0/24 into 4 smaller subnets (/26), each for a specific department within the organization. After selecting the /24 subnet, we can create a nested subnet using the 'Add a new nested subnet' button. The screenshot below shows the icon for adding a nested subnet.

How to manage ip addresses and subnets with phpIPAM_MySQL

After all the subnets have been created, we should have similar output. Following is a nested subnet preview window.

How to manage ip addresses and subnets with phpIPAM_MySQL

Adding users and groups

First, we will create a group with READ/WRITE permission to the section 'Our network'. This can be done by selecting Administration > Groups > Create Group.

How to manage ip addresses and subnets with phpIPAM_MySQL

Now that the group has been created, we modify section permission by selecting Administration > Sections, and then editing the section.

How to manage ip addresses and subnets with phpIPAM_MySQL

How to manage ip addresses and subnets with phpIPAM_MySQL

We will create a user named 'user1'. We will add the user to the group 'Demonstration group' so that it inherits all necessary permissions from the group. We start by clicking on Administration > Users > Create user.

How to manage ip addresses and subnets with phpIPAM_MySQL

Now we can log in as this user and add/modify IP addresses under the section 'Our network'.

To sum up, phpIPAM is a versatile IP address management tool that can be used for both IPv4 and IPv6. This tutorial focused on the basics that can help you get started. Be sure to test with all the available features like using IP address calculator, adding devices, VLANs and VRFs, and import/export using xls.

Hope this helps.

How to manage ip addresses and subnets with phpIPAM_MySQLSubscribe to Xmodulo

Do you want to receiveLinux FAQs, detailed tutorials and tipspublished at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
When should you use a composite index versus multiple single-column indexes?When should you use a composite index versus multiple single-column indexes?Apr 11, 2025 am 12:06 AM

In database optimization, indexing strategies should be selected according to query requirements: 1. When the query involves multiple columns and the order of conditions is fixed, use composite indexes; 2. When the query involves multiple columns but the order of conditions is not fixed, use multiple single-column indexes. Composite indexes are suitable for optimizing multi-column queries, while single-column indexes are suitable for single-column queries.

How to identify and optimize slow queries in MySQL? (slow query log, performance_schema)How to identify and optimize slow queries in MySQL? (slow query log, performance_schema)Apr 10, 2025 am 09:36 AM

To optimize MySQL slow query, slowquerylog and performance_schema need to be used: 1. Enable slowquerylog and set thresholds to record slow query; 2. Use performance_schema to analyze query execution details, find out performance bottlenecks and optimize.

MySQL and SQL: Essential Skills for DevelopersMySQL and SQL: Essential Skills for DevelopersApr 10, 2025 am 09:30 AM

MySQL and SQL are essential skills for developers. 1.MySQL is an open source relational database management system, and SQL is the standard language used to manage and operate databases. 2.MySQL supports multiple storage engines through efficient data storage and retrieval functions, and SQL completes complex data operations through simple statements. 3. Examples of usage include basic queries and advanced queries, such as filtering and sorting by condition. 4. Common errors include syntax errors and performance issues, which can be optimized by checking SQL statements and using EXPLAIN commands. 5. Performance optimization techniques include using indexes, avoiding full table scanning, optimizing JOIN operations and improving code readability.

Describe MySQL asynchronous master-slave replication process.Describe MySQL asynchronous master-slave replication process.Apr 10, 2025 am 09:30 AM

MySQL asynchronous master-slave replication enables data synchronization through binlog, improving read performance and high availability. 1) The master server record changes to binlog; 2) The slave server reads binlog through I/O threads; 3) The server SQL thread applies binlog to synchronize data.

MySQL: Simple Concepts for Easy LearningMySQL: Simple Concepts for Easy LearningApr 10, 2025 am 09:29 AM

MySQL is an open source relational database management system. 1) Create database and tables: Use the CREATEDATABASE and CREATETABLE commands. 2) Basic operations: INSERT, UPDATE, DELETE and SELECT. 3) Advanced operations: JOIN, subquery and transaction processing. 4) Debugging skills: Check syntax, data type and permissions. 5) Optimization suggestions: Use indexes, avoid SELECT* and use transactions.

MySQL: A User-Friendly Introduction to DatabasesMySQL: A User-Friendly Introduction to DatabasesApr 10, 2025 am 09:27 AM

The installation and basic operations of MySQL include: 1. Download and install MySQL, set the root user password; 2. Use SQL commands to create databases and tables, such as CREATEDATABASE and CREATETABLE; 3. Execute CRUD operations, use INSERT, SELECT, UPDATE, DELETE commands; 4. Create indexes and stored procedures to optimize performance and implement complex logic. With these steps, you can build and manage MySQL databases from scratch.

How does the InnoDB Buffer Pool work and why is it crucial for performance?How does the InnoDB Buffer Pool work and why is it crucial for performance?Apr 09, 2025 am 12:12 AM

InnoDBBufferPool improves the performance of MySQL databases by loading data and index pages into memory. 1) The data page is loaded into the BufferPool to reduce disk I/O. 2) Dirty pages are marked and refreshed to disk regularly. 3) LRU algorithm management data page elimination. 4) The read-out mechanism loads the possible data pages in advance.

MySQL: The Ease of Data Management for BeginnersMySQL: The Ease of Data Management for BeginnersApr 09, 2025 am 12:07 AM

MySQL is suitable for beginners because it is simple to install, powerful and easy to manage data. 1. Simple installation and configuration, suitable for a variety of operating systems. 2. Support basic operations such as creating databases and tables, inserting, querying, updating and deleting data. 3. Provide advanced functions such as JOIN operations and subqueries. 4. Performance can be improved through indexing, query optimization and table partitioning. 5. Support backup, recovery and security measures to ensure data security and consistency.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool