dnsmasq: Dynamic dhcp-boot based on hostname requesting
Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
dnsmasq: Dynamic dhcp-boot based on hostname requesting
Hi All,
TL;DR: When a client requests its boot file, need to serve a boot file with the requesting clients hostname or IP or MAC appended to the end via dnsmasq.
Hopefully easy question on using dnsmasq to serve a dynamic boot file to requesting clients based on the requesting clients IP or hostname.
Use case: Provisioning multiple hosts at the same time with different versions/archs of RHEL via network booting using dnsmasq. Have some background scripts putting boot files in particular places prior to install, but need to leverage dnsmasq to serve the desired boot file to the host requesting it.
Plan so far: Given hostname "test.system.one", appropriate boot file would be placed in tftproot with "-test.system.one" appended to file name. When this client requests its boot file from dnsmasq, I would like to be able to have dnsmasq realize the hostname requesting it, and serve the boot file with that hostname appended to it. Could be IP or MAC as well, anything unique to that machine. Basically, is there a way in a dnsmasq config to reference the IP/hostname/MAC via a variable?
Currently, I have dnsmasq configured to serve different boot files based on the client-arch option 93 to differentiate between legacy and EFI BIOS systems:
# Legacy BIOS
dhcp-match=set:bios,option:client-arch,0
# 64 bit x86 EFI
dhcp-match=set:efi-x86_64,option:client-arch,7
I would like to keep this setup but enhance it. Given that I may have multiple machines to provision simultaneously, I would like to pre-populate tftproot with all of their boot files (with hostname appended) and then have dnsmasq pre-configured to append the hostname to the boot file it serves with the dhcp-boot option.
Any ideas? I realize this may not be the best way to realize my use case, but it is a setup I have inherited and need to augment in the manner described above if possible. Thank you.
I am also using an infrastructure that provides PXE boot for fully automated kick started installation.
I use DHCP from a dd-wrt Linksys with dnsmasq dhcp-boot=pxelinux.0,pxeserver_name,pxeserver_ip.
I then use a CentOS machine (actually a KVM instance) as the PXE server.
It serves out menus similar to the below from /var/lib/tftpboot/pxelinux.cfg/default.
The inst.ks.sendmac will ensure that the MAC address of the booting machine will be availed to the PHP script as a header. In addition, you can provide whatever desired parameters and options. And finally, you have the full power of PHP to customized it and put in complex logic.
I hope it helps.
Let me know if required, I can share with you specific extracts of my working infrastructure.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.