2020-11-13 21:11:56 +00:00
|
|
|
#dhcpd.conf
|
|
|
|
|
2020-11-13 22:30:21 +00:00
|
|
|
<%
|
|
|
|
import re
|
|
|
|
%>
|
2020-11-13 21:11:56 +00:00
|
|
|
ddns-update-style none;
|
|
|
|
|
|
|
|
authoritative;
|
|
|
|
|
|
|
|
% for identfier, subnet in dhcp_config.get('subnets', {}).items():
|
|
|
|
subnet ${subnet['subnet']} netmask ${subnet['netmask']} {
|
|
|
|
% if subnet.get('range_lower', None) and subnet.get('range_higher', None):
|
|
|
|
range ${subnet['range_lower']} ${subnet['range_higher']};
|
|
|
|
% endif
|
2020-11-13 22:30:21 +00:00
|
|
|
interface "${subnet['interface']}";
|
2020-11-13 21:11:56 +00:00
|
|
|
default-lease-time ${subnet.get('default-lease-time', 600)};
|
|
|
|
max-lease-time ${subnet.get('max-lease-time', 3600)};
|
|
|
|
% for option, value in sorted(subnet.get('options', {}).items()):
|
2020-11-13 22:30:21 +00:00
|
|
|
% if re.match('([^0-9\.,\ ])', value):
|
|
|
|
option ${option} "${value}";
|
|
|
|
% else:
|
2020-11-13 21:11:56 +00:00
|
|
|
option ${option} ${value};
|
2020-11-13 22:30:21 +00:00
|
|
|
% endif
|
2020-11-13 21:11:56 +00:00
|
|
|
% endfor
|
|
|
|
}
|
|
|
|
% endfor
|
|
|
|
|
|
|
|
% for identifier, allocation in dhcp_config.get('fixed_allocations', {}).items():
|
|
|
|
host ${identifier} {
|
|
|
|
hardware ethernet ${allocation['mac']};
|
|
|
|
fixed-address ${allocation['ipv4']};
|
|
|
|
}
|
|
|
|
% endfor
|