DHCP Cookbook
(opens in a new tab) (opens in a new tab) (opens in a new tab)
Installs and configures ISC DHCP server in both DHCP and DHCPv6 mode.
- Supports setting up Master/Slave ISC DHCP failover (IPv4 only).
- Includes Support for DDNS
- Includes resources for managing:
- Package installation
- Service configuration and management
- Global configuration
- Hosts
- Groups
- Subnets
- Shared subnets
Version 7.0.0 constitutes a major change and rewrite, please see UPGRADING.md.
Maintainers
This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of Chef cookbook maintainers working together to maintain important cookbooks. If you’d like to know more please visit sous-chefs.org (opens in a new tab) or come chat with us on the Chef Community Slack in #sous-chefs (opens in a new tab).
Platforms
- Debian / Ubuntu
- RHEL/CentOS and derivatives
- Fedora and derivatives
Requirements
- Chef 15.3+
Usage
It is recommended to create a project or organization specific wrapper cookbook (opens in a new tab) and add the desired custom resources to the run list of a node.
Example of a basic server listening on and issuing leases for the subnet 192.0.2.0/24
.
dhcp_install 'isc-dhcp-server'
dhcp_service 'dhcpd' do
ip_version :ipv4
action [:create, :enable, :start]
end
dhcp_config '/etc/dhcp/dhcpd.conf' do
allow %w(booting bootp unknown-clients)
parameters(
'default-lease-time' => 7200,
'max-lease-time' => 86400,
'update-static-leases' => true,
'one-lease-per-client' => true,
'authoritative' => '',
'ping-check' => true
)
options(
'domain-name' => '"test.domain.local"',
'domain-name-servers' => '8.8.8.8, 8.8.4.4'
)
action :create
end
dhcp_subnet '192.0.2.0' do
comment 'Basic Subnet Declaration'
subnet '192.0.2.0'
netmask '255.255.255.0'
options [
'routers 192.168.1.1',
]
pool(
'peer' => '192.168.0.2',
'range' => '192.168.1.100 192.168.1.200'
)
parameters(
'ddns-domainname' => '"test.domain"'
)
end
External Documentation
- https://kb.isc.org/docs/isc-dhcp-44-manual-pages-dhcpdconf (opens in a new tab)
- https://kb.isc.org/docs/isc-dhcp-44-manual-pages-dhcp-options (opens in a new tab)
- https://kb.isc.org/docs/isc-dhcp-44-manual-pages-dhcp-eval (opens in a new tab)
Examples
Please check for more varied working examples in the test cookbook.
Resources
- dhcp_class
- dhcp_config
- dhcp_group
- dhcp_host
- dhcp_package
- dhcp_service
- dhcp_shared_network
- dhcp_subnet
Known Issues
There are some known issues on Ubuntu when apparmor is running which may prevent the service from running properly. Please see the test cookbook for a possible work around that you can apply on your nodes.
Contributors
This project exists thanks to all the people who contribute. (opens in a new tab)
Backers
Thank you to all our backers!
Sponsors
Support this project by becoming a sponsor. Your logo will show up here with a link to your website.