Skip to content

dhcp server

Thomas Mangin edited this page May 24, 2026 · 5 revisions

Pre-Alpha. This page describes behavior that may change.

DHCP server plugin serving leases to LAN clients per RFC 2131/2132. Address pool with bitmap allocation, lease tracking with expiry timers, full DISCOVER/OFFER/REQUEST/ACK/NAK/RELEASE/DECLINE state machine, static MAC-to-IP mappings, subnet matching for multi-handler dispatch, and support for multiple named address ranges per subnet.

Category

Subsystem.

Configuration

service {
    dhcp-server {
        enabled true;
        listen-interface eth1;

        shared-network lan {
            subnet 192.168.1.0/24 {
                range {
                    start 192.168.1.100;
                    stop 192.168.1.200;
                }
                lease-time 86400;
                default-router 192.168.1.1;
                dns-server 8.8.8.8;
                dns-server 8.8.4.4;
                domain-name example.com;

                static-mapping printer {
                    mac-address aa:bb:cc:dd:ee:ff;
                    ip-address 192.168.1.10;
                }
            }
        }
    }
}

Multiple named ranges

A subnet can define multiple named address ranges for segmented allocation:

shared-network lan {
    subnet 192.168.1.0/24 {
        range clients {
            start 192.168.1.100;
            stop 192.168.1.199;
        }
        range servers {
            start 192.168.1.200;
            stop 192.168.1.250;
        }
    }
}

Each range has an independent bitmap pool. Address allocation prefers the client's last-assigned range.

Configuration reference

Path Type Default Description
dhcp-server/enabled boolean false Enable the DHCP server.
dhcp-server/listen-interface leaf-list -- Interfaces to serve DHCP on.
dhcp-server/shared-network/<name>/subnet/<prefix>/range/start string -- First allocatable address.
dhcp-server/shared-network/<name>/subnet/<prefix>/range/stop string -- Last allocatable address.
dhcp-server/shared-network/<name>/subnet/<prefix>/lease-time uint32 86400 Lease duration in seconds (60-604800).
dhcp-server/shared-network/<name>/subnet/<prefix>/default-router string -- Default gateway (option 3).
dhcp-server/shared-network/<name>/subnet/<prefix>/dns-server leaf-list -- DNS servers (option 6).
dhcp-server/shared-network/<name>/subnet/<prefix>/domain-name string -- Domain name (option 15).
dhcp-server/shared-network/<name>/subnet/<prefix>/static-mapping/<name>/mac-address string -- Client MAC address.
dhcp-server/shared-network/<name>/subnet/<prefix>/static-mapping/<name>/ip-address string -- Fixed IP for this client.

Behaviour

The server binds to the specified interfaces using SO_BINDTODEVICE (Linux). For each DHCPDISCOVER, it finds the matching subnet by comparing the giaddr (relay agent) or the receiving interface's address against configured subnets. Addresses are allocated from the bitmap pool, preferring the client's previously-assigned address if still available.

Static mappings take priority over the dynamic pool. A client whose MAC matches a static mapping always receives that fixed address regardless of the pool state.

Leases are tracked with expiry timers. Expired leases return their address to the pool. The server handles RELEASE and DECLINE messages to free addresses early.

Source

main/internal/plugins/dhcpserver/

Home

About

First Steps

Configuration

Operation

Interfaces

Plugins

Plugin Development

Chaos Testing

Blueprints

Development

Reference

Clone this wiki locally