help-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dhcp vendor-option and grub net_pxe_extensionspath


From: Andrei Borzenkov
Subject: Re: dhcp vendor-option and grub net_pxe_extensionspath
Date: Fri, 28 Apr 2017 19:28:28 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

28.04.2017 08:57, Carl Karsten пишет:
> I am using dnsmasq, but I can bring up isc dhcp too.  I need help with both
> sides, but on the grub list I won't be too picky about what dhcp server is
> used.
> 
> I am looking for the syntax of dhcp vendor options, and then how to access
> them in grub-net.  I think.  maybe there is a better way.
> 
> I pxe boot grub, which boots di (Debian Installer) and pass a preseed file.
> 
> I am trying to work out a nice way to pass host specific info to di
> example, most use:
> partman-auto/disk="/dev/sda"
> but one machine has an onboard ssd nvme which needs /dev/nvme0n1
> 
> di will read values appended to the kernel boot line, so I can hard code it
> like this:
> 
> menuentry "Install Ubuntu preseed" {
> set gfxpayload=keep
> linux /ubuntu-installer/amd64/linux gfxpayload=800x600x16,800x600 ---
> auto=true url=dc10b hostname= partman-auto/disk="/dev/nvme0n1"
> interface=${net_default_mac}
> initrd /ubuntu-installer/amd64/initrd.gz
> }
> 
> interface=${net_default_mac} - use the nic that pxe booted.
> 
> Now I get lost in conf options and syntax.  forgive me for making stuff up
> here, if it worked I wouldn't be asking for help.
> 
> I am hoping for something like
> partman-auto/disk=$(net_pxe_extensionspath/disk}
> 
> in dnsmasq conf:
> dhcp-host=40:8d:5c:7f:bb:90,,gator
> 
> dhcp-option-force=host:gator,209,"disk=/dev/nvme0n1"
> 
> So yeah, how do I send random strings based on mac/hostname
> and how do I read what was sent in grub?
> 

You can use net_get_dhcp_option to extract from DHCP ACK packet. In this
case it would be something like

net_get_dhcp_option disk ${net_default_interface} 209 string

Unless you intend to set multiple values in single option, setting its
value to just "/dev/nvme0n1" simplifies further parsing.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]