FreeBSD 10 as a PXE Server (dnsmasq)
In my adventures to get a PXE server running, I run into a limitation of the isc-dhcp server - you need to have a host entry for each new machine you want to PXE boot. But this can be a problem if I just want to keep adding machines and PXE booting them. Turns out there's an alternative that's easier to install and configure - dnsmasq.
Dnsmasq can be used as both a DHCP and TFTP server, making administration much easier. Even more importantly, it doesn't have the isc-dhcp limitation of adding an explicit host for each PXE machine.
Note: This guide assumes that you have already set up an NFS server, the NFS export and have copied the contents of the FreeBSD ISO under /nfs_share as per my isc-dhcp notes . Install it with:
pkg install dnsmasq
Make it start on boot:
echo 'dnsmasq_enable="YES"' >> /etc/rc.conf
Move the default configuration file out of the way with:
mv /usr/local/etc/dnsmasq.conf /usr/local/etc/dnsmasq.conf.old
Create a new /usr/local/etc/dnsmasq.conf and add the following: - Note: I left the comments that came with the sample configuration for some parts:
interface=em0 domain=weirdbricks.com # Uncomment this to enable the integrated DHCP server, you need # to supply the range of addresses available for lease and optionally # a lease time. If you have more than one network, you will need to # repeat this for each network on which you want to supply DHCP # service. dhcp-range=192.168.2.100,192.168.2.165,12h # Do the same thing, but using the option name dhcp-option=option:router,192.168.2.99 # The same as above, but use custom tftp-server instead machine running dnsmasq dhcp-boot=boot/pxeboot #note the trailing '/' in the next line: dhcp-option=option:root-path,/nfs_share/ # Enable dnsmasq's built-in TFTP server enable-tftp # Set the root directory for files available via FTP. tftp-root=/nfs_share #log dhcp stuff log-dhcp #set the logfile log-facility=/var/log/dnsmasq.log
Now start dnsmasq:
service dnsmasq start
This is based on the following sources: