Setting up DNSMasq on Centos 7 is pretty straight forward and can be done in about 10 minutes.
Use case(s):
- You don’t have administrative access to the dhcp server for your subnet/network (such as an ISP run router)
- Your dhcp server is a basic one like what you might find if you use a home class internet router.
Here are the steps needed to setup dnsmasq on your FOG server running under Centos 7
- Ensure that Centos is up to date
yum upgrade -y - Install the service
yum install dnsmasq -y - Create a config file for your FOG server
vi /etc/dnsmasq.d/ltsp.conf
(hint: I’m old school and use vi exclusively, you may use what ever editor you choose) - Paste in the following settings
# 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
pxe-service=X86-64_EFI, "Boot to FOG UEFI", ipxe
pxe-service=BC_EFI, "Boot to FOG UEFI PXE-BC", ipxe
dhcp-range=<fog_server_ip>,proxy
The above values are for BIOS booting via PXE. As of the date of this post, dnsmasq does not support the uefi menu or uefi booting. So for now dnsmasq and uefi are not compatible (as of May16 the devs of dnsmasq have released their first attempt an supporting uefi firmware. I can see great things coming from this).
You must update the <fog_server_ip> values with the exact IP address of your FOG server.
5) Create the needed .0 files. By creating a link each time the undionly file is updated the .0 file will remain current.
ln -s /tftpboot/undionly.kpxe /tftpboot/undionly.0
ln -s /tftpboot/ipxe.efi /tftpboot/ipxe.0
6) Restart the dnsmasq service
systemctl restart dnsmasq.service
7) Then ensure dnsmasq service starts on each boot.
systemctl enable dnsmasq.service
For the copy and paste people like me here is the concise version.
yum upgrade -y
yum install dnsmasq -y
vi /etc/dnsmasq.d/ltsp.conf
<insert text>
<update settings in text>
ln -s /tftpboot/undionly.kpxe /tftpboot/undionly.0
ln -s /tftpboot/ipxe.efi /tftpboot/ipxe.0
systemctl restart dnsmasq.service
systemctl enable dnsmasq.service
