Files
warewulf/overlays/host/rootfs/etc/dhcp/dhcpd.conf.ww
Jonathon Anderson 2e1466fc7e Fix handling of CIDR values in warewulf.conf
- Fixes: #1541
- Fixes: #1594

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2025-02-06 20:46:20 -07:00

78 lines
2.3 KiB
Plaintext

{{ if $.Dhcp.Enabled -}}
# This file is autogenerated by warewulf
allow booting;
allow bootp;
ddns-update-style interim;
authoritative;
option space ipxe;
# Tell iPXE to not wait for ProxyDHCP requests to speed up boot.
option ipxe.no-pxedhcp code 176 = unsigned integer 8;
option ipxe.no-pxedhcp 1;
option space PXE;
option PXE.mtftp-ip code 1 = ip-address;
option PXE.mtftp-cport code 2 = unsigned integer 16;
option PXE.mtftp-sport code 3 = unsigned integer 16;
option PXE.mtftp-tmout code 4 = unsigned integer 8;
option PXE.mtftp-delay code 5 = unsigned integer 8;
option architecture-type code 93 = unsigned integer 16;
{{- if $.Warewulf.GrubBoot }}
if substring (option vendor-class-identifier, 0, 9) = "PXEClient" {
next-server {{ $.Ipaddr }};
if substring (option vendor-class-identifier, 15, 5) = "00000" {
# pure BIOS clients will get iPXE configuration
filename "http://{{$.Ipaddr}}:{{$.Warewulf.Port}}/ipxe/${mac:hexhyp}";
} else {
# EFI clients will get shim and grub instead
filename "warewulf/shim.efi";
}
} elsif substring (option vendor-class-identifier, 0, 10) = "HTTPClient" {
filename "http://{{$.Ipaddr}}:{{$.Warewulf.Port}}/efiboot/shim.efi";
}
{{- else }}
if exists user-class and option user-class = "iPXE" {
filename "http://{{$.Ipaddr}}:{{$.Warewulf.Port}}/ipxe/${mac:hexhyp}?assetkey=${asset}&uuid=${uuid}";
} else {
{{- range $type, $name := $.Tftp.IpxeBinaries }}
if option architecture-type = {{ $type }} {
filename "/warewulf/{{ basename $name }}";
}
{{- end }}
}
{{- end }}
{{- if and .Network .Netmask .Dhcp.RangeStart .Dhcp.RangeEnd }}
subnet {{.Network}} netmask {{.Netmask}} {
max-lease-time 120;
range {{.Dhcp.RangeStart}} {{.Dhcp.RangeEnd}};
next-server {{.Ipaddr}};
}
{{- end }}
{{- if eq .Dhcp.Template "static" }}
{{- range $nodes := $.AllNodes}}
{{- range $netname, $netdevs := $nodes.NetDevs}}
host {{$nodes.Id}}-{{$netname}}
{
{{- if $netdevs.Hwaddr}}
hardware ethernet {{$netdevs.Hwaddr}};
{{- end }}
{{- if $netdevs.Ipaddr}}
fixed-address {{$netdevs.Ipaddr}};
{{- end }}
{{- if $netdevs.Primary}}
option host-name "{{$nodes.Id}}";
{{- end }}
}
{{end -}}{{/* range NetDevs */}}
{{end -}}{{/* range AllNodes */}}
{{end -}}{{/* if static */}}
{{- else}}
{{abort}}
{{- end}}{{/* dhcp enabled */}}