Discussion:
[Dnsmasq-discuss] uefi booting with different MAC
Louis Garcia II
2018-09-10 20:22:58 UTC
Permalink
Currently I have uefi pxe boot setup and working fine. grub.cfg has different menu options pointing to different kickstart files for different systems. They are all x86_64 uefi. Is there a way to have dnsmasq serve different grub.cfg to different systems according to its MAC? Would dhcp-mac=set:<tag>,<MAC> and renaming grub.cfg to <MAC>-grub.cfg help?


Thanks.


#cat /etc/dnsmasq.conf
# Configuration file for dnsmasq:

# Log lots of extra information about DHCP transactions.
#log-dhcp

# Disables DNS function.
port=0

# Interface to listen on.
interface=lo
interface=eno2

# Ensures that Dnsmasq will listen only to those interfaces.
bind-dynamic

# DHCP server, supply the range of addresses available for
# lease and optionally a lease time.
dhcp-range=172.16.0.200,172.16.0.254,6h

# DHCP server, supply the router.
dhcp-option=3,172.16.0.1

# DHCP server, supply the DNS server.
dhcp-option=6,172.16.0.1

# DHCP server, match client.
dhcp-match=set:efi-x86_64,option:client-arch,7

# DHCP server, files to be served.
dhcp-boot=tag:efi-x86_64,shim.efi

# Enable dnsmasq's built-in TFTP server
enable-tftp

# Set the root directory for files available via FTP.
tftp-root=/srv/tftpboot


#ls /srv/tftpboot
grub.cfg grubx64.efi shim.efi
john doe
2018-09-11 06:11:40 UTC
Permalink
Post by Louis Garcia II
Currently I have uefi pxe boot setup and working fine. grub.cfg has different menu options pointing to different kickstart files for different systems. They are all x86_64 uefi. Is there a way to have dnsmasq serve different grub.cfg to different systems according to its MAC? Would dhcp-mac=set:<tag>,<MAC> and renaming grub.cfg to <MAC>-grub.cfg help?
Maybe the option '--tftp-unique-root' could do what you want:

http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html

"--tftp-unique-root[=ip|mac]
Add the IP or hardware address of the TFTP client as a path component on
the end of the TFTP-root. Only valid if a tftp-root is set and the
directory exists. Defaults to adding IP address (in standard dotted-quad
format). For instance, if tftp-root is "/tftp" and client 1.2.3.4
requests file "myfile" then the effective path will be
"/tftp/1.2.3.4/myfile" if /tftp/1.2.3.4 exists or /tftp/myfile
otherwise. When "=mac" is specified it will append the MAC address
instead, using lowercase zero padded digits separated by dashes, e.g.:
01-02-03-04-aa-bb Note that resolving MAC addresses is only possible if
the client is in the local network or obtained a DHCP lease from us. "
--
John Doe
Loading...