Netboot iPXE chainloading dhcp config

i try to setup and ipxe chainloading configuration and have succsefull setup the pxe boot from the turris wiki…
next step would be to configure the ipxe chainloading like explained ln the official ipxe doc here
but i dont know where to put the “if else” directive for the dhcp

my working pxe boot in /etc/config/dhcp looks like this

config boot 'linux'
        option filename 'pxelinux.0'
        option serveraddress '192.168.0.1'
        option servername 'turris'

so where to put?

if exists user-class and option user-class = "iPXE" {
      filename "http://my.web.server/real_boot_script.php";
  } else {
      filename "undionly.kpxe";
  }

help would appreciated
thanks

I’m trying to do the same and looks like it just isn’t supported by openwrt with dnsmasq because dhcp_match is missing in /etc/init.d/dnsmasq.
See https://forum.openwrt.org/t/network-booting-detect-bios-vs-uefi/9952

That always surprised me: why there is /etc/config/ and even some uci tool, but no support for very basic features and tooling done in that way, that it’s impossible to just write a config.

Are there any way to do that?

1 Like

For the record:

dhcp-match=set:ipxe,77,“iPXE”
dhcp-boot=tag:!ipxe,ipxe.efi,ipxe,192.168.1.2
dhcp-boot=http://192.168.1.2/default.ipxe

(It points to a server 192.168.1.2 for loading ipxe.efi via tftp and ipxe config via http, but you can use your router for that if needed).

1 Like

@yorik it seems like in openwrt 21.02 that is TOS6.0 its already supported. Are you still using PXE?

I would like to achieve similar goal. Do you mind helping out?

EDIT: openwrt/dnsmasq.init at openwrt-21.02 · openwrt/openwrt · GitHub