Skip to content

A Python interface to manage IP addresses in phpIPAM through REST API, with integration to ISC-DHCP

License

Notifications You must be signed in to change notification settings

pvrmza/dhcp2phpipam

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dhcp2phpipam

A Python interface to manage IP addresses in phpIPAM through REST API, with integration to ISC-DHCP

phpIPAM is an open-source web IP address management application. Its goal is to provide light and simple IP address management application.

Site: phpIPAM homepage

phpIPAM logo

Usage

Add IP Adreess

	./dhcp2phpipam.py add ClientIP ClientDHCID ClientName RouterIP

Where:

  • ClientIP : Host IP address
  • ClientDHCID : Host MAC Address
  • ClientName : Hostname
  • RouterIP : RouterIP is required to determine the subnet in which the ClientIP should be added. ClientIP is added on the same subnet where RouterIP is located. It can be the IP of the gateway of the subnet or some other reference IP in that subnet

Update IP Adreess

	./dhcp2phpipam.py update ClientIP ClientDHCID ClientName

Delete IP Adreess

	/dhcp2phpipam.py del ClientIP

Installation with ISC-DHCP in Ubuntu

  1. Install packages
	pip install requests

or

	sudo apt update && sudo apt install python-requests libssl-dev
  1. Create directory /etc/dhcp/dhcpd-hooks.d/

  2. Download and copy dhcp2phpipam.py in /etc/dhcp/dhcpd-hooks.d/

  3. Edit dhcp2phpipam.py and set phpIPAM url, api name and api token

	phpipam_url = 'https://phpipam.local'
	api_id = 'your_api_name'
	api_token = 'your_api_key'
  1. Set execute permission on dhcp2phpipam.py
	chmod +x `/etc/dhcp/dhcpd-hooks.d/dhcp2phpipam.py`
  1. Download and copy usr.sbin.dhcpd in: /etc/apparmor.d/local/ and restart apparmor service

  2. Create directory /etc/dhcp/dhcpd.conf.d/

  3. Download and copy dhcpd-event.conf in /etc/dhcp/dhcpd.conf.d/

  4. Edit /etc/dhcp/dhcpd.conf and include dhcpd-event.conf with trigers update

	include "/etc/dhcp/dhcpd.conf.d/dhcpd-event.conf";
  1. Restart DHCP Server

  2. Enjoy

Other API clients

About

A Python interface to manage IP addresses in phpIPAM through REST API, with integration to ISC-DHCP

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages