From ba0dec021aa3fdf43da4d7403e61f1e703ece852 Mon Sep 17 00:00:00 2001 From: Christian Goll Date: Fri, 10 Mar 2023 16:03:18 +0100 Subject: [PATCH] added experimental dnsmasq support Signed-off-by: Christian Goll --- CHANGELOG.md | 1 + overlays/host/dnsmasq.d/ww4-hosts.conf.ww | 30 +++++++++++++++++++++++ userdocs/contents/dnsmasq.rst | 17 +++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 overlays/host/dnsmasq.d/ww4-hosts.conf.ww create mode 100644 userdocs/contents/dnsmasq.rst diff --git a/CHANGELOG.md b/CHANGELOG.md index d9c14ff8..17690640 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - The primary hostname and warewulf server fqdn are now the canonical name in `/etc/hosts` +- Added experimental dnsmasq support. ## [4.4.0] 2023-01-18 diff --git a/overlays/host/dnsmasq.d/ww4-hosts.conf.ww b/overlays/host/dnsmasq.d/ww4-hosts.conf.ww new file mode 100644 index 00000000..a9d6d66f --- /dev/null +++ b/overlays/host/dnsmasq.d/ww4-hosts.conf.ww @@ -0,0 +1,30 @@ +# This file was autgenerated by warewulf +# Host: {{.BuildHost}} +# Time: {{.BuildTime}} +# Source {{.BuildSource}} +{{ nobackup }} +# select the x86 hosts which will get the iXPE binary +dhcp-match=set:x86PC,option:client-arch, 7 #EFI x86-64 +dhcp-match=set:x86PC,option:client-arch, 6 #EFI x86-64 +dhcp-match=set:x86PC,option:client-arch, 9 #EFI x86-64 +{{ with (index $.Tftp.IpxeBinaries "00:07" ) }}dhcp-boot=tag:x86PC,"/warewulf/{{ index $.Tftp.IpxeBinaries "00:07" }}"{{ end }} +dhcp-no-override +# iPXE binary will get the following configuration file +dhcp-userclass=set:iPXE,iPXE +dhcp-boot=tag:iPXE,"http://{{$.Ipaddr}}:{{$.Warewulf.Port}}/ipxe/${mac:hexhyp}" +{{- if $.Tftp.Enabled }} +# also act as tftp server +tftp-root={{ $.Tftp.TftpRoot }} +{{- end }} +# define the the range +dhcp-range={{$.Dhcp.RangeStart}},{{$.Dhcp.RangeEnd}},{{$.Netmask}},6h +{{/* Add all the known hosts */}} +{{- range $node := $.AllNodes}} {{/* for each node */}} +{{- range $devname, $netdev := $node.NetDevs}} {{/* for each network device on the node */}} +{{- if $netdev.Ipaddr.Defined}} {{/* if we have an ip address on this network device */}} +{{- if $netdev.Hwaddr.Defined }} +dhcp-host={{$netdev.Hwaddr.Get}},set:warewulf,{{$node.Id.Get}},{{$netdev.Ipaddr.Get}},infinite +{{- end}} {{/* end if Hwaddr */}} +{{- end}} {{/* end if ip */}} +{{- end}} {{/* end for each network device */}} +{{- end}} {{/* end for each node */}} diff --git a/userdocs/contents/dnsmasq.rst b/userdocs/contents/dnsmasq.rst new file mode 100644 index 00000000..e1b97486 --- /dev/null +++ b/userdocs/contents/dnsmasq.rst @@ -0,0 +1,17 @@ +======= +Dnsmasq +======= + +Usage +===== + +As experimental feature its possible to use `dnsmasq` instead of the ISC `dhcpd` server in combination +with a `tFTP` server. The `dnsmasq` service is then acting as `dhcp` and `tftp` server. In order to keep +the file `/etc/dnsmasq.d/ww4-hosts.conf` is created and must be included in the main `dnsmasq.conf` via +the `conf-dir=/etc/dnsmasq.d` option. + +Addionally in the configuration file `warewulf.conf` in the sections `dhcp` and `tftp` the systemd name of +dnsmasq must set for the option `systemd name`. + +After this configuration steps its recommended to rebuild the host overlay with `wwctl overlay build -H` and +the the services should be configured with `wwctl configure -a`.