iPXE discussion forum
How to chainload ipxe using dnsmasq? - Printable Version

+- iPXE discussion forum (https://forum.ipxe.org)
+-- Forum: iPXE user forums (/forumdisplay.php?fid=1)
+--- Forum: General (/forumdisplay.php?fid=2)
+--- Thread: How to chainload ipxe using dnsmasq? (/showthread.php?tid=6077)

How to chainload ipxe using dnsmasq? - stefanlasiewski - 2012-10-12 20:43

I am trying to use dnsmasq on my quest for a small, simple bootserver.

I want dnsmasq to tell the clients to load bootstrap.ipxe [1].

With ISC BIND, we use this syntax:

if exists user-class and ( option user-class = "iPXE" ) {
    filename "http://boot.smidsrod.lan/bootstrap.ipxe";
else {
    filename "undionly.kpxe";

But how can we do this with dnsmasq?

I have managed to load undionly.kpxe via dnsmasq. Here is my dnsmasq.conf:

### Tftp

# if the request does not (#) match the IPXEBOOT rule tell the client
# (most likely standard PXE client) to boot iPXE

But I cannot figure out how to tell the client to request bootstrap.ipxe .

Can anyone here help me out?

[1] https://gist.github.com/2234639

RE: How to serve serve bootstrap.ipxe via dnsmasq.conf? - robinsmidsrod - 2012-10-13 17:13

I'm not familiar with dnsmasq, but if you can get it to detect the user-class set to "iPXE" and make it tailor the feedback in that way, you should be set. From what I can see at http://linux.die.net/man/8/dnsmasq it does seem to support some user-class customization.

RE: How to serve serve bootstrap.ipxe via dnsmasq.conf? - stefanlasiewski - 2013-02-05 21:51

I figured out how to do this, and thought I would share. It's actually pretty simple once you understand how the Dnsmasq configuration.

The solution was actually hiding in Simon Kelley's http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq.conf.example , but requires minor changes to work with iPXE. In addition, Simon's example file uses newer Dnsmasq syntax which doesn't work with the default version of Dnsmasq provided with Red Hat Enterprise Linux 6. The other solutions that I found on the internet didn't work for me due to syntax issues.

This test system runs Scientific Linux 6.x (Similar to RHEL6) on a Parallels VM. You'll see the standard Parallels networks down below.

1. Install dnsmasq 2.53 or newer.

2. (optional) Make a quick edit to /etc/dnsmasq.conf to 'include' files under /etc/dnsmasq.d/ .

# Include a another lot of configuration options.


# Include a another lot of configuration options.

3. Modify the following settings in /etc/dnsmasq.conf as needed (Or `/etc/dnsmasq.d/local-settings.conf`, if you prefer the `dnsmasq.d` approach), as needed.

Some of these options assist in debugging.

# If you want dnsmasq to listen for DHCP and DNS requests only on
# specified interfaces (and the loopback) give the name of the
# interface (eg eth0) here.
### Don't forget to open the system firewall!

### General DHCP options
# dhcp-ranges for Parallels VM networks.
# Speeds up dhcp, but also dangerous where another dhcp server exists
# Log lots of extra information about DHCP transactions.

### DNS Options
# For debugging purposes, log each DNS query as it passes through dnsmasq.

### Tftp Options
# Make the TFTP server more secure: with this set, only files owned by
# the user dnsmasq is running as will be send over the net.

4. Here is the magic. Drop the following into /etc/dnsmasq.d/ipxe.conf or the main Dnsmasq configuration file:

# dnsmasq configuration for iPXE
# by stefanl@nersc.gov, 2012-12-01

# Borrowed from http://www.heath-bar.com/projects/blog/?p=326
# and http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq.conf.example

# Important note: The syntax in this file requires dnsmasq 2.53 or above.
# RHEL6 ships with dnsmasq 2.48, which uses older syntax.

### Special DHCP options for iPXE

### Borrowed from http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq.conf.example
# Boot for iPXE. The idea is to send two different
# filenames, the first loads iPXE, and the second tells iPXE what to
# load. The dhcp-match sets the ipxe tag for requests from iPXE.
# Important Note: the 'set:' and 'tag:!ipxe' syntax requires dnsmasq 2.53 or above.
dhcp-match=set:ipxe,175 # iPXE sends a 175 option.
# load undionly.kpxe for clients not tagged with 'ipxe'.
# undionly.kpxe issues a second DHCP request and we then serve bootstrap.ipxe over http
# using Robin Smidsrød's bootstrap method provided at https://gist.github.com/2234639
# Or, simply load your own menu
# dhcp-boot=menu.ipxe

4. A this point, follow Robin Smidsrød's bootstrap method provided at https://gist.github.com/2234639

RE: How to serve serve ipxe over dnsmasq? - robinsmidsrod - 2013-02-06 11:29

Great writeup, Stefan! Now I have somewhere to point people when they're having problems getting chainloading to work with dnsmasq.

RE: How to chainload ipxe using dnsmasq? - TheUltimateUnltd - 2014-05-19 14:36

Hi All,

My setup. Vbox, Dnsmasq, ProxyDHCP

I have an IPXE loop.

Looking in the DHCP config utility gives me

errno uint32 which I cannot find under http://

the internet url under proxy is filled correctly.
but it does not load.

Any ideas ?

RE: How to chainload ipxe using dnsmasq? - robinsmidsrod - 2016-01-22 08:36

TheUltimateUnltd: uint32 is a variable type, not an error. You need to give us the error URL that is shown with the error. A screenshot (or photo) of the screen when you see the error is usually the best.