DHCP Config Export

Simple PHP IPAM can generate server-ready DHCP configuration files from your existing subnet and reservation data. Two formats are supported: ISC DHCP (dhcpd.conf) and ISC Kea (JSON).

Contents


Overview

The export is driven by two data sources:

  1. DHCP subnet options — per-subnet fields (routers, DNS servers, domain name, lease times, PXE boot server and filename) stored on the subnets table.
  2. Reservations — address rows in the addresses table where status = reserved and a non-empty MAC address is present.

The export endpoint is export_dhcp.php. It requires a logged-in session with write-role access.


Configuring DHCP options on a subnet

Open Subnets, click the edit (pencil) button on any subnet, and expand the DHCP Options section near the bottom of the drawer. All fields are optional — leave blank to omit that directive from the output.

FieldDHCP directiveKea key
Routers (gateway IPs)option routersoption-data[name=routers]
DNS serversoption domain-name-serversoption-data[name=domain-name-servers]
Domain nameoption domain-nameoption-data[name=domain-name]
Default lease time (seconds)default-lease-timevalid-lifetime
Max lease time (seconds)max-lease-timemax-valid-lifetime
TFTP / next-server (PXE)next-server(set on reservation or global)
Boot filename (PXE)filename(set on reservation or global)

Multiple IPs in Routers and DNS servers should be comma-separated: 10.0.0.1,10.0.0.2.


Reservations

Any address in the subnet with status = reserved and a non-empty MAC address is included as a host reservation. The hostname field (if set) becomes the host identifier in dhcpd.conf; if blank, the IP is used in dotted-hyphen form (e.g. host-10-0-0-5).

To add a reservation:

  1. Go to the subnet's Addresses page.
  2. Add or edit an address, set Status = Reserved, and fill in the MAC field.
  3. The address will appear in the next export.

Exporting the config

Navigate to DHCP Pools (Admin → DHCP Pools). An Export DHCP Config card at the top of the page shows:

  • A checkbox list of all IPv4 subnets (all selected by default).
  • Download dhcpd.conf — downloads the ISC DHCP config for the selected subnets.
  • Download Kea JSON — downloads the Kea 2.x JSON config for the selected subnets.
  • Preview — shows a read-only preview inline without triggering a download.

You can also call the endpoint directly:

GET export_dhcp.php?format=dhcpd
GET export_dhcp.php?format=kea
GET export_dhcp.php?format=dhcpd&subnets=1,3,7
GET export_dhcp.php?format=dhcpd&preview=1

The subnets parameter accepts a comma-separated list of subnet IDs. The preview=1 parameter returns text/plain without Content-Disposition: attachment, suitable for inline display.


Output formats

ISC DHCP (dhcpd.conf)

# Generated by Simple PHP IPAM v3.4.0 on 2026-01-01 12:00:00 UTC
# Subnets: 2

subnet 10.0.0.0 netmask 255.255.255.0 {
  option routers 10.0.0.1;
  option domain-name-servers 8.8.8.8,8.8.4.4;
  option domain-name "example.local";
  default-lease-time 43200;
  max-lease-time 86400;
  next-server 10.0.0.5;
  filename "pxelinux.0";
  host web-server-01 {
    hardware ethernet aa:bb:cc:dd:ee:ff;
    fixed-address 10.0.0.10;
  }
}

subnet 192.168.1.0 netmask 255.255.255.0 {
  option routers 192.168.1.1;
  host host-192-168-1-50 {
    hardware ethernet 11:22:33:44:55:66;
    fixed-address 192.168.1.50;
  }
}

Only directives with non-NULL values are emitted. The file is ready to be dropped into an ISC DHCP server's configuration directory and referenced from dhcpd.conf.

ISC Kea JSON

{
  "Dhcp4": {
    "subnet4": [
      {
        "subnet": "10.0.0.0/24",
        "option-data": [
          { "name": "routers", "data": "10.0.0.1" },
          { "name": "domain-name-servers", "data": "8.8.8.8,8.8.4.4" },
          { "name": "domain-name", "data": "example.local" }
        ],
        "valid-lifetime": 43200,
        "max-valid-lifetime": 86400,
        "reservations": [
          {
            "hw-address": "aa:bb:cc:dd:ee:ff",
            "ip-address": "10.0.0.10",
            "hostname": "web-server-01"
          }
        ]
      }
    ]
  }
}

The output is a valid Kea 2.x Dhcp4 configuration fragment. Merge it into your kea-dhcp4.conf under the "Dhcp4" key, or use it as a standalone file referenced by "config-files".


IPv4 only

The export is limited to IPv4 subnets. IPv6 subnets are silently excluded. IPv6 DHCP (DHCPv6) configuration is not currently supported.


Deployment

ISC DHCP

# Copy the file
cp dhcpd.conf /etc/dhcp/dhcpd.conf

# Validate syntax
dhcpd -t -cf /etc/dhcp/dhcpd.conf

# Reload
systemctl reload isc-dhcp-server

Kea

# Validate the config
kea-dhcp4 -t kea-dhcp4.json

# Reload / restart
systemctl restart kea-dhcp4

Security note

The exported config file contains MAC addresses for every reserved host. MAC addresses are considered personally identifiable information in some jurisdictions. Treat the downloaded file with the same care as other network inventory data — do not commit it to a public repository or transmit it over unencrypted channels.

Access to export_dhcp.php requires a session with write-role access. Unauthenticated requests and read-only users receive a 403 response.