Tech/Protocols/DHCP
Jump to navigation
Jump to search
Dynamic Host Configuration Protocol (DHCP)
Open Source Software - Servers
dnsmasq
- License: GPL
- Source Code: https://thekelleys.org.uk/gitweb/?p=dnsmasq.git;a=summary
- Homepage: https://thekelleys.org.uk/dnsmasq/doc.html
- Manual: https://thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html
- Configuration File: https://thekelleys.org.uk/dnsmasq/docs/dnsmasq.conf.example
ISC DHCP
ISC Kea DHCP
- License: MPL2.0 (Some ISC Kea extensions are NOT Open Source)
- Source Code: https://gitlab.isc.org/isc-projects/kea
- Homepage: https://www.isc.org/kea/
- Documentation: https://kea.readthedocs.io/en/latest/arm/config.html
udhcpd
dhcpy6d
coredhcp-server
freeradius-dhcp
wide
Open Source Software - Clients
- coredhcp-client
- isc-dhcp-client
- udhcpc
- wide https://sourceforge.net/projects/wide-dhcpv6/
Open Source Software - Tools
Configuration
Simple DHCP Setup
Assuming a 192.168.100.0 network with a 24 or 255.255.255.0 netmask and gateway at 192.168.100.1
Simple dnsmasq
dnsmasq is easy to configure via the configuration file but I wanted to show that it can be done via CLI first. The -C /dev/null is to cancel out the configuration file for a demo.
docker run -d --cap-add=NET_ADMIN --name=dnsmasqtest debian:stable-slim docker attach dnsmasqtest dnsmasq -d -C /dev/null -p 0 -F 192.168.100.2,192.168.100.254 --dhcp-option=3,192.168.100.1 dnsmasq: started, version 2.89 DNS disabled dnsmasq: compile time options: IPv6 GNU-getopt DBus no-UBus i18n IDN2 DHCP DHCPv6 no-Lua TFTP conntrack ipset nftset auth cryptohash DNSSEC loop-detect inotify dumpfile dnsmasq-dhcp: DHCP, IP range 192.168.100.2 -- 192.168.100.254, lease time 1h exit
With a config file the /etc/dnsmasq.conf might look like:
docker attach dnsmasqtest cat /etc/dnsmasq.d/test.conf port=0 dhcp-range=192.168.100.2,192.168.100.254,12h dhcp-option=3,1.2.3.4 dhcp-option=option:router,192.168.100.1 dnsmasq -d -C /etc/dnsmasq.d/test.conf dnsmasq: started, version 2.89 DNS disabled dnsmasq: compile time options: IPv6 GNU-getopt DBus no-UBus i18n IDN2 DHCP DHCPv6 no-Lua TFTP conntrack ipset nftset auth cryptohash DNSSEC loop-detect inotify dumpfile dnsmasq-dhcp: DHCP, IP range 192.168.100.2 -- 192.168.100.254, lease time 12h exit
Simple Kea
{"Dhcp4": { "interfaces-config": {"dhcp-socket-type": "udp"}, "subnet4": [ { "subnet": "192.168.100.0/24", "pools": [ { "pool": "192.168.100.2 - 192.168.100.254" } ], "option-data": [{ "name": "routers", "data": "192.0.2.1" }] } ] } }