Hi, I see some very nice fedora documentation 11 about automatically feeding BIOS and UEFI clients with the correct file:
Namely?
# refer to RFC4758 for possible arch option values
option arch code 93 = unsigned integer 16;
subnet 192.168.1.0 netmask 255.255.255.0 {
if option arch = 00:07 {
filename "uefi/shim.efi";
} else {
filename "pxelinux.0";
}
next-server 192.168.1.2;
My question is where do I put such configuration in LEDE?
Update: I figured I can put raw dnsmasq config in /et/dnsmasq.conf like:
dhcp-match=set:uefi,option:client-arch,7
dhcp-boot=tag:!uefi,pxelinux.0
dhcp-boot=tag:uefi,uefi/shim.efi
The above works. I think it would be nice though to support this in uci. I tried this in /etc/config/dhcp:
config dnsmasq
list dhcp_boot 'tag:!uefi,pxelinux.0'
list dhcp_boot 'tag:uefi,uefi/shim.efi'
option dhcp_match 'set:uefi,option:client-arch,7'
But it turned out that dhcp-match option is not set at all in /var/etc/dnsmasq.conf.cfg02411c
and instead of two dhcp-boot
directives, only one ends up in there which is incorrect syntax for dnsmasq
.
I guess that dnsmasq config generator needs to be improved for this to work.
created
Dec ’17last reply
Dec ’17- 3
replies
- 2.9k
views
- 3
users
- 1
like
- 3
links
I have these lines in my /etc/dnsmasq.conf for this purpose:
dhcp-match=set:x86-legacy,option:client-arch,0
dhcp-match=set:x86_64-uefi,option:client-arch,7
dhcp-match=set:x86_64-uefi,option:client-arch,9
dhcp-match=set:ipxe,77,"iPXE"
dhcp-boot=tag:x86-legacy,undionly.kpxe,pxe.lan,192.168.1.54
dhcp-boot=tag:x86_64-uefi,ipxe.efi,pxe.lan,192.168.1.54
dhcp-boot=tag:ipxe,http://192.168.1.54/boot/boot.ipxe,pxe.lan,192.168.1.54
You can read about the dhcp-match and dhcp-boot options in the dnsmasq manual 31. In short, the dhcp-match lines sets one or more tags (internal dnsmasq identifier) based on the DHCP options the client sends. In my environment I have both legacy and UEFI clients, and I also utilize iPXE. When a legacy PXE ROM boots it will receive the legacy iPXE boot file (undionly.kpxe). When a UEFI ROM boots it will receive the UEFI version of iPXE (ipxe.efi). If iPXE boots (whether legacy or UEFI), it will receive a URL to the iPXE boot menu I want it to load.
Thank you @makro , this is what really works and you gave me the other interesting magic values. I’m thinking that it would be good to have that supported in UCI as well. See the edit of my original post. I edited the post before I saw your reply.
In any case, it’s very nice this is supported in the first place.
I believe the /etc/init.d/dnsmasq
is where the /etc/config/dhcp
file is processed and the proper dnsmasq
config is generated. If you fix it, please send PR to the OpenWrt packages repo.