PiHole DNSmasq PXE

Problem

  • seaBIOS for a VM (RHV) was not picking up the correct TFTP server at PXE time.
  • PiHole was issuing the TFTP server option but it was being ignored.
  • PXE was trying to connect to the DHCP server.

Specifics

  • PiHole 2.5.4
  • DNSmasq 2.76

Solution

The solution is to add TWO COMMAS in the dhcp-boot line.

dhcp-option=066,192.168.0.z
dhcp-boot=pxelinux.0,,192.168.0.z

Edit your specific config file – for example /etc/dnsmasq.d/02-tftp.conf restart the service with pihole restartdns check that you have not put it in the toilet with pihole status (a little red is bad, plenty of green is good) – then retest the PXE.

Diagnose

You can check dhcp lease content using wireshark if you wish – but for most cases this is a little hard core. Nmap can do the job for you – however it doesnt really highlight this issue as such… as its “not there”. This being said – you may find it useful if other parts are not working as intended.

[zeros@home ~]$ sudo nmap -n -sU -p67 --script broadcast-dhcp-discover

The output of this is worthy of note:

Pre-scan script results:
| broadcast-dhcp-discover:
| Response 1 of 1:
| IP Offered: 192.168.0.x
| DHCP Message Type: DHCPOFFER
| Server Identifier: 192.168.0.x
| IP Address Lease Time: 2m00s
| Bootfile Name: pxelinux.0\x00
| Renewal Time Value: 1m00s
| Rebinding Time Value: 1m45s
| Subnet Mask: 255.255.255.0
| Broadcast Address: 192.168.0.255
| Router: 192.168.1.x
| TFTP Server Name: 192.168.0.x\x00
| NetBIOS Name Server: 192.168.0.x
| NTP Servers: 192.168.0.x
| Time Server: 192.168.0.x
| Name Server: 192.168.0.x
| Domain Name Server: 192.168.0.x
| Domain Name: home
| Log Server: 192.168.0.x, 192.168.0.y
|_ Interface MTU: 1
500

Please also note that the additional \x00 at the end of the TFTP Server Name: in no way affect the operation. This is not the issue, although it kept me distracted for long enough.

Story

I have spent far far far far too long today doing this – to have the bittersweet success having realised that this is an issue I have resolved in the past (…and consequently forgotten about until the moment I saw it in front of me).

So to prevent a reoccurrence, and to hopefully hammer it home – here we are. How to get PiHole DNSmasq to issue PXE properly (for at least version 5.2.4).

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: