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:
dhcp-range=192.168.1.20,192.168.1.30,12h
dhcp-host=put:an:optional:mac:address:here,192.168.1.21,yourhostname
dhcp-boot=pxelinux.0
enable-tftp
tftp-root=/DataVolume/shares/Public/linux/pxe/ubuntupxe

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 http://us.archive.ubuntu.com/ubuntu/dists/precise-updates/main/installer-i386/current/images/netboot/netboot.tar.gz
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 192.168.1.21 and hostname yourhostname and should boot into a Ubuntu menu when it boots from the network.