Setting up Dnsmasq DHCP for PXE Booting - Vendor Class Matching

Started by rkubes, May 15, 2025, 05:59:03 AM

Previous topic - Next topic



TL;DR : Opnsense UI should support NEGATING dnsmasq tags.

Hi there I have an iPXE setup for which I have this setup (this config is generated by opnsense, I just replaced tag uuids with readable names for ease of reading)  :


dhcp-match=set:ipxe,77,iPXE
dhcp-match=set:bios,93,0
dhcp-match=set:efi,93,7

dhcp-boot=tag:efi,ipxe.efi,192.168.1.1,192.168.1.1
dhcp-boot=tag:ipxe,http://192.168.1.1:8080/boot.ipxe,192.168.1.1,192.168.1.1
dhcp-boot=tag:bios,undionly.kpxe,192.168.1.1,192.168.1.1



However, this means that when iPXE is making the request, two dhcp-boot rules will match since iPXE matches both 93=7 and 77=iPXE .

Then dnsmasq behavior seems to be undefined and takes any of the matching rule at random.

To fix this, dnsmasq supports negating tags, which would allow me to set the efi line like this :


dhcp-boot=tag:efi,tag:!ipxe,ipxe.efi,192.168.1.1,192.168.1.1



But the opnsense UI does not seem to support it.

For now I'll fall back on putting my settings in /usr/local/etc/dnsmasq.conf.d/pxe.conf . It works fine.

For reference, here is the final content of the custom file :


# /usr/local/etc/dnsmasq.conf.d/pxe.conf
dhcp-match=set:ipxe,77,iPXE
dhcp-match=set:bios,93,0
dhcp-match=set:efi,93,7

dhcp-boot=tag:efi,tag:!ipxe,ipxe.efi,192.168.1.1,192.168.1.1
dhcp-boot=tag:ipxe,http://192.168.1.1:8080/boot.ipxe,192.168.1.1,192.168.1.1
dhcp-boot=tag:bios,undionly.kpxe,192.168.1.1,192.168.1.1