From 4abaa1207a058a70ce76876b709458bab11be2f4 Mon Sep 17 00:00:00 2001 From: Jonathon Anderson Date: Mon, 10 Feb 2025 16:27:13 -0700 Subject: [PATCH] DHCP template generates as much of the subnet and range definition as possible. - Closes: #1469 This makes it possible to disable just the dynamic range without losing access to the next-server required by static host entries. Signed-off-by: Jonathon Anderson --- CHANGELOG.md | 4 ++++ overlays/host/rootfs/etc/dhcp/dhcpd.conf.ww | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4078200e..2ed0c725 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Removed partial support for regex searches in node and profile lists. #1635 +### Changed + +- DHCP template generates as much of the subnet and range definition as possible. #1469 + ## v4.6.0rc2, 2025-02-07 ### Added diff --git a/overlays/host/rootfs/etc/dhcp/dhcpd.conf.ww b/overlays/host/rootfs/etc/dhcp/dhcpd.conf.ww index d9cd43b2..fecb1fed 100644 --- a/overlays/host/rootfs/etc/dhcp/dhcpd.conf.ww +++ b/overlays/host/rootfs/etc/dhcp/dhcpd.conf.ww @@ -46,11 +46,15 @@ if exists user-class and option user-class = "iPXE" { } {{- end }} -{{- if and .Network .Netmask .Dhcp.RangeStart .Dhcp.RangeEnd }} +{{- if and .Network .Netmask }} subnet {{.Network}} netmask {{.Netmask}} { max-lease-time 120; +{{- if and .Dhcp.RangeStart .Dhcp.RangeEnd }} range {{.Dhcp.RangeStart}} {{.Dhcp.RangeEnd}}; +{{- end }} +{{- if .Ipaddr }} next-server {{.Ipaddr}}; +{{- end }} } {{- end }}