94 lines
2.6 KiB
Plaintext
94 lines
2.6 KiB
Plaintext
{{if .Dhcp.Enabled -}}
|
|
# This file is autogenerated by warewulf
|
|
# Host: {{.BuildHost}}
|
|
# Time: {{.BuildTime}}
|
|
# Source: {{.BuildSource}}
|
|
|
|
{{if ne .Dhcp.Interface "" -}}
|
|
INTERFACESv4="{{$.Dhcp.Interface}}";
|
|
{{- end}}
|
|
|
|
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;
|
|
|
|
# https://ipxe.org/cfg/syslogs
|
|
{{if ne .Dhcp.Syslog "" -}}
|
|
option log-servers {{$.Dhcp.Syslog}};
|
|
{{end -}}
|
|
{{if ne .Dhcp.Syslogs "" -}}
|
|
option ipxe-encap-opts code 175 = encapsulate ipxe;
|
|
option ipxe.syslogs code 85 = string;
|
|
option ipxe.syslogs "{{$.Dhcp.Syslogs}}";
|
|
{{end -}}
|
|
|
|
option architecture-type code 93 = unsigned integer 16;
|
|
|
|
if exists user-class and option user-class = "iPXE" {
|
|
filename "http://{{$.Ipaddr}}:{{$.Warewulf.Port}}/ipxe/${mac:hexhyp}";
|
|
} else {
|
|
if option architecture-type = 00:0B {
|
|
filename "/warewulf/arm64.efi";
|
|
# } elsif option architecture-type = 00:0A {
|
|
# Still need to add this to staticfiles
|
|
# filename "/warewulf/arm32.efi";
|
|
} elsif option architecture-type = 00:09 {
|
|
filename "/warewulf/x86.efi";
|
|
} elsif option architecture-type = 00:07 {
|
|
filename "/warewulf/x86.efi";
|
|
} elsif option architecture-type = 00:06 {
|
|
filename "/warewulf/i386.efi";
|
|
} elsif option architecture-type = 00:00 {
|
|
filename "/warewulf/i386.kpxe";
|
|
}
|
|
}
|
|
|
|
host {{$.Id}} {
|
|
{{- if ne .Dhcp.Hwaddr ""}}
|
|
hardware ethernet {{$.Dhcp.Hwaddr}};
|
|
{{- end}}
|
|
fixed-address {{$.Ipaddr}};
|
|
option host-name "{{$.Id}}";
|
|
}
|
|
|
|
{{if eq .Dhcp.Template "static" -}}
|
|
subnet {{$.Network}} netmask {{$.Netmask}} {
|
|
next-server {{$.Ipaddr}};
|
|
}
|
|
{{range $nodes := .AllNodes}}
|
|
{{- range $netname, $netdevs := $nodes.NetDevs}}
|
|
host {{$nodes.Id.Get}}-{{if $netdevs.Device.Defined}}{{$netdevs.Device.Get}}{{else}}{{$netname}}{{end}} {
|
|
{{- if $netdevs.Hwaddr.Defined}}
|
|
hardware ethernet {{$netdevs.Hwaddr.Get}};
|
|
{{- end}}
|
|
{{- if $netdevs.Ipaddr.Defined}}
|
|
fixed-address {{$netdevs.Ipaddr.Get}};
|
|
{{- end}}
|
|
{{- if $netdevs.Primary.GetB}}
|
|
option host-name "{{$nodes.Id.Get}}";
|
|
{{else}}
|
|
option host-name "{{$nodes.Id.Get}}-{{if $netdevs.Device.Defined}}{{$netdevs.Device.Get}}{{else}}{{$netname}}{{end}}";
|
|
{{- end}}
|
|
}
|
|
{{end -}}
|
|
{{end -}}
|
|
|
|
{{else -}}
|
|
subnet {{$.Network}} netmask {{$.Netmask}} {
|
|
max-lease-time 120;
|
|
range {{$.Dhcp.RangeStart}} {{$.Dhcp.RangeEnd}};
|
|
next-server {{$.Ipaddr}};
|
|
}
|
|
{{end}}
|
|
|
|
{{- else}}
|
|
{{abort}}
|
|
{{- end}}
|