diff --git a/etc/dhcp/default-dhcpd.conf b/etc/dhcp/default-dhcpd.conf index d9991aca..a4394ea4 100644 --- a/etc/dhcp/default-dhcpd.conf +++ b/etc/dhcp/default-dhcpd.conf @@ -35,6 +35,6 @@ if exists user-class and option user-class = "iPXE" { subnet {{$.Network}} netmask {{$.Netmask}} { range {{$.RangeStart}} {{$.RangeEnd}}; - next-server 192.168.1.1; + next-server {{$.Ipaddr}}; } diff --git a/etc/dhcp/static-dhcpd.conf b/etc/dhcp/static-dhcpd.conf index fb3f18d3..dd306fe1 100644 --- a/etc/dhcp/static-dhcpd.conf +++ b/etc/dhcp/static-dhcpd.conf @@ -34,6 +34,10 @@ if exists user-class and option user-class = "iPXE" { } +subnet {{$.Network}} netmask {{$.Netmask}} { + next-server {{$.Ipaddr}}; +} + {{- range $nodes := .Nodes}} host {{$.Fqdn}} { hardware ethernet {{$nodes.NetDevs.eth0.Hwaddr}} diff --git a/etc/nodes.conf b/etc/nodes.conf index 444d8364..33a32a1c 100644 --- a/etc/nodes.conf +++ b/etc/nodes.conf @@ -19,9 +19,9 @@ control: range end: 192.168.1.250 assign static: false config file: /etc/dhcp/dhcpd.conf - start command: service dhcp start - restart command: killall dhcpd -HUP - enable command: chkconfig dhcp on + start command: systemctl start dhcpd + restart command: systemctl restart dhcpd + enable command: systemctl enable dhcpd tftp: enabled: true tftproot: /var/lib/tftproot diff --git a/internal/app/wwctl/service/dhcp/main.go b/internal/app/wwctl/service/dhcp/main.go index 02dbb841..e73f36d0 100644 --- a/internal/app/wwctl/service/dhcp/main.go +++ b/internal/app/wwctl/service/dhcp/main.go @@ -4,6 +4,7 @@ import ( "fmt" "github.com/brotherpowers/ipsubnet" "github.com/hpcng/warewulf/internal/pkg/node" + "github.com/hpcng/warewulf/internal/pkg/util" "github.com/hpcng/warewulf/internal/pkg/wwlog" "github.com/spf13/cobra" "net" @@ -123,6 +124,9 @@ func CobraRunE(cmd *cobra.Command, args []string) error { os.Exit(1) } + util.ExecInteractive("/bin/sh", "-c", controller.Services.Dhcp.EnableCmd) + util.ExecInteractive("/bin/sh", "-c", controller.Services.Dhcp.RestartCmd) + // Just in case we get here, we've now finished the loop break }