Skip to content

dhcpd: multiple networks template compilation error #2114

@wrussian

Description

@wrussian

Steps to reproduce

Idea is to use one ww-instance to host two different (some more later) clusters residing in different subnet and VLANs.
I followed the description on https://warewulf.org/docs/v4.5.x/contents/setup.html#multiple-networks
after heading 'multiple networks'.

  1. created the dummy entries for each subnet
  2. ran wwctl overlay edit host etc/dhcpd.conf.ww
    Removed the section:

{{- 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 }}

and added:
{{/* multiple networks */}}
{{- range $node := $.AllNodes}}
{{- if eq $node.Id.Get "deliverynet" }}
{{- range $netname, $netdev := $node.NetDevs}}

network {{ $netname }}

subnet {{$netdev.Tags.network.Get}} netmask {{$netdev.Netmask.Get}} {
max-lease-time 120;
range {{$netdev.Tags.dynstart.Get}} {{$netdev.Tags.dynend.Get}};
next-server {{$netdev.Ipaddr.Get}};
}
{{- end }}
{{- end }}
{{- end }}

  1. saving and 'compiling' shows the warning (error):
    [root@ ~]# wwctl configure dhcp
    Building overlay for mpshead01: host
    WARN : host overlay could not be built: failed to build overlay image directory: failed to render template /install/lib/warewulf/overlays/host/rootfs/etc/dhcp/dhcpd.conf.ww: could not execute template: template: dhcpd.conf.ww:54:15: executing "dhcpd.conf.ww" at <$node.Id.Get>: can't evaluate field Get in type string
    Enabling and restarting the DHCP services

--> although just a warning, a new dhcpd.conf isn't created.

Additionally the line to be added in dhcpd.conf for each non-warewalf node subnet is

option routers 10.233.50.1;

otherwise the iPXE boot stops in my environment after the DHPACK - action on the server node.

The pedestrian approach adding the subnet manually into the template + the option - router line works.

Error message

[root@mpshead01 ~]# wwctl configure dhcp
Building overlay for mpshead01: host
WARN : host overlay could not be built: failed to build overlay image directory: failed to render template /install/lib/warewulf/overlays/host/rootfs/etc/dhcp/dhcpd.conf.ww: could not execute template: template: dhcpd.conf.ww:54:15: executing "dhcpd.conf.ww" at <$node.Id.Get>: can't evaluate field Get in type string

Information on your system

OS : Red Hat Enterprise Linux 9.7
[root~]# cat /etc/os-release
NAME="Red Hat Enterprise Linux"
VERSION="9.7 (Plow)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="9.7"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Red Hat Enterprise Linux 9.7 (Plow)"
ANSI_COLOR="0;31"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:redhat:enterprise_linux:9::baseos"
HOME_URL="https://www.redhat.com/"
DOCUMENTATION_URL="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9"
BUG_REPORT_URL="https://issues.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 9"
REDHAT_BUGZILLA_PRODUCT_VERSION=9.7
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.7"
ww-version : warewulf-4.6.5-1.el9.x86_64
[root ~]# wwctl version
wwctl version: 4.6.5-1
rpc version: apiPrefix:"rc1" apiVersion:"1" warewulfVersion:"4.6.5-1"

go version : go-srpm-macros-3.6.0-11.el9.noarch
golang-src-1.25.7-1.el9_7.noarch
golang-bin-1.25.7-1.el9_7.x86_64
golang-race-1.25.7-1.el9_7.x86_64
golang-1.25.7-1.el9_7.x86_64

General information

  • I have run wwctl version and reported the contents of /etc/os-release
  • I have searched the issues of this repo and believe this is not a duplicate
  • I have captured and reported relevant error messages and logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions