Skip to content

Instantly share code, notes, and snippets.

@griznog
Last active April 12, 2024 14:40
Show Gist options
  • Save griznog/219b42e59700469d8df37baf82d6849b to your computer and use it in GitHub Desktop.
Save griznog/219b42e59700469d8df37baf82d6849b to your computer and use it in GitHub Desktop.
DNSMasq conf for warewulf
###########################################################
# Logging, uncomment for troubleshooting.
log-dhcp
# log-queries
log-async=100
# log-debug # Only works with newest dnsmasq.
# Only use one of these.
# Log to syslog
log-facility=DAEMON
# Log to a file
# log-facility=/var/log/dnsmasq.log
# Log to stdout/stderr
# log-facility=-
###########################################################
# DHCP Script options.
dhcp-script=/etc/dnsmasq/scripts/dhcp-script.sh
# script-on-renewal
# script-arp
###########################################################
## TFTP Server
enable-tftp
tftp-max=512
tftp-root=/var/lib/tftpboot/
dhcp-no-override
###########################################################
# Interfaces
# bind-interfaces
###########################################################
## DNS Settings
# TTL
local-ttl=120
# Where do we look things up?
# The local private cluster networks.
server=//
# Public DNS, break glass in case of emergency.
server=8.8.8.8
server=8.8.4.4
server=64.6.64.6
server=64.6.65.6
# Our cluster domain.
domain=cluster
domain=clusternet,100.64.0.0/20
domain=infiniband,100.64.16.0/20
domain=management,100.64.32.0/20
# DNS Settings
no-resolv
localise-queries
cache-size=4096
# Hosts files.
# Add domain to any short names
expand-hosts
# Ignore /etc/hosts
no-hosts
# Get hosts from additional files in this directory
hostsdir=/etc/dnsmasq/dnsmasq.hosts.d
# Use the fqdn in dhcp leases.
dhcp-fqdn
###########################################################
## DHCP Settings
# DHCP Ranges, we are all static. If we don't know you, I
# want you ignored and in the logs as such. Tags make it
# easier to do interesting things based on VLAN membership
# later.
# Cluster Networks
dhcp-range=set:clusternet,100.64.0.0,static,24h
dhcp-range=set:infiniband,100.64.16.0,static,24h
dhcp-range=set:management,100.64.32.0,static,24h
###########################################################
# Specific Options settings for networks
# Option 3 == Router/Gateway
# Option 6 == DNS Server(s)
# Option 42 == NTP Server
dhcp-option=tag:clusternet,3,100.64.15.254
dhcp-option=tag:clusternet,6,100.64.15.254,100.64.15.253
dhcp-option=tag:infiniband,3,100.64.31.254
dhcp-option=tag:infiniband,6,100.64.31.254,100.64.31.253
dhcp-option=tag:management,3,100.64.47.254
dhcp-option=tag:management,6,100.64.47.254,100.64.47.253
# Ignore Unknown Hosts. Ranges being static should cover this, but we double
# down.
dhcp-ignore=tag:#known
###########################################################
## BOOT settings and choices.
# Test for the architecture of a netboot client. PXE clients are
# supposed to send their architecture as option 93. (See RFC 4578)
dhcp-match=set:x86PC, option:client-arch, 0 #BIOS x86
dhcp-match=set:PC98, option:client-arch,1 # NEC/PC98
dhcp-match=set:IA64_EFI, option:client-arch,2 # EFI Itanium
dhcp-match=set:Alpha, option:client-arch,3 # DEC Alpha
dhcp-match=set:Arc_x86, option:client-arch,4 # Arc x86
dhcp-match=set:Intel_Lean_Client, option:client-arch,5 # Intel Lean Client
dhcp-match=set:IA32_EFI, option:client-arch,6 # EFI IA32
dhcp-match=set:BC_EFI, option:client-arch, 7 #EFI x86-64
dhcp-match=set:Xscale_EFI, option:client-arch, 8 # EFI Xscale
dhcp-match=set:X86-64_EFI, option:client-arch, 9 # EFI x86-64
dhcp-match=set:ARM32_EFI, option:client-arch, 10 # Unofficial ARM 32 EFI
dhcp-match=set:ARM64_EFI, option:client-arch, 11 # Unofficial ARM 64 EFI
# This tells PXEClient vendor-class to always encapsulate options in option 43.
# Commented out because I don't think this applies to us anymore.
# dhcp-option=vendor:PXEClient,1,0.0.0.0
##############################################################################################
## Chain load an iPXE stack from either an UEFI or PXE Client. ##
##############################################################################################
## iPXE sends a 175 option, add a tag if we see that. This is how we break out of
## the loop from chain loading iPXE on PXE clients.
dhcp-match=set:iPXE,175
# Rules for x86 (32 bit) PXE clients.
dhcp-boot=tag:!iPXE,tag:x86PC,tag:clusternet,warewulf/i386.kpxe,100.64.15.254,100.64.15.254
dhcp-boot=tag:!iPXE,tag:x86PC,tag:infiniband,warewulf/i386.kpxe,100.64.31.254,100.64.31.254
dhcp-boot=tag:!iPXE,tag:x86PC,tag:management,warewulf/i386.kpxe,100.64.47.254,100.64.47.254
# iPXE stack for EFI x86_64 clients.
dhcp-boot=tag:!iPXE,tag:BC_EFI,tag:clusternet,warewulf/snponly.efi,100.64.15.254,100.64.15.254
dhcp-boot=tag:!iPXE,tag:BC_EFI,tag:infiniband,warewulf/snponly.efi,100.64.31.254,100.64.31.254
dhcp-boot=tag:!iPXE,tag:BC_EFI,tag:management,warewulf/snponly.efi,100.64.47.254,100.64.47.254
##############################################################################################
## Send the option we want the machine to boot with: warewulf ##
##############################################################################################
# Once iPXE calls, we answer...
# Boot with warewulf
dhcp-boot=tag:iPXE,tag:clusternet,tag:warewulf,"http://100.64.15.254:9873/ipxe/${mac:hexhyp}",100.64.15.254,100.64.15.254
dhcp-boot=tag:iPXE,tag:infiniband,tag:warewulf,"http://100.64.31.254:9873/ipxe/${mac:hexhyp}",100.64.31.254,100.64.31.254
dhcp-boot=tag:iPXE,tag:management,tag:warewulf,"http://100.64.47.254:9873/ipxe/${mac:hexhyp}",100.64.47.254,100.64.47.254
###########################################################
# Maximum number of leases to support.
dhcp-lease-max=4096
###########################################################
## Where to find our dhcp host configs.
dhcp-hostsdir=/etc/dnsmasq/dnsmasq.dhcphosts.d
###########################################################
# CNAMES
conf-dir=/etc/dnsmasq/dnsmasq.cnames.d,*.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment