Setting up a PXE server with dnsmasq

Setting up a PXE server on a WD Live NAS to boot Ubuntu 12.04 over a network.

Install dnsmasq:
sudo apt-get install dnsmasq

Set up dnsmasq:
sudo sed -i 's/#conf-dir/conf-dir/' /etc/dnsmasq.conf

And create a file /etc/dnsmasq.d/pxe with the following content:

Make sure the DHCP range is within the same subnet as the IP address of eth0.

Download and extract Ubuntu netboot tarball:
cd /DataVolume/shares/Public/linux/pxe
wget -c
tar xvf netboot.tar.gz -C ubuntupxe

Restart the dnsmasq service and you should be good to go. A machine with MAC address put:an:optional:mac:address:here should get IP and hostname yourhostname and should boot into a Ubuntu menu when it boots from the network.