Install DNSMasq on Centos 7

  • Moderator

    Setting up DNSMasq on Centos 7 is pretty straight forward and can be done in about 10 minutes.

    Use case(s):

    1. You don’t have administrative access to the dhcp server for your subnet/network (such as an ISP run router)
    2. 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

    1. Ensure that Centos is up to date
      yum upgrade -y
    2. Install the service
      yum install dnsmasq -y
    3. 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)
    4. Paste in the following settings
    # 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.
    # 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

    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

  • This has been added to the wiki here:


  • @george1421 Yeah, I can go with that.

  • Moderator


    So do you think you need two wiki pages? One would be the theory and details behind dnsmasq (such as the current wiki page [that is titled a bit complex]) and then a short one (akin to this tutorial. click this, edit that, paste this, start it up. For the ones who don’t care why it works, they just want something [anything] to work so they can get on with their life).

  • @george1421 Yes, you are a wordy son of a gun.

    But, if you look at the existing wiki article about dnsmasq, it’s sort of a disaster - and epically long.

    The length alone is a turn-off.

    I think this is why my Troubleshoot TFTP article isn’t so popular. Too long.

  • Moderator

    @Wayne-Workman said in Install DNSMasq on Centos 7:

    wiki worthy

    … This is nice and short too.

    Are you implying I can be a bit wordy in my posts?

  • wiki worthy

    I’m working on a new dnsmasq article, it’s nice not to have to look up everything. This is nice and short too.