Compiling dnsmasq 2.76 if you need uefi support

  • Moderator

    There has been a brilliant bit of code added to dnsmasq 2.76 (May 2016) to provide / fix support for sending uefi boot information to uefi systems. The issue is that most linux distributions do not have this latest version of dnsmasq available for install. It may take quite a while to get this version into the mainstream linux distributions. As always the case with FOSS environments you can download and compile your own software as long as the author releases the source code.

    In this tutorial I’ll outline the steps required to compile and install this latest version of dnsmasq for common distributions of linux. I don’t have access to every version and/or flavor so I’ll only document what I’ve personally perform. I would encourage other, that can, document their experiences here with flavors/versions of linux that I don’t cover.

    Before you compile this updated version of dnsmasq be sure that you install the version of dnsmasq from your linux distributions, package repository. This way you will be sure that all of the supporting scripts and dependences have been installed. In the steps below we will just replace the dnsmasq binary with the latest compiled version.

  • So, Ubuntu 16’s default repository is now 1 point away from dnsmasq version 2.76.
    As soon as all of the major distributions are including 2.76 in their default update repositories, then compiling your own will mostly be un-needed, and this will also greatly simplify the process of adding UEFI support to the MakeFogMobile project which utilizes dnsmasq.

    dnsmasq -v
    Dnsmasq version 2.75  Copyright (c) 2000-2015 Simon Kelley
    Compile time options: IPv6 GNU-getopt DBus 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.

  • @george1421 I got it working. My issue was that I erased some lines of code in the “vi src/config.h” portion of the when trying to edit in vim (I wasn’t sure how to edit the file in vim). Once I unpackaged the tarball again, I was able to get it compiled.

    Thanks for responding.

  • Moderator

    @xerxes2985 What linux OS are you trying to compile this under?

  • I get the following error when trying to “Make install”

    make[1]: *** [cache.o] error 1
    /root/fogproject/bin/dnsmasq-2.76/Makefile:157: recipe for target ‘cache.o’ failed
    make[1]: Leaving directory '/root/fogproject/bin/dnsmasq-2.76/src’
    make: *** [all] Error 2
    Makefile:83: recipe for target ‘all’ failed

    any suggestions?

  • This has been added to the wiki here:


  • Moderator

    @Wayne-Workman I updated #11 to hopefully clarify what my intent was.

  • Moderator

    @Wayne-Workman said in Compiling dnsmasq 2.76 if you need uefi support:

    Steps 11 - 13 are confusing to me. You found that your dnsmasq binary is installed at /usr/sbin/dnsmasq but you changed the makefile’s prefix to be /usr

    Also, wiki worthy

    If you looked in the Make file the prefix is the base of where stuff is installed. If you look at the lines just below that you will see that prefix is used for bindir and mandir variables. I use to do this kind of stuff all the time back in the early days (before the internet) so I forget some times that I need to add a bit of detail that I just intrinsically know.

    I needed to find where the current dnsmasq binary file is located, because the default for dnsmasq source code would have been /usr/local/sbin instead of where the distribution package placed it in /usr/sbin. The issue is if I would not have changed this line two dnsmasq binaries would have been installed. Only the search path would determine which one would actually be called when the service started. That is a bit two random for me. So that is why I updated the script to just overwrite the existing dnsmasq program.

    PREFIX        = /usr
    BINDIR        = $(PREFIX)/sbin
    MANDIR        = $(PREFIX)/share/man
    LOCALEDIR     = $(PREFIX)/share/locale
    BUILDDIR      = $(SRC)
    DESTDIR       =
    CFLAGS        = -Wall -W -O2
    LDFLAGS       =
    COPTS         =
    LIBS          =

  • Steps 11 - 13 are confusing to me. You found that your dnsmasq binary is installed at /usr/sbin/dnsmasq but you changed the makefile’s prefix to be /usr

    Also, wiki worthy

  • Moderator

    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)

    1. 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 
    1. 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
    2. Extract the source code from the tar file
      tar -zxf dnsmasq-2.76.tar.gz
    3. Change into the dnsmasq build directory
      cd dnsmasq-2.76
    4. 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
    5. Find this section
    /* #define HAVE_LUASCRIPT */
    /* #define HAVE_DBUS */
    /* #define HAVE_IDN */
    /* #define HAVE_CONNTRACK */
    /* #define HAVE_DNSSEC */
    1. 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
    1. Save and exit the config.h file.
    2. 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
    1. 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).
    2. Since we know where dnsmasq is now, lets go and update the Makefile to reflect the location where we dnsmasq installed.
      sudo vi Makefile
    3. Search for this line and change
    PREFIX        = /usr/local
    # To this
    PREFIX        = /usr
    1. Save and exit out of the Makefile
    2. Lets backup the original dnsmasq executable just in case…
      sudo cp /usr/sbin/dnsmasq /usr/sbin/dnsmasq.old
    3. 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.

    1. Once the install is done lets ensure that the right version of dnsmasq is found first in the search path.
    2. 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.
    1. Ensure the version displays 2.76 if so you are all set.
    2. The last and final step is to ensure that the application runs when the service is called.
      sudo service dnsmasq restart
    3. If the service starts correctly (no errors) then you’re done.
    4. 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:
    # Log lots of extra information about DHCP transactions.
    # Set the root directory for files available via FTP.
    # The boot filename, Server name, Server Ip Address
    # 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.
    # inspect the vendor class string and match the text to set the tag
    # Set the boot file name based on the matching tag from the vendor class (above)
    # 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

    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.

  • Moderator

    If you have Centos 7, there is no direct path to compiling your own version of dnsmasq. I did find a precompiled rpm of dnsmasq 2.76 here:

  • Moderator

    (place holder)

  • Moderator

    (place holder)

  • Moderator

    (place holder)

Log in to reply





Looks like your connection to FOG Project was lost, please wait while we try to reconnect.