No description
  • PHP 86.9%
  • TypeScript 7.2%
  • Vue 5%
  • CSS 0.4%
  • Shell 0.3%
  • Other 0.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Volker bc9bd93801 docs: add web UI screenshots to README and web UI guide
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 15:09:02 +01:00
bin daemon: add Application wiring, DaemonControl, skydhcpd CLI and example config 2026-11-23 16:08:41 +01:00
docker/php Merge stream skywall-b: shared networks, multi-address ARP responder, BPF via FFI, companion UDP socket 2026-11-24 00:22:15 +01:00
docs docs: add web UI screenshots to README and web UI guide 2026-12-02 15:09:02 +01:00
etc daemon: web_root /opt/skydhcp/web in example config and API docs 2026-11-23 18:57:55 +01:00
packages/reactphp-filesystem-ext build: vendor reactphp-filesystem-ext under packages/ 2026-11-23 19:55:41 +01:00
packaging/systemd daemon: sd_notify readiness and Type=notify-reload 2026-11-23 23:59:25 +01:00
phpstan/stubs transport: kernel BPF filter via ext-ffi and companion UDP socket on raw interfaces 2026-11-24 00:06:25 +01:00
scripts Merge stream skywall-b: shared networks, multi-address ARP responder, BPF via FFI, companion UDP socket 2026-11-24 00:22:15 +01:00
src server: sort ProbeResult imports 2026-11-24 09:30:29 +01:00
tests management: explain unmatched classes in the probe response 2026-11-24 09:29:41 +01:00
web web: keep static-routes and sip-servers options read-only on save 2026-11-24 09:00:43 +01:00
.dockerignore build: vendor reactphp-filesystem-ext under packages/ 2026-11-23 19:55:41 +01:00
.gitignore build: vendor reactphp-filesystem-ext under packages/ 2026-11-23 19:55:41 +01:00
.php-cs-fixer.dist.php Merge main into mgmt stream 2026-11-23 15:44:38 +01:00
AGENTS.md agents: require regular, topic-based commits 2026-11-24 00:22:20 +01:00
CHANGELOG.md docs: describe probe not_matched / not_evaluated and subnet + relay_address 2026-11-24 09:30:01 +01:00
CLAUDE.md foundation: PHP 8.6 toolchain, typed value objects, config model and subsystem contracts 2026-11-23 15:21:04 +01:00
composer.json Merge stream skywall-b: shared networks, multi-address ARP responder, BPF via FFI, companion UDP socket 2026-11-24 00:22:15 +01:00
composer.lock build: vendor reactphp-filesystem-ext under packages/ 2026-11-23 19:55:41 +01:00
LICENSE docs: add MIT license file 2026-11-23 15:35:58 +01:00
phpstan.neon.dist transport: kernel BPF filter via ext-ffi and companion UDP socket on raw interfaces 2026-11-24 00:06:25 +01:00
phpunit.xml.dist daemon: end-to-end tests with real clients in network namespaces 2026-11-23 18:55:28 +01:00
README.md docs: add web UI screenshots to README and web UI guide 2026-12-02 15:09:02 +01:00

SkyDHCP

An asynchronous DHCPv4/DHCPv6 server in modern PHP: persistent leases, raw sockets, relays, live API, HA.


SkyDHCP is a DHCP server for real networks, written in PHP 8.6 on the ReactPHP event loop. It keeps leases durably on disk, talks to clients that do not have an address yet through its own raw AF_PACKET socket (the serving interface needs no IP at all), serves relayed networks with option 82 and RFC 3527 link selection, and can be changed while it runs through an HTTP/JSON management API, a Unix socket, the skydhcpctl CLI and a browser UI. Two nodes form a high-availability pair. Configuration is a single, strictly validated YAML file. The goal is a small, readable, hackable open-source alternative to ISC dhcpd, Kea and dnsmasq for labs, ISPs, data centres and home networks alike.

Status: 1.0.0-dev. Every feature listed below is implemented and covered by unit, integration and network-namespace end-to-end tests, but there is no tagged release yet and the package is not on Packagist. See the changelog and the known gaps.

Features

  • DHCPv4 (RFC 2131/2132): DISCOVER/OFFER/REQUEST/ACK plus NAK, DECLINE, RELEASE and INFORM; INIT-REBOOT, RENEWING and REBINDING handling; T1/T2; PXE (next_server, boot_file); typed custom options with long-option splitting (RFC 3396); reservations by MAC or client identifier (RFC 4361); client identifier echo (RFC 6842).
  • Durable lease store: YAML snapshot generations plus an append-only journal, written non-blocking through libuv and never rewritten in place. A DHCPACK is sent only after the lease is fdatasynced; a torn journal tail is detected on start; a lock file keeps a second daemon off the state directory.
  • Raw AF_PACKET transport: one packet socket per interface with its own Ethernet/IPv4/UDP framing, unicast replies to clients without an address, and an ARP responder so the interface needs no IP address at all. A kernel UDP transport (SO_BINDTODEVICE) is the portable alternative.
  • Relay agents: subnet selection by giaddr, RFC 3527 link selection (82/5) and RFC 3011 subnet selection (option 118), option 82 echo, RFC 5107 server identifier override (82/11), extra relay networks per subnet, hop limit.
  • Conflict detection: optional ICMP echo probe before an unused address is offered; DECLINEd and conflicting addresses are quarantined.
  • DHCPv6 (RFC 8415): IA_NA, IA_PD (prefix delegation), Rapid Commit, Information-request, reservations by DUID, nested relay messages, its own durable YAML lease store.
  • Management API: HTTP/JSON over TCP (bearer tokens stored only as SHA-256, roles read / admin / peer, failed-login rate limit) and a Unix socket; leases, subnets, reservations, full-configuration edit with validation and atomic write-back, reload, interfaces, Prometheus metrics and a server-sent-events lease stream. skydhcpctl is the CLI for it.
  • Web UI: Vue 3 single-page app served by the management API: dashboard with live feed, leases, subnet and reservation editors, interfaces, metrics, HA state, settings and token generator.
  • High availability (DHCPv4): two nodes in hot-standby or load-balancing mode (RFC 3074 buckets), lease replication with partner acknowledgement before DHCPACK, initial sync, heartbeat and unacked-client failure detection, partner-down takeover.
  • Typed YAML configuration: every key validated at load time with path-qualified errors (dhcp4.subnets[0].pools[1]: overlaps pools[0]); skydhcpd --check; hot reload on SIGHUP or through the API.
  • Small attack surface: needs only CAP_NET_RAW and CAP_NET_BIND_SERVICE, hostile-input parsers with fuzz-style tests, per-MAC rate limits on the raw transport, PHPStan level 10, no shell execution, a hardened systemd unit.

Web UI

The built-in web UI (docs/web-ui.md) runs on the management API: live dashboard, lease browser, validating configuration editors, light and dark theme, English and German.

Dashboard with pool usage and the live lease feed

Lease list in the dark theme Subnet editor with client-side validation
Leases (dark theme), rows update live Subnet editor, validated before it is written back

Why another DHCP server?

ISC dhcpd, the workhorse of the last 25 years, reached end of life in 2022. Its successor Kea is powerful but large (C++, hook libraries, separate DDNS daemon, a database for many production set-ups). dnsmasq is wonderful for small networks but deliberately minimal: no failover, no API. SkyDHCP aims at the space in between: a single self-contained daemon with the features operators need most, in a language many network and web teams can read and extend.

SkyDHCP ISC dhcpd ISC Kea dnsmasq
Status pre-release (1.0.0-dev) EOL (2022) active active
Language PHP 8.6 (ReactPHP) C C++ C
DHCPv4 yes yes yes yes
DHCPv6 addresses / prefix delegation yes / yes yes / yes yes / yes yes / no
Lease storage YAML snapshot + fsynced journal leases file memfile (CSV), MySQL, PostgreSQL leases file
Replies to clients without IP raw AF_PACKET raw (LPF/BPF) raw sockets ARP cache injection
Serves an interface without IP yes (own ARP responder) no, needs an address no, needs an address no, needs an address
Option 82 / RFC 3527 link selection yes / yes yes / yes yes / yes option 82 matching (dhcp-circuitid, dhcp-remoteid)
Client classes, conditional options no yes yes yes (tags)
Shared networks (several subnets on one link) yes (interfaces[].addresses, per-subnet server identifier) yes yes yes
High availability 2 nodes, hot-standby / load-balancing, DHCPv4 only failover protocol (DHCPv4 only) HA hook (hot-standby, load-balancing, passive-backup; v4 and v6) none
Live changes without restart HTTP/JSON API, Unix socket, CLI, SIGHUP OMAPI control API (config-set, lease commands) SIGHUP re-reads hosts files
Metrics Prometheus (built in) none statistics via API; Prometheus via Stork none
Web UI built in none Stork (separate) none
Dynamic DNS updates no yes yes (kea-dhcp-ddns) own DNS server
Configuration typed YAML custom syntax JSON key/value

The table reflects our understanding of the upstream projects; corrections are welcome. A detailed feature matrix and migration notes from dhcpd.conf and dnsmasq are in docs/comparison.md.

Known gaps

Deliberately or not yet covered, so you can decide before you try it:

  • no dynamic DNS updates by design: option 81 / option 12 only set the lease host name (hostname_source); DNS registration is left to consumers of the SSE event stream. No DHCPv6 Reconfigure, no client classes or per-client option sets, no plain BOOTP;
  • HA covers DHCPv4 only; DHCPv6 leases are neither replicated nor exposed by the management API;
  • no SQL lease backends by design: the only persistent backend is the fsynced YAML store (there is no non-blocking ReactPHP driver the project wants to depend on);
  • no lease import from ISC dhcpd / dnsmasq lease files;
  • no built-in TLS for the management API (use a reverse proxy or SSH tunnel);
  • skydiablo/reactphp-filesystem-ext is vendored in packages/reactphp-filesystem-ext (Composer path repository) until it is published on Packagist (see below).

Quick start (Docker)

git clone https://codeberg.org/volker.von.hoesslin/reactphp-dhcp-server.git skydhcp
cd skydhcp
docker build -f docker/php/Dockerfile --target runtime -t skydhcp .

SkyDHCP's file I/O library skydiablo/reactphp-filesystem-ext is not on Packagist yet: a copy of it is vendored in packages/reactphp-filesystem-ext and composer.json pulls it in through a path repository, so a plain checkout (or git archive) builds on its own. packages/reactphp-filesystem-ext/VENDORED.md records the source commit; scripts/vendor-fsext.sh refreshes it.

Create skydhcp.yaml (a fully commented example is etc/skydhcp.example.yaml):

server:
  node: dhcp-a
interfaces:
  - name: eth1                # interface facing the clients
    transport: raw            # default; works without an IP on eth1
    address: 10.0.0.1         # server identifier (option 54)
lease_store:
  backend: yaml
  path: /var/lib/skydhcp
dhcp4:
  subnets:
    - id: lan
      network: 10.0.0.0/24
      interface: eth1
      pools: ["10.0.0.100-10.0.0.199"]
      routers: [10.0.0.1]
      dns_servers: [10.0.0.1]
      domain_name: lan.example
      reservations:
        - { mac: "02:00:00:00:00:50", address: 10.0.0.50, hostname: printer }

Validate it, then run the daemon on the host network with only the two capabilities it needs:

docker run --rm -v "$PWD/skydhcp.yaml:/etc/skydhcp/skydhcp.yaml:ro" skydhcp \
  --check --config /etc/skydhcp/skydhcp.yaml

docker run -d --name skydhcp --network host \
  --cap-drop ALL --cap-add NET_RAW --cap-add NET_BIND_SERVICE \
  -v "$PWD/skydhcp.yaml:/etc/skydhcp/skydhcp.yaml:ro" \
  -v skydhcp-leases:/var/lib/skydhcp \
  skydhcp
docker logs -f skydhcp

The image's entrypoint is php /opt/skydhcp/bin/skydhcpd with default arguments --config /etc/skydhcp/skydhcp.yaml; it also contains the built web UI in /opt/skydhcp/web (enable it with management.web_root, see docs/web-ui.md).

Next steps: Getting started (Composer install, a test lab with a veth pair and udhcpc), the configuration reference and operations (systemd, reload, backups, monitoring).

Documentation

Topic
Getting started Docker, Composer, a test lab in a network namespace
Configuration Every YAML key with type, default and validation rule
Architecture Components, packet flow, lease lifecycle, persistence guarantees
Raw sockets Why AF_PACKET, RFC 2131 §4.1 delivery rules, ARP responder, capabilities
Relay agents giaddr, option 82, RFC 3527 / 5107, relay examples
High availability Hot-standby, load-balancing, failure scenarios
Management API HTTP/JSON API, tokens, metrics, SSE, skydhcpctl
Web UI Browser UI for configuration and live monitoring
DHCPv6 IA_NA, IA_PD, relays, limitations
Security Threat model, mitigations, hardening
Operations systemd, reload, backups, monitoring, firewall
Comparison and migration Feature matrix, moving from ISC dhcpd or dnsmasq
Development Repository layout, toolchain, tests, coding rules
Brand Logo, colours, usage

The full map is in docs/index.md.

Development

Everything runs in Docker; the host needs no PHP.

scripts/dev.sh composer install          # any command inside the PHP 8.6 dev image
scripts/dev.sh vendor/bin/phpunit --filter Lease
SKYDHCP_PRIVILEGED=1 scripts/dev.sh bash  # with NET_ADMIN/NET_RAW for veth / raw-socket work
scripts/gate.sh                          # composer validate, php-cs-fixer, PHPStan 10, PHPUnit, web UI
scripts/e2e.sh                           # end-to-end suite in network namespaces (privileged container)

scripts/gate.sh must be green before anything is merged. See docs/development.md and the contributor guide AGENTS.md.

License

MIT, see LICENSE. © Volker von Hoeßlin and contributors.

Credits

  • ReactPHP for the event loop, sockets, HTTP server and promises.
  • Symfony YAML for configuration parsing.
  • The authors of RFC 2131, 2132, 3046, 3074, 3527, 5107 and 8415, and the ISC dhcpd, Kea and dnsmasq projects, whose decades of operational experience shaped this design.