Ubuntu 16.04 LTS based systems
Build system: Mint 18 x64 (Based on Ubuntu 16.04 LTS)
(note the following instructions worked perfectly for Raspbian Jessie which is Debian based)
- First we need to setup our build environment
sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install -y wget libdbus-1-dev libnetfilter-conntrack-dev idn libidn11-dev nettle-dev libval-dev dnssec-tools
- Next we’ll get the source code for dnsmasq 2.76 Note: version 2.77 has been released. I have not tested it yet, but I suspect the same process can be used to compile 2.77 as 2.76
wget http://www.thekelleys.org.uk/dnsmasq/dnsmasq-2.76.tar.gz
- Extract the source code from the tar file
tar -zxf dnsmasq-2.76.tar.gz
- Change into the dnsmasq build directory
cd dnsmasq-2.76
- Lets update a few settings in the config file. I know there are other ways to go about this with command line switches, but I didn’t
sudo vi src/config.h
- Find this section
/* #define HAVE_LUASCRIPT */
/* #define HAVE_DBUS */
/* #define HAVE_IDN */
/* #define HAVE_CONNTRACK */
/* #define HAVE_DNSSEC */
- Paste in these settings just below the above text
#define HAVE_DBUS
#define HAVE_IDN
#define HAVE_IDN_STATIC
#define HAVE_CONNTRACK
#define HAVE_DNSSEC
- Save and exit the config.h file.
- We need to see where the current dnsmasq file is located. (NOTE: Please be sure that dnsmasq has already been installed in your linux distribution to ensure all of the dependences have been installed before we proceed).
which dnsmasq
10 This command should respond with something like this:
# which dnsmasq
/usr/sbin/dnsmasq
- The key bit of info here is that dnsmasq is installed in /usr/sbin. What we need to do is tell the install script to not place the dnsmasq files in the default location (according to dnsmasq of /usr/local/sbin) but to place the files where the distribution dnsmasq put them (/usr/sbin). SO in this case we want to overwrite the dnsmasq binary in /usr/sbin. To do this we need to update the prefix variable in the Makefile (compiler instruction file).
- Since we know where dnsmasq is now, lets go and update the Makefile to reflect the location where we dnsmasq installed.
sudo vi Makefile
- Search for this line and change
PREFIX = /usr/local
# To this
PREFIX = /usr
- Save and exit out of the Makefile
- Lets backup the original dnsmasq executable just in case…
sudo cp /usr/sbin/dnsmasq /usr/sbin/dnsmasq.old
- Ok here’s where we create and install the latest version of dnsmasq
sudo make install
At this point the compiler will dig through the source code and compile the dnsmasq program. Hopefully it will compile and install without errors.
- Once the install is done lets ensure that the right version of dnsmasq is found first in the search path.
- Key in the following
dnsmasq -v
The output should look like this:
Dnsmasq version 2.76 Copyright (c) 2000-2016 Simon Kelley
Compile time options: IPv6 GNU-getopt DBus no-i18n IDN DHCP DHCPv6 no-Lua TFTP conntrack ipset auth DNSSEC loop-detect inotify
This software comes with ABSOLUTELY NO WARRANTY.
Dnsmasq is free software, and you are welcome to redistribute it
under the terms of the GNU General Public License, version 2 or 3.
- Ensure the version displays 2.76 if so you are all set.
- The last and final step is to ensure that the application runs when the service is called.
sudo service dnsmasq restart
- If the service starts correctly (no errors) then you’re done.
- If you question if dnsmasq is running the proper version you can always inspect /var/log/syslog for any dnsmasq error messages.
As a suggestion you should be able to use this configuration for your new version of dnsmasq that is configured for both bios and uefi operations.
# 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
# inspect the vendor class string and match the text to set the tag
dhcp-vendorclass=BIOS,PXEClient:Arch:00000
dhcp-vendorclass=UEFI32,PXEClient:Arch:00006
dhcp-vendorclass=UEFI,PXEClient:Arch:00007
dhcp-vendorclass=UEFI64,PXEClient:Arch:00009
# Set the boot file name based on the matching tag from the vendor class (above)
dhcp-boot=net:UEFI32,i386-efi/ipxe.efi,,<fog_server_IP>
dhcp-boot=net:UEFI,ipxe.efi,,<fog_server_IP>
dhcp-boot=net:UEFI64,ipxe.efi,,<fog_server_IP>
# 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.kpxe
pxe-service=X86-64_EFI, "Boot to FOG UEFI", ipxe.efi
pxe-service=BC_EFI, "Boot to FOG UEFI PXE-BC", ipxe.efi
dhcp-range=<fog_server_ip>,proxy
Don’t forget to replace <fog_server_ip> in the above text with the IP address of your fog server. The tag appears many times.