In this part we’ll install dnsmasq to augment the information being supplied by the local dhcp server. In many smaller or home locations the dhcp servers that are in use are soho routers that supply internet access as well as dhcp and dns forwarding to the local lan. These soho routers provide the basics of dhcp without the ability to modify some of the dhcp options required for pxe booting. Also if we are using our Pi as a mobile FOG server we can’t rely on the foreign network to have the facilities to support our pxe booting requirements. To that end we will install dnsmasq on our Pi to allow us to manage and supply the missing dhcp information.
To install and configure dnsmasq please do the following.
- Login into the Pi console either directly or via ssh.
- Ensure we have the latest apt cache information and then install dnsmasq
sudo apt-get update
sudo apt-get install dnsmasq
- Now we need to configure our FOG dhcp settings in dnsmasq. Lets create the following file with our favorite text editor.
sudo vi /etc/dnsmasq.d/ltsp.conf
- Insert the following section into the ltsp.conf file.
# Don't function as a DNS server:
port=0
# Log lots of extra information about DHCP transactions.
log-dhcp
# Set the root directory for files available via FTP.
tftp-root=/tftpboot
# The boot filename, Server name, Server Ip Address
dhcp-boot=undionly.kpxe,,<fog_server_IP>
# Disable re-use of the DHCP servername and filename fields as extra
# option space. That's to avoid confusing some old or broken DHCP clients.
dhcp-no-override
# PXE menu. The first part is the text displayed to the user. The second is the timeout, in seconds.
pxe-prompt="Booting FOG Client", 1
# The known types are x86PC, PC98, IA64_EFI, Alpha, Arc_x86,
# Intel_Lean_Client, IA32_EFI, BC_EFI, Xscale_EFI and X86-64_EFI
# This option is first and will be the default if there is no input from the user.
pxe-service=X86PC, "Boot to FOG", undionly
# UEFI is not supported in this version of dnsmasq if it were you
# could uncomment the following line and the ipxe kernel would be delivered
# to uefi clients automatically
#pxe-service=X86-64_EFI, "Boot to FOG UEFI", ipxe
dhcp-range=<fog_server_ip>,proxy
- Edit the above text replacing
<fog_server_ip>
with the IP address of your FOG-Pi server. - Save and exit the text editor
- The dnsmasq group has made pretty good strides with updating dnsmasq to support uefi systems. Unfortunately most linux distributions have not been updated to the latest code released by Simon Kelley. The version of dnsmasq from the Raspbian site is version 2.72 (which is in line with what Debian Jessie ships). The version of dnsmasq that supports uefi systems is 2.76. You must upgrade to 2.76 to support uefi pxe booting. This is not a limitation of FOG but of the version of dnsmasq offered by distribution repositories.
- Now we need to create a symbolic link between the name that dnsmasq sends out and our iPXE kernel. I like to use symbolic links instead of just creating a static copy of these iPXE kernels. This way (with the symbolic link) if the iPXE kernel files get updated so will the files named by dnsmasq.
sudo ln -s /tftpboot/undionly.kpxe /tftpboot/undionly.0
sudo ln -s /tftpboot/ipxe.efi /tftpboot/ipxe.0
- Since Debian Jessie is a sysemd based we need to use systemctl to restart and enable the dnsmasq service.
sudo systemctl restart dnsmasq.service
sudo systemctl enable dnsmasq.service
- To confirm dnsmasq is running in memory we can use the ps command
ps aux|grep dnsmasq
- The output of the above command should look similar to this:
dnsmasq 6340 0.0 0.1 6296 1436 ? S 19:31 0:00 /usr/sbin/dnsmasq -x /var/run/dnsmasq/dnsmasq.pid -u dnsmasq -r /var/run/dnsmasq/resolv.conf -7 /etc/dnsmasq.d,.dpkg-dist,.dpkg-old,.dpkg-new --local-service --trust-anchor=.,19036,8,2,49AAC11D7B6F6446702E54A1607371607A1A41855200FD2CE1CDDE32F24E8FB5
pi 6534 0.0 0.2 4276 1948 pts/0 S+ 19:32 0:00
- We can also confirm that dnsmasq is listening for proxy dhcp requests by running the following command
netstat -an|grep 4011
- The output should look like this
udp 0 0 0.0.0.0:4011 0.0.0.0:*
Now that we’ve confirm that dnsmasq is setup and litening its time to pxe boot our first bios (legacy client)