LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 10-22-2019, 11:24 AM   #1
marymac39
LQ Newbie
 
Registered: Oct 2016
Posts: 10

Rep: Reputation: Disabled
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

dhcp-boot=tag:bios,"pxelinux.0"
dhcp-boot=tag:efi-x86_64,"BOOTX64.EFI"


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.
 
Old 10-29-2019, 03:16 PM   #2
tshikose
Member
 
Registered: Apr 2010
Location: Kinshasa, Democratic Republic of Congo
Distribution: RHEL, Fedora, CentOS
Posts: 525

Rep: Reputation: 95
Hi,

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.
Code:
LABEL CentOS-7-x86_64
MENU LABEL ^CentOS 7 x86_64
KERNEL /networkboot/centos-7-x86_64/vmlinuz
APPEND initrd=/networkboot/centos-7-x86_64/initrd.img inst.repo=url_for_the_centos_source inst.ks.sendmac inst.ks=url_to_php_kick_start_file.php?param1=value1&param2=value2
SYSAPPEND 7
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.
 
  


Reply

Tags
dnsmasq, network, pxe



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Forwarding DNS queries based on the source IP and/or MAC of the requesting client Timbo66 Linux - Server 5 01-26-2017 02:54 PM
HOSTNAME = hostname -> HOSTNAME: command not found ? thomas2004ch Linux - Software 2 08-26-2013 08:25 PM
Requesting suggestions re: domain, hostname, bind TheHT Linux - Networking 3 01-24-2011 04:08 PM
Restricting Dynamic Ipaddress by based on Dynamic DNS host names karthik9110 Linux - Newbie 5 12-13-2009 11:46 PM
Requesting a new DHCP lease raypen Linux - Networking 2 06-07-2006 09:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 12:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration