Cookbooks
dhcp
documentation
Dhcp Config

dhcp_config

Back to resource list

Create and manage the main DHCPD configuration. (https://kb.isc.org/docs/isc-dhcp-44-manual-pages-dhcpdconf (opens in a new tab))

Introduced: v7.0.0

Actions

  • :create
  • :delete

Properties

NameTypeDefaultDescriptionAllowed Values
ip_versionSymbol:ipv4Select DHCP or DHCPv6 server to configure:ipv4, :ipv6
config_fileString/etc/dhcp/dhcpd(6).conf'The full path to the DHCP server configuration on disk
cookbookString/etc/dhcp/dhcpd(6).d/classes.dCookbook to source configuration file template from
templateString/etc/dhcp/dhcpd(6).d/classes.dTemplate to use to generate the configuration file
ownerStringPlatform dependantOwner of the generated configuration file
groupStringPlatform dependantGroup of the generated configuration file
modeString'0640'Filemode of the generated configuration file
config_failover_fileString/etc/dhcp/dhcpd.failover.confDHCP failover configuration file path
config_includes_directoryString/etc/dhcp/dhcpd(6).dDirectory to create included configuration files in
lib_dirStringPlatform dependantDHCPD lib directory path
lease_fileStringPlatform dependantDHCPD lease file path
allowArraynil
denyArraynil
ignoreArraynil
parametersArray, HashnilDHCPD global parameters
optionsArray, HashnilDHCPD global options
evalsArraynilDHCPD conditional statements (see dhcp-eval(5))
keysHashnilTSIG keys configuration
zonesHashnilDynamic DNS zone configuration
hooksHashnilServer event action configuration
failoverHashnilDHCP failover configuration
include_filesArraynilAdditional configuration files to include
extra_linesString, ArraynilExtra lines to append to the configuration file
env_fileStringPlatform dependantService environment file, mostly unused by modern distributions
env_file_linesString, ArraynilService environment file lines

Examples

dhcp_config '/etc/dhcp/dhcpd.conf' do
  allow %w(booting bootp unknown-clients)
  parameters(
    'default-lease-time' => 7200,
    'ddns-update-style' => 'interim',
    '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',
    'host-name' => ' = binary-to-ascii (16, 8, "-", substring (hardware, 1, 6))'
  )
  hooks(
    'commit' => ['use-host-decl-names on'],
    'release' => ['use-host-decl-names on']
  )
  include_files [
    '/etc/dhcp/extra1.conf',
    '/etc/dhcp/extra2.conf',
    '/etc/dhcp_override/list.conf',
  ]
  action :create
end
dhcp_config '/etc/dhcp/dhcpd6.conf' do
  ip_version :ipv6
  deny %w(duplicates)
  parameters(
    'default-lease-time' => 7200,
    'ddns-updates' => 'on',
    'ddns-update-style' => 'interim',
    'max-lease-time' => 86400,
    'update-static-leases' => true,
    'one-lease-per-client' => 'on',
    'authoritative' => '',
    'ping-check' => true
  )
  options(
    'dhcp6.name-servers' => '2001:4860:4860::8888, 2001:4860:4860::8844'
  )
  action :create
end