Add IPv6 support for dnsmasq

Signed-off-by: Timothy Middelkoop <tmiddelkoop@internet2.edu>
This commit is contained in:
Timothy Middelkoop
2025-11-17 18:03:05 +00:00
parent 463994976e
commit 07eee48a6a
5 changed files with 44 additions and 0 deletions

View File

@@ -22,6 +22,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Use opencontainers/selinux to manage SELinux in wwclient. - Use opencontainers/selinux to manage SELinux in wwclient.
- Replace unused/unneeded IPv6net with IpCIDR6 to align with IPv4 - Replace unused/unneeded IPv6net with IpCIDR6 to align with IPv4
- Add IPv6 DHCP range - Add IPv6 DHCP range
- Add IPv6 functionality for dnsmasq
### Fixed ### Fixed

View File

@@ -20,6 +20,7 @@ func Test_hostOverlay(t *testing.T) {
env.ImportFile("etc/warewulf/nodes.conf", "nodes.conf") env.ImportFile("etc/warewulf/nodes.conf", "nodes.conf")
env.ImportFile("var/lib/warewulf/overlays/host/rootfs/etc/dhcp/dhcpd.conf.ww", "../rootfs/etc/dhcp/dhcpd.conf.ww") env.ImportFile("var/lib/warewulf/overlays/host/rootfs/etc/dhcp/dhcpd.conf.ww", "../rootfs/etc/dhcp/dhcpd.conf.ww")
env.ImportFile("var/lib/warewulf/overlays/host/rootfs/etc/dnsmasq.d/ww4-hosts.conf.ww", "../rootfs/etc/dnsmasq.d/ww4-hosts.conf.ww") env.ImportFile("var/lib/warewulf/overlays/host/rootfs/etc/dnsmasq.d/ww4-hosts.conf.ww", "../rootfs/etc/dnsmasq.d/ww4-hosts.conf.ww")
env.ImportFile("var/lib/warewulf/overlays/host/rootfs/etc/dnsmasq.d/ww4-hosts6.conf.ww", "../rootfs/etc/dnsmasq.d/ww4-hosts6.conf.ww")
env.ImportFile("var/lib/warewulf/overlays/host/rootfs/etc/exports.ww", "../rootfs/etc/exports.ww") env.ImportFile("var/lib/warewulf/overlays/host/rootfs/etc/exports.ww", "../rootfs/etc/exports.ww")
env.ImportFile("var/lib/warewulf/overlays/host/rootfs/etc/hosts.ww", "../rootfs/etc/hosts.ww") env.ImportFile("var/lib/warewulf/overlays/host/rootfs/etc/hosts.ww", "../rootfs/etc/hosts.ww")
env.ImportFile("var/lib/warewulf/overlays/host/rootfs/etc/profile.d/ssh_setup.csh.ww", "../rootfs/etc/profile.d/ssh_setup.csh.ww") env.ImportFile("var/lib/warewulf/overlays/host/rootfs/etc/profile.d/ssh_setup.csh.ww", "../rootfs/etc/profile.d/ssh_setup.csh.ww")
@@ -53,6 +54,13 @@ func Test_hostOverlay(t *testing.T) {
log: host_dnsmasq, log: host_dnsmasq,
header: "", header: "",
}, },
{
name: "host:dnsmasq6",
conf: "warewulf.conf-ipv6",
args: []string{"--render", "host", "host", "etc/dnsmasq.d/ww4-hosts6.conf.ww"},
log: host_dnsmasq6,
header: "",
},
{ {
name: "host:/etc/exports", name: "host:/etc/exports",
conf: "", conf: "",
@@ -271,6 +279,20 @@ dhcp-host=9a:77:29:73:14:f1,set:warewulf,node1,192.168.3.22,infinite
dhcp-host=e6:92:39:49:7b:04,set:warewulf,node2,192.168.3.23,infinite dhcp-host=e6:92:39:49:7b:04,set:warewulf,node2,192.168.3.23,infinite
` `
const host_dnsmasq6 string = `backupFile: false
writeFile: true
Filename: etc/dnsmasq.d/ww4-hosts6.conf
# This file was autgenerated by warewulf
dhcp-range=2001:db8::100,2001:db8::0:1FF,slaac,6h
dhcp-option=option6:bootfile-url,tftp://[2001:db8::1]/
dhcp-option=option6:ntp-server,[2001:db8::1]
dhcp-host=e6:92:39:49:7b:03,set:warewulf,node1,2001:db8::111,infinite
dhcp-host=9a:77:29:73:14:f1,set:warewulf,node1,2001:db8::112,infinite
dhcp-host=e6:92:39:49:7b:04,set:warewulf,node2,2001:db8::121,infinite
`
const host_exports string = `backupFile: true const host_exports string = `backupFile: true
writeFile: true writeFile: true
Filename: etc/exports Filename: etc/exports

View File

@@ -5,13 +5,16 @@ nodes:
device: wwnet0 device: wwnet0
hwaddr: e6:92:39:49:7b:03 hwaddr: e6:92:39:49:7b:03
ipaddr: 192.168.3.21 ipaddr: 192.168.3.21
ip6addr: 2001:db8::111
secondary: secondary:
device: wwnet1 device: wwnet1
hwaddr: 9a:77:29:73:14:f1 hwaddr: 9a:77:29:73:14:f1
ipaddr: 192.168.3.22 ipaddr: 192.168.3.22
ip6addr: 2001:db8::112
node2: node2:
network devices: network devices:
default: default:
device: wwnet0 device: wwnet0
hwaddr: e6:92:39:49:7b:04 hwaddr: e6:92:39:49:7b:04
ipaddr: 192.168.3.23 ipaddr: 192.168.3.23
ip6addr: 2001:db8::121

View File

@@ -0,0 +1,5 @@
ipaddr6: 2001:db8::1/64
dhcp:
enabled: true
range6 start: 2001:db8::100
range6 end: 2001:db8::0:1FF

View File

@@ -0,0 +1,13 @@
# This file was autgenerated by warewulf
{{ nobackup }}
dhcp-range={{$.Dhcp.Range6Start}},{{$.Dhcp.Range6End}},slaac,6h
dhcp-option=option6:bootfile-url,tftp://[{{$.Ipaddr6}}]/
dhcp-option=option6:ntp-server,[{{$.Ipaddr6}}]
{{ range $node := $.AllNodes -}}
{{ range $devname, $netdev := $node.NetDevs -}}
{{ if and $netdev.Ipaddr6 $netdev.Hwaddr -}}
dhcp-host={{$netdev.Hwaddr}},set:warewulf,{{$node.Id}},{{$netdev.Ipaddr6}},infinite
{{ end -}}
{{ end -}}
{{ end -}}