Discussion:
[Dnsmasq-discuss] dhcp vendor-option and grub net_pxe_extensionspath
Carl Karsten
2017-04-27 16:42:13 UTC
Permalink
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?
--
Carl K
Simon Kelley
2017-04-28 21:53:32 UTC
Permalink
Post by Carl Karsten
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
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
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}
dhcp-host=40:8d:5c:7f:bb:90,,gator
dhcp-option-force=host:gator,209,"disk=/dev/nvme0n1"
Look for "tags" in the man page, in this case, set a tag in the
dhcp-host line (it can be the same as the hostname)

dhcp-host=40:8d:5c:7f:bb:90,set:gator,gator


and make the option conditional on that tag

dhcp-option-force=tag:gator,209,"disk=/dev/nvme0n1"
Post by Carl Karsten
So yeah, how do I send random strings based on mac/hostname
See above
Post by Carl Karsten
and how do I read what was sent in grub?
Set the "log-dhcp" flag in the dnsmasq configuration to get lots of
useful information.

Cheers,

Simon.
Post by Carl Karsten
--
Carl K
_______________________________________________
Dnsmasq-discuss mailing list
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
Carl Karsten
2017-05-01 04:58:59 UTC
Permalink
woked - yay.

dhcp-host=00:26:9e:03:9d:e5,set:negk,negk
dhcp-option-force=tag:negk,209,"partman-auto/disk=/dev/sda"

# grub/grub.cfg
net_get_dhcp_option appends ${net_default_interface} 209 string

menuentry "Install Ubuntu preseed" {
set gfxpayload=keep
linux /ubuntu-installer/amd64/linux gfxpayload=800x600x16,800x600 ---
auto=true url=dc10b DEBCONF_DEBUG=5 tasks="" hostname=
interface=${net_default_mac} ${appends}
initrd /ubuntu-installer/amd64/initrd.gz
}

~ # head /var/log/syslog
May 1 04:30:40 kernel: [ 0.000000] Command line:
BOOT_IMAGE=/ubuntu-installer/amd64/linux gfxpayload=800x600x16,800x600 ---
auto=true url=dc10b DEBCONF_DEBUG=5 tasks= hostname=
interface=00:26:9e:03:9d:e5 partman-auto/disk=/dev/sda
Post by Simon Kelley
Post by Carl Karsten
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.
Post by Carl Karsten
I am trying to work out a nice way to pass host specific info to di
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
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}
dhcp-host=40:8d:5c:7f:bb:90,,gator
dhcp-option-force=host:gator,209,"disk=/dev/nvme0n1"
Look for "tags" in the man page, in this case, set a tag in the
dhcp-host line (it can be the same as the hostname)
dhcp-host=40:8d:5c:7f:bb:90,set:gator,gator
and make the option conditional on that tag
dhcp-option-force=tag:gator,209,"disk=/dev/nvme0n1"
Post by Carl Karsten
So yeah, how do I send random strings based on mac/hostname
See above
Post by Carl Karsten
and how do I read what was sent in grub?
Set the "log-dhcp" flag in the dnsmasq configuration to get lots of
useful information.
Cheers,
Simon.
Post by Carl Karsten
--
Carl K
_______________________________________________
Dnsmasq-discuss mailing list
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
_______________________________________________
Dnsmasq-discuss mailing list
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
Carl Karsten
2017-05-11 22:22:08 UTC
Permalink
I am pondering something I am not sure I even want: I guess we can call it
a default option 209

Is this valid, reliable, predictable?

dhcp-option-force=209,"partman-auto/disk=/dev/sda"

dhcp-host=00:26:9e:03:9d:e5,set:negk,negk
dhcp-option-force=tag:negk,209,"partman-auto/disk=/dev/sdb"


The hope is ...sda except for the tag:negk case.

personally I only touch 20 machines a year, so setting up the extra 19
lines
is easy. I like to understand my tools, and maybe someone with 100''s will
be interested in my setup. probaly not ;)
Post by Carl Karsten
woked - yay.
dhcp-host=00:26:9e:03:9d:e5,set:negk,negk
dhcp-option-force=tag:negk,209,"partman-auto/disk=/dev/sda"
# grub/grub.cfg
net_get_dhcp_option appends ${net_default_interface} 209 string
menuentry "Install Ubuntu preseed" {
set gfxpayload=keep
linux /ubuntu-installer/amd64/linux gfxpayload=800x600x16,800x600 ---
auto=true url=dc10b DEBCONF_DEBUG=5 tasks="" hostname=
interface=${net_default_mac} ${appends}
initrd /ubuntu-installer/amd64/initrd.gz
}
~ # head /var/log/syslog
BOOT_IMAGE=/ubuntu-installer/amd64/linux gfxpayload=800x600x16,800x600
--- auto=true url=dc10b DEBCONF_DEBUG=5 tasks= hostname=
interface=00:26:9e:03:9d:e5 partman-auto/disk=/dev/sda
Post by Simon Kelley
Post by Carl Karsten
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.
Post by Carl Karsten
I am trying to work out a nice way to pass host specific info to di
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
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}
dhcp-host=40:8d:5c:7f:bb:90,,gator
dhcp-option-force=host:gator,209,"disk=/dev/nvme0n1"
Look for "tags" in the man page, in this case, set a tag in the
dhcp-host line (it can be the same as the hostname)
dhcp-host=40:8d:5c:7f:bb:90,set:gator,gator
and make the option conditional on that tag
dhcp-option-force=tag:gator,209,"disk=/dev/nvme0n1"
Post by Carl Karsten
So yeah, how do I send random strings based on mac/hostname
See above
Post by Carl Karsten
and how do I read what was sent in grub?
Set the "log-dhcp" flag in the dnsmasq configuration to get lots of
useful information.
Cheers,
Simon.
Post by Carl Karsten
--
Carl K
_______________________________________________
Dnsmasq-discuss mailing list
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
_______________________________________________
Dnsmasq-discuss mailing list
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
Simon Kelley
2017-05-12 14:30:26 UTC
Permalink
Post by Carl Karsten
I am pondering something I am not sure I even want: I guess we can call
it a default option 209
Is this valid, reliable, predictable?
dhcp-option-force=209,"partman-auto/disk=/dev/sda"
dhcp-host=00:26:9e:03:9d:e5,set:negk,negk
dhcp-option-force=tag:negk,209,"partman-auto/disk=/dev/sdb"
The hope is ...sda except for the tag:negk case.
Yeah, that's how it's defined to work: and option which is conditional
on a tag gets used in preference to one which is not conditional, of the
tag is set.


Cheers,

Simon.
Post by Carl Karsten
personally I only touch 20 machines a year, so setting up the extra 19
lines
is easy. I like to understand my tools, and maybe someone with 100''s
will be interested in my setup. probaly not ;)
woked - yay.
dhcp-host=00:26:9e:03:9d:e5,set:negk,negk
dhcp-option-force=tag:negk,209,"partman-auto/disk=/dev/sda"
# grub/grub.cfg
net_get_dhcp_option appends ${net_default_interface} 209 string
menuentry "Install Ubuntu preseed" {
set gfxpayload=keep
linux /ubuntu-installer/amd64/linux gfxpayload=800x600x16,800x600
--- auto=true url=dc10b DEBCONF_DEBUG=5 tasks="" hostname=
interface=${net_default_mac} ${appends}
initrd /ubuntu-installer/amd64/initrd.gz
}
~ # head /var/log/syslog
BOOT_IMAGE=/ubuntu-installer/amd64/linux
gfxpayload=800x600x16,800x600 --- auto=true url=dc10b
DEBCONF_DEBUG=5 tasks= hostname= interface=00:26:9e:03:9d:e5
partman-auto/disk=/dev/sda
On Fri, Apr 28, 2017 at 5:53 PM, Simon Kelley
Post by Carl Karsten
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
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
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}
dhcp-host=40:8d:5c:7f:bb:90,,gator
dhcp-option-force=host:gator,209,"disk=/dev/nvme0n1"
Look for "tags" in the man page, in this case, set a tag in the
dhcp-host line (it can be the same as the hostname)
dhcp-host=40:8d:5c:7f:bb:90,set:gator,gator
and make the option conditional on that tag
dhcp-option-force=tag:gator,209,"disk=/dev/nvme0n1"
Post by Carl Karsten
So yeah, how do I send random strings based on mac/hostname
See above
Post by Carl Karsten
and how do I read what was sent in grub?
Set the "log-dhcp" flag in the dnsmasq configuration to get lots of
useful information.
Cheers,
Simon.
Post by Carl Karsten
--
Carl K
_______________________________________________
Dnsmasq-discuss mailing list
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
<http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss>
_______________________________________________
Dnsmasq-discuss mailing list
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
<http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss>
Loading...