[ipxe-devel] iPXE menu-default for different dhcp-ranges

Michael Brown mcb30 at ipxe.org
Wed Jan 27 12:11:43 UTC 2016

On 22/01/16 19:10, Eby, Pete I. wrote:
> I have a dnsmasq related question,though perhaps there is an iPXE
> feature to more directly achieve what I would like.
> I'd like a way to boot nodes in one dnsmasq dhcp-range or network to one
> default iPXE menu-default option, and nodes in another dhcp-range (or
> individually) to another default iPXE menu-default option.
> Alternately, they could boot to different ipxe menus, though I'd like to
> use the same menu (with different default options) if possible.

You can access arbitrary DHCP options in iPXE using numbered settings. 
For example, you could force your DHCP server to hand out site-local 
option 224 and then access this within iPXE as ${224}.

You can combine this with the "choose --default" option to give 
something like:

   choose --default ${224} selection && goto selection

If you don't want to use a dedicated DHCP option and server-side logic, 
then you can do this within the iPXE scripting language using recursive 
variable expansion.  For example, to select a default based on the 
default gateway address:

   set default_192.168.0.1 winpe
   set default_192.168.1.1 fedora7
   set default ${default_${gateway}}

Hope that gives you some ideas.


More information about the ipxe-devel mailing list