Running phpIPAM on Docker to Automate LAN IP Address Management

Building phpIPAM with Docker for Automated LAN IP Address Management

* This page contains promotional content

The IP address ledger I had been keeping in GoogleSpreadSheet was no longer keeping up as the number of devices grew.
The IP addresses actually in use and what the sheet said drifted apart more and more, and I was reaching the limit of taking stock by hand, so I decided to start phpIPAM with Docker and move IP management there.


Starting it with Docker

I settled on the following docker-compose.yml.

version: '3.7'
services:
  phpipam-web:
    image: phpipam/phpipam-www:latest
    ports:
      - "8054:80"
    environment:
      - TZ=Asia/Tokyo
      - IPAM_DATABASE_HOST=phpipam-mariadb
      - IPAM_DATABASE_PASS=my_secret_phpipam_pass
      - IPAM_DATABASE_WEBHOST=%
 #     - IPAM_DISABLE_INSTALLER=1
    restart: unless-stopped
    volumes:
      - phpipam-logo:/phpipam/css/images/logo
    depends_on:
      - phpipam-mariadb
  phpipam-cron:
    image: phpipam/phpipam-cron:latest
    environment:
      - TZ=Asia/Tokyo
      - IPAM_DATABASE_HOST=phpipam-mariadb
      - IPAM_DATABASE_PASS=my_secret_phpipam_pass
      - SCAN_INTERVAL=1h
    restart: unless-stopped
    depends_on:
      - phpipam-mariadb
  phpipam-mariadb:
    image: mariadb:latest
    environment:
      - MYSQL_ROOT_PASSWORD=my_secret_mysql_root_pass
    restart: unless-stopped
    volumes:
      - phpipam-db-data:/var/lib/mysql
volumes:
  phpipam-db-data:
  phpipam-logo:

Since the premise is that it is only used inside the LAN, I left it on an http connection.
I set the port number to 8054.


Installation

After starting it with docker compose up -d, accessing http://<ip>:8054 brings up the installer.

  • At install time, log in with root / my_secret_phpipam_pass (the value given to IPAM_DATABASE_PASS)
  • For the DB settings, choose Auto
  • For Site URL, enter http://<ip>:8054

Once the installation finishes successfully, uncomment the IPAM_DISABLE_INSTALLER=1 line in docker-compose.yml to enable it again, and restart the container. Leaving the installer open means it can be reached when there is no need for it, so close it once you are done.


Configuration

phpIPAM server settings

In the server settings of the admin page, I changed the following.

ItemValue
Site DomainChanged from domain.local to my own domain
Default LanguageJapanese
Admin mailThe administrator’s email address
DNS serverPointed at my own DNS setup (Pi-hole)

My Account

Separately from the server settings, you also need to change Default Language to Japanese on your own account settings side. It is an item independent of the system-wide language setting, so if you overlook it, only your own view stays in English.


Subnet management

I added a subnet from the Customers section.

ItemValue
Subnet192.168.1.0/24
Check hosts statusYes
Discover new hostsYes

How I use it

When you run a scan against the subnet you added, the IP addresses actually in use are detected and registered automatically.
After that, all you have to do is record details such as the purpose and hostname for each registered IP address.

If you want to edit several IP addresses at once, export them from “Import/Export” in the admin page. Set the data set to “IP addresses” and check the items you want to export, and it writes them out in a format you can edit in a spreadsheet program such as Excel. Save the result as CSV after editing and import it from the same screen to apply it.


Summary

I moved from managing things by hand in GoogleSpreadSheet to a phpIPAM setup on Docker.
Just registering the subnets and letting the scan run detects the IP addresses in use automatically, so there is less effort spent worrying about drift between reality and the ledger. Bulk editing is handled by CSV import/export, so migrating from the existing sheet was not that much work either.

See also