Post Reply 
 
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to chainload ipxe using dnsmasq?
2012-10-12, 20:43 (This post was last modified: 2013-07-02 23:14 by stefanlasiewski.)
Post: #1
How to chainload ipxe using dnsmasq?
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:

Code:
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:

Code:
### Tftp
enable-tftp
tftp-root=/var/lib/tftpboot

dhcp-match=IPXEBOOT,175
dhcp-option=175,8:1:1
# if the request does not (#) match the IPXEBOOT rule tell the client
# (most likely standard PXE client) to boot iPXE
dhcp-boot=tag:#IPXEBOOT,undionly.kpxe

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
Visit this user's website Find all posts by this user
Quote this message in a reply
2012-10-13, 17:13
Post: #2
RE: How to serve serve bootstrap.ipxe via dnsmasq.conf?
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.
Visit this user's website Find all posts by this user
Quote this message in a reply
2013-02-05, 21:51 (This post was last modified: 2013-08-20 21:42 by stefanlasiewski.)
Post: #3
RE: How to serve serve bootstrap.ipxe via dnsmasq.conf?
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/doc...nf.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/ .

Old:
Code:
# Include a another lot of configuration options.
#conf-file=/etc/dnsmasq.more.conf
#conf-dir=/etc/dnsmasq.d

New:

Code:
# Include a another lot of configuration options.
#conf-file=/etc/dnsmasq.more.conf
conf-dir=/etc/dnsmasq.d

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.

Code:
# 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.
interface=eth1
#bind-interfaces
### Don't forget to open the system firewall!

### General DHCP options
# dhcp-ranges for Parallels VM networks.
#dhcp-range=10.211.55.100,10.211.55.110,24
dhcp-range=10.37.129.101,10.37.129.200,24
# Speeds up dhcp, but also dangerous where another dhcp server exists
dhcp-authoritative
# Log lots of extra information about DHCP transactions.
log-dhcp

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

### Tftp Options
enable-tftp
tftp-root=/var/lib/tftpboot
# 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.
tftp-secure

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

Code:
# 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'.
dhcp-boot=tag:!ipxe,undionly.kpxe
# 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
dhcp-boot=http://10.37.129.3/bootstrap.ipxe
# 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
Visit this user's website Find all posts by this user
Quote this message in a reply
2013-02-06, 11:29
Post: #4
RE: How to serve serve ipxe over dnsmasq?
Great writeup, Stefan! Now I have somewhere to point people when they're having problems getting chainloading to work with dnsmasq.
Visit this user's website Find all posts by this user
Quote this message in a reply
2014-05-19, 14:36
Post: #5
RE: How to chainload ipxe using dnsmasq?
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://
ipxe.org/cfg/uint32

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

Any ideas ?
Find all posts by this user
Quote this message in a reply
2016-01-22, 08:36
Post: #6
RE: How to chainload ipxe using dnsmasq?
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.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)