• Recent
    • Unsolved
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Compiling dnsmasq 2.76 if you need uefi support

    Scheduled Pinned Locked Moved
    Tutorials
    4
    15
    11.5k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • george1421G
      george1421 Moderator
      last edited by george1421

      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.

      Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

      1 Reply Last reply Reply Quote 2
      • george1421G
        george1421 Moderator
        last edited by

        (place holder)

        Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

        1 Reply Last reply Reply Quote 0
        • george1421G
          george1421 Moderator
          last edited by

          (place holder)

          Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

          1 Reply Last reply Reply Quote 0
          • george1421G
            george1421 Moderator
            last edited by

            (place holder)

            Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

            1 Reply Last reply Reply Quote 0
            • george1421G
              george1421 Moderator
              last edited by george1421

              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: http://rpm.pbone.net/index.php3/stat/4/idpl/35995670/dir/centos_7/com/dnsmasq-2.76-1cnt7.x86_64.rpm.html

              Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

              1 Reply Last reply Reply Quote 0
              • george1421G
                george1421 Moderator
                last edited by george1421

                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
                  wget http://www.thekelleys.org.uk/dnsmasq/dnsmasq-2.76.tar.gz
                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
                /usr/sbin/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:
                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.

                Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

                1 Reply Last reply Reply Quote 0
                • Wayne WorkmanW
                  Wayne Workman
                  last edited by Wayne Workman

                  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

                  Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!
                  Daily Clean Installation Results:
                  https://fogtesting.fogproject.us/
                  FOG Reporting:
                  https://fog-external-reporting-results.fogproject.us/

                  george1421G 2 Replies Last reply Reply Quote 0
                  • george1421G
                    george1421 Moderator @Wayne Workman
                    last edited by Wayne Workman

                    @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         =
                    RPM_OPT_FLAGS =
                    LIBS          =
                    

                    Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

                    1 Reply Last reply Reply Quote 0
                    • george1421G
                      george1421 Moderator @Wayne Workman
                      last edited by

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

                      Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

                      1 Reply Last reply Reply Quote 0
                      • Wayne WorkmanW
                        Wayne Workman
                        last edited by

                        This has been added to the wiki here:

                        Link

                        Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!
                        Daily Clean Installation Results:
                        https://fogtesting.fogproject.us/
                        FOG Reporting:
                        https://fog-external-reporting-results.fogproject.us/

                        1 Reply Last reply Reply Quote 1
                        • X
                          xerxes2985
                          last edited by

                          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?

                          george1421G 1 Reply Last reply Reply Quote 0
                          • george1421G
                            george1421 Moderator @xerxes2985
                            last edited by

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

                            Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

                            X 1 Reply Last reply Reply Quote 0
                            • X
                              xerxes2985 @george1421
                              last edited by

                              @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.

                              1 Reply Last reply Reply Quote 1
                              • Wayne WorkmanW
                                Wayne Workman
                                last edited by

                                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.
                                

                                Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!
                                Daily Clean Installation Results:
                                https://fogtesting.fogproject.us/
                                FOG Reporting:
                                https://fog-external-reporting-results.fogproject.us/

                                1 Reply Last reply Reply Quote 0
                                • F
                                  Fernando Gietz Developer
                                  last edited by Fernando Gietz

                                  My two cents.

                                  In RHEL7 I have compiled the dnsmasq 0.78 version using these instructions and doing some changes.

                                  Install the necesary packages:

                                  sudo yum install nettle-devel
                                  sudo yum install libidn2-devel
                                  sudo yum install libnetfilter_conntrack-devel
                                  sudo yum install dbus-devel
                                  

                                  config.h options:

                                  /* #define HAVE_LUASCRIPT */
                                  #define HAVE_DBUS
                                  /* #define HAVE_IDN*/
                                  #define HAVE_LIBIDN2
                                  #define HAVE_CONNTRACK
                                  #define HAVE_DNSSEC
                                  

                                  Compiling and starting the service:

                                  sudo make install
                                  sudo systemctl start dnsmasq
                                  sudo systemctl status dnsmasq
                                  

                                  Output:

                                  dnsmasq -v
                                  Dnsmasq version 2.78  Copyright (c) 2000-2017 Simon Kelley
                                  Compile time options: IPv6 GNU-getopt DBus no-i18n IDN2 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 Reply Last reply Reply Quote 1
                                  • 1 / 1
                                  • First post
                                    Last post

                                  170

                                  Online

                                  12.0k

                                  Users

                                  17.3k

                                  Topics

                                  155.2k

                                  Posts
                                  Copyright © 2012-2024 FOG Project