Hi!
I have been reading this guide to configure a iPXE server: Configuring PXE Network Boot Server on Ubuntu 22.04 LTS
and I followed the exact steps except for the dhcp server. This is when the problem starts.
Let me tell you my home installation. I have a PC running Ubuntu server 22.04.1 - call it "FreeBNT". It has a big zfs filesystem I use to serve SAMBA shares and other things. now I want to use it as PXE server too. But I can't configure DHCP in this server, because, I power it on and off from time to time. (the electricity is expensive now!). So I think I need to setup a router I have with OpenWRT installed - call it TP-LINK. So I configured it to serve DHCP and also BOOTP. But the TFTP server is in FreeBNT. also NFS and iPXE firmware and config files are in FreeBNT.
The problem arrives when I arrived at the point of the tutorial when dnsmasq should be configured with these options:
/etc/dnsmasq.conf
interface=ens33
bind-interfaces
domain=linuxhint.local
dhcp-range=ens38,192.168.0.180,192.168.0.200,255.255.255.0,8h
dhcp-option=option:router,192.168.0.1
dhcp-option=option:dns-server,1.1.1.1
dhcp-option=option:dns-server,8.8.8.8
enable-tftp
tftp-root=/pxeboot
# boot config for BIOS systems
dhcp-match=set:bios-x86,option:client-arch,0
dhcp-boot=tag:bios-x86,firmware/ipxe.pxe
# boot config for UEFI systems
dhcp-match=set:efi-x86_64,option:client-arch,7
dhcp-match=set:efi-x86_64,option:client-arch,9
dhcp-boot=tag:efi-x86_64,firmware/ipxe.efi
There are 5 effective lines at the bottom, preceded by # boot config for BIOS systems and # boot config for UEFI systems.
Since those options are part of the dhcp part of dnsmasq, I think I should include them in the dhcp configuration in TP-LINK. But I didn't get it to work. The configuration for DHCP in TP-LINK is located at
/etc/config/dhcp
and the config file syntax is different.
Initially I have done this - to make it to work with the BIOS settings, serving only the ipxe.pxe file. It actually works, but I'd like to have the BIOS option and also the UEFI option. Now, what I did:
config dnsmasq
option domainneeded '1'
option boguspriv '1'
option filterwin2k '0'
option localise_queries '1'
option rebind_protection '1'
option rebind_localhost '1'
option local '/lan/'
option domain 'lan'
option expandhosts '1'
option nonegcache '0'
option authoritative '1'
option readethers '1'
option leasefile '/tmp/dhcp.leases'
option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
option nonwildcard '1'
option localservice '1'
option ednspacket_max '1232'
config dhcp 'lan'
option interface 'lan'
option start '100'
option limit '150'
option leasetime '12h'
option dhcpv4 'server'
list dhcp_option '6,172.26.23.3'
list dhcp_option '240,:::::239.0.2.10:22222:v6.0:239.0.2.30:22222'
list dhcp_option '3,192.168.1.3'
list ra_flags 'none'
config odhcpd 'odhcpd'
option maindhcp '0'
option leasefile '/tmp/hosts/odhcpd'
option leasetrigger '/usr/sbin/odhcpd-update'
option loglevel '4'
config boot 'linux'
option filename 'firmware/ipxe.pxe'
option serveraddress '192.168.1.2'
option servername 'FreeBNT'
Also see my dnsmasq configuration (/etc/dnsmasq.conf) in FreeBNT, for the sake of completeness:
#interface=ens33
#bind-interfaces
port=0
enable-tftp
tftp-root=/free/pxe
# boot config for BIOS systems
#dhcp-match=set:bios-x86,option:client-arch,0
#dhcp-boot=tag:bios-x86,firmware/ipxe.pxe
# boot config for UEFI systems
#dhcp-match=set:efi-x86_64,option:client-arch,7
#dhcp-match=set:efi-x86_64,option:client-arch,9
#dhcp-boot=tag:efi-x86_64,firmware/ipxe.efi
After seeing that the ipxe.pxe file worked well with the BIOS PXE, I tried also with ipxe.efi , and it does some progress but I don't get it to work. So I have 2 problems.
- How can I adapt the dhcp-match ... configuration to TP-LINK dhcp configuration so that the TP-LINK serves ipxe.pxe to BIOS PXE clients and it serves ipxe.efi to UEFI PXE clients.
- Once I see the first problem is resolved, I would try to go further and try to make UEFI PXE to work.
I have been reading a lot of information from google searches an I found this, from here
That gave me a clue and I tried to configure /etc/config/dhcp as follows (the previous sections are unchanged, I only edit the (config boot 'linux') section/sections:
config boot 'linux'
option filename 'firmware/ipxe.pxe'
option serveraddress '192.168.1.2'
option servername 'FreeBNT'
option network-id 'bios-x86'
option dhcp_option 'client-arch,6'
config boot 'linux'
option filename 'firmware/ipxe.efi'
option serveraddress '192.168.1.2'
option servername 'FreeBNT'
option network-id 'efi-x86_64-1'
option dhcp_option 'client-arch,7'
config boot 'linux'
option filename 'firmware/ipxe.efi'
option serveraddress '192.168.1.2'
option servername 'FreeBNT'
option network-id 'efi-x86_64-2'
option dhcp_option 'client-arch,9'
But it didn't work for BIOS PXE, and neither for UEFI PXE (not sure but almost sure).
--EDIT FROM HERE--
I have seen, with this configuration, TP-LINK is pointing to ipxe.efi, whether I connect from BIOS PXE computer or I connect with UEFI PXE computer. With UEFI profile I see the same error I saw when I tried to connect when I configured only one "config boot 'linux'" section, with 'firmware/ipxe.efi'. With BIOS profile it gives me the same error I saw when I configured only one "config boot 'linux'" section, with 'firmware/ipxe.efi' too, but connecting from BIOS profile. If you need to clarify something, or photos of the screen when I try to boot, please ask. I don't want to overwhelm with too much information.
--EDIT TO HERE--
I don't understand, from the OpenWRT documentation - DHCP , the networkid. In one place it says networkid is to differentiate eth0, eth1, wlan0, etc. But in other place (Booting options) it says:
you can use network-ids to map options to each client
I don't know if there is networkid parameter and network-id parameter, or other thing that I didn't understand.
If someone could please help me, giving me some recommendations or steps I can follow to configure the DHCP server in TP-LINK, I would really appreciate it. also I'd like to know whether I can, instead of doing 3 (config boot 'linux') sections, doing 2 sections, grouping the two sections of UEFI PXE into one that would be applied to architectures 7 or 9.
Thanks a lot for your time reading this, I will be available to give more information if needed. I will now suscribe to this thread.
Cheers!
borhacker