IPv6: Add dnsmasq non-static config
Signed-off-by: Timothy Middelkoop <tmiddelkoop@internet2.edu>
This commit is contained in:
@@ -53,9 +53,16 @@ func Test_hostOverlay(t *testing.T) {
|
||||
log: host_dnsmasq,
|
||||
header: "",
|
||||
},
|
||||
{
|
||||
name: "host:dnsmasq(static)",
|
||||
conf: "warewulf.conf-static",
|
||||
args: []string{"--render", "host", "host", "etc/dnsmasq.d/ww4-hosts.conf.ww"},
|
||||
log: host_dnsmasq_static,
|
||||
header: "",
|
||||
},
|
||||
{
|
||||
name: "host:/etc/exports",
|
||||
conf: "",
|
||||
conf: "warewulf.conf",
|
||||
args: []string{"--render", "host", "host", "etc/exports.ww"},
|
||||
log: host_exports,
|
||||
header: "",
|
||||
@@ -264,8 +271,6 @@ dhcp-boot=tag:aarch64,"/warewulf/snponly.efi"
|
||||
# iPXE binary will get the following configuration file
|
||||
dhcp-boot=tag:iPXE,"http://192.168.0.1:9873/ipxe/${mac:hexhyp}?assetkey=${asset}&uuid=${uuid}"
|
||||
dhcp-no-override
|
||||
# define the the range
|
||||
dhcp-range=192.168.0.100,192.168.0.199,255.255.255.0,6h
|
||||
|
||||
# IPv6 routing announcements
|
||||
enable-ra
|
||||
@@ -282,6 +287,53 @@ dhcp-option=tag:aarch64,option6:bootfile-url,"tftp://[2001:db8::1]/warewulf/snpo
|
||||
# IPv6 iPXE binary will get the following configuration file
|
||||
dhcp-option=tag:iPXE,option6:bootfile-url,"http://[2001:db8::1]:9873/ipxe/${mac:hexhyp}?assetkey=${asset}&uuid=${uuid}"
|
||||
|
||||
# define the dhcp range
|
||||
dhcp-range=192.168.0.100,192.168.0.199,255.255.255.0,6h
|
||||
dhcp-range=2001:db8::,ra-stateless,64,6h
|
||||
`
|
||||
|
||||
const host_dnsmasq_static string = `backupFile: false
|
||||
writeFile: true
|
||||
Filename: etc/dnsmasq.d/ww4-hosts.conf
|
||||
# This file was autgenerated by warewulf
|
||||
|
||||
# select the x86 hosts which will get the iXPE binary
|
||||
dhcp-match=set:bios,option:client-arch,0 #legacy boot
|
||||
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
|
||||
dhcp-match=set:aarch64,option:client-arch, 11 #EFI aarch64
|
||||
dhcp-match=set:iPXE,77,"iPXE"
|
||||
dhcp-userclass=set:iPXE,iPXE
|
||||
dhcp-vendorclass=set:efi-http,HTTPClient:Arch:00016
|
||||
dhcp-option-force=tag:efi-http,60,HTTPClient
|
||||
# for http boot always use shim/grub
|
||||
dhcp-boot=tag:efi-http,"http://192.168.0.1:9873/efiboot/shim.efi"
|
||||
dhcp-boot=tag:x86PC,"/warewulf/ipxe-snponly-x86_64.efi"
|
||||
dhcp-boot=tag:aarch64,"/warewulf/snponly.efi"
|
||||
# iPXE binary will get the following configuration file
|
||||
dhcp-boot=tag:iPXE,"http://192.168.0.1:9873/ipxe/${mac:hexhyp}?assetkey=${asset}&uuid=${uuid}"
|
||||
dhcp-no-override
|
||||
|
||||
# IPv6 routing announcements
|
||||
enable-ra
|
||||
|
||||
# IPv6 matching (client-arch=61)
|
||||
dhcp-match=set:x86PC,option6:61,0007 # EFI x86-64
|
||||
dhcp-match=set:aarch64,option6:61,0011 # EFI aarch64
|
||||
dhcp-vendorclass=set:x86PC,enterprise:343,PXEClient:Arch:00007 # EFI x86-64
|
||||
dhcp-vendorclass=set:aarch64,enterprise:343,PXEClient:Arch:00011 # EFI aarch64
|
||||
|
||||
# IPv6 bootfile-url (iPXE EFI binary)
|
||||
dhcp-option=tag:x86PC,option6:bootfile-url,"tftp://[2001:db8::1]/warewulf/ipxe-snponly-x86_64.efi"
|
||||
dhcp-option=tag:aarch64,option6:bootfile-url,"tftp://[2001:db8::1]/warewulf/snponly.efi"
|
||||
# IPv6 iPXE binary will get the following configuration file
|
||||
dhcp-option=tag:iPXE,option6:bootfile-url,"http://[2001:db8::1]:9873/ipxe/${mac:hexhyp}?assetkey=${asset}&uuid=${uuid}"
|
||||
|
||||
# define the dhcp range
|
||||
dhcp-range=192.168.0.100,192.168.0.199,255.255.255.0,6h
|
||||
dhcp-range=2001:db8::100,2001:db8::1FF,6h
|
||||
|
||||
# hosts
|
||||
dhcp-host=e6:92:39:49:7b:03,id:00:03:00:01:e6:92:39:49:7b:03,set:warewulf,192.168.3.21,[2001:db8::111],node1,infinite
|
||||
dhcp-host=9a:77:29:73:14:f1,id:00:03:00:01:9a:77:29:73:14:f1,set:warewulf,192.168.3.22,[2001:db8::112],node1,infinite
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
ipaddr: 192.168.0.1/24
|
||||
ipaddr6: 2001:db8::1/64
|
||||
netmask: 255.255.255.0
|
||||
network: 192.168.0.0
|
||||
warewulf:
|
||||
@@ -10,8 +9,11 @@ warewulf:
|
||||
host overlay: true
|
||||
dhcp:
|
||||
enabled: true
|
||||
template: default
|
||||
range start: 192.168.0.100
|
||||
range end: 192.168.0.199
|
||||
range6 start: ""
|
||||
range6 end: ""
|
||||
tftp:
|
||||
enabled: false
|
||||
nfs:
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
ipaddr6: 2001:db8::1
|
||||
prefixlen6: 64
|
||||
dhcp:
|
||||
enabled: true
|
||||
range6 start: 2001:db8::100
|
||||
range6 end: 2001:db8::0:1FF
|
||||
@@ -1,6 +1,8 @@
|
||||
ipaddr: 192.168.0.1/24
|
||||
netmask: 255.255.255.0
|
||||
network: 192.168.0.0
|
||||
ipaddr6: 2001:db8::1/64
|
||||
prefixlen6: 64
|
||||
warewulf:
|
||||
port: 9873
|
||||
secure: false
|
||||
@@ -10,6 +12,10 @@ warewulf:
|
||||
dhcp:
|
||||
enabled: true
|
||||
template: static
|
||||
range start: 192.168.0.100
|
||||
range end: 192.168.0.199
|
||||
range6 start: 2001:db8::100
|
||||
range6 end: 2001:db8::1FF
|
||||
tftp:
|
||||
enabled: false
|
||||
nfs:
|
||||
|
||||
@@ -30,15 +30,9 @@ dhcp-no-override
|
||||
enable-tftp
|
||||
tftp-root={{ $.Tftp.TftpRoot }}
|
||||
{{- end }}
|
||||
{{ if and $.Dhcp.RangeStart $.Dhcp.RangeEnd -}}
|
||||
# define the the range
|
||||
dhcp-range={{$.Dhcp.RangeStart}},{{$.Dhcp.RangeEnd}},{{$.Netmask}},6h
|
||||
{{ end -}}
|
||||
{{ if and $.Dhcp.Range6Start $.Dhcp.Range6End -}}
|
||||
dhcp-range={{$.Dhcp.Range6Start}},{{$.Dhcp.Range6End}},6h
|
||||
{{ end -}}
|
||||
|
||||
{{- if .Ipv6 }}
|
||||
|
||||
# IPv6 routing announcements
|
||||
enable-ra
|
||||
|
||||
@@ -61,6 +55,21 @@ dhcp-option=tag:iPXE,option6:bootfile-url,"http://[{{$.Ipaddr6}}]:{{$.Warewulf.P
|
||||
|
||||
{{- end }}
|
||||
|
||||
# define the dhcp range
|
||||
{{ if and $.Dhcp.RangeStart $.Dhcp.RangeEnd -}}
|
||||
dhcp-range={{$.Dhcp.RangeStart}},{{$.Dhcp.RangeEnd}},{{$.Netmask}},6h
|
||||
{{ else -}}
|
||||
dhcp-range={{$.Network}},static,{{$.Netmask}},6h
|
||||
{{ end -}}
|
||||
{{ if .Ipv6 -}}
|
||||
{{ if and $.Dhcp.Range6Start $.Dhcp.Range6End -}}
|
||||
dhcp-range={{$.Dhcp.Range6Start}},{{$.Dhcp.Range6End}},6h
|
||||
{{ else -}}
|
||||
dhcp-range={{$.Network6}},ra-stateless,{{$.PrefixLen6}},6h
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ if eq .Dhcp.Template "static" }}
|
||||
# hosts
|
||||
{{ range $node := $.AllNodes -}}
|
||||
{{ range $devname, $netdev := $node.NetDevs -}}
|
||||
@@ -68,7 +77,7 @@ dhcp-host=
|
||||
{{- if $netdev.Hwaddr -}}
|
||||
{{$netdev.Hwaddr}},id:00:03:00:01:{{$netdev.Hwaddr}},
|
||||
{{- end -}}
|
||||
set:warewulf,
|
||||
set:{{ $node.Tags.Tag | default "warewulf" }},
|
||||
{{- if $netdev.Ipaddr -}}
|
||||
{{- $netdev.Ipaddr -}},
|
||||
{{- end -}}
|
||||
@@ -78,3 +87,5 @@ dhcp-host=
|
||||
{{$node.Id}},infinite
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{- end -}}
|
||||
|
||||
Reference in New Issue
Block a user