Skip to content

nextdhcp/nextdhcp

Repository files navigation

NextDHCP

NextDHCP

Go Report Card GitHub release (latest by date)

A DHCP server that chains middlewares. Similar to Caddy and CoreDNS

NextDHCP is an easy to use and extensible DHCP server that chains plugins. It's based on the Caddy server framework and is thus similar to Caddy and CoreDNS.


Getting Started

The following instructions will get you a local copy of the project for development and testing purposes. For production deployments please refer to the documentation hosted on the project website nextdhcp.io. Note that this project is still in early alpha and may not yet be considered stable.

Prerequisites

In order to install, hack and test NextDHCP you need a working Go environment. Since this project already adapted go modules you should use at least version 1.12. For testing it is also recommended to have at least one virtual machine available.

Installing

If you just want to install NextDHCP without planning to hack around in it's source code the following command should be enough to install it

go get github.com/nextdhcp/nextdhcp

This will install the NextDHCP binary into $GOPATH/bin. If you want to start hacking on the project follow the steps below:

First clone the repository to a folder of your choice

git clone https://github.com/nextdhcp/nextdhcp

Finally, enter the directory and build NextDHCP

cd nextdhcp
go generate ./...
go build -o nextdhcp ./

Usage

Before starting NextDHCP you need to create a configuration file. A typical configuration file for a local subnet can look like this:

192.168.0.100 - 192.168.0.200
lease 1h
option {
    router 192.168.0.1
    nameserver 192.168.0.1
}

Or, if you need to serve multiple subnets or multiple network interfaces you can also use dedicated blocks:

10.0.0.10 - 10.0.0.20 {
    lease 1d
}

192.168.0.1/24 {
    lease 1h
    range 192.168.0.100 192.168.0.200
    option router 192.168.0.1
    next-server 10.1.1.1
}

Place your configuration into a file called Dhcpfile and start NextDHCP as root:

sudo ./nextdhcp 

For a list of supported plugins please checkout the content of the plugin directory.

Plugins

  • log - configure log output and level
  • database - the lease database to use. Defaults to the builtin bbolt
  • ifname - sets the network interface a given subnet should be served on
  • lease - configures the lease time
  • nextserver - advertise a TFTP boot server
  • option - configure any DHCP options
  • ranges - lease IP addresses from pre-defined IP ranges
  • servername - sets the server hostname on DHCP messages
  • static - lease static IP addresses to clients based on their MAC address
  • gotify - send push notifications for IP address leases and DHCP requests via gotify
  • mqtt - extract and publish DHCP request/response information to MQTT

Versioning

We use SemVer for versioning. For all versions available, see the tags on this repository or checkout the release page.

Authors

  • Patrick Pacher - Initial work - ppacher

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Thank you

This project could not have been built without the following libraries or projects. They are either directly used in NextDHCP or provided a lot of inspiration for the shape of the project: