help-grub
[Top][All Lists]
Advanced

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

Parameters to DHCP


From: Styma, Robert E (Robert)
Subject: Parameters to DHCP
Date: Fri, 22 Feb 2013 14:29:48 +0000

I have set up a grub floppy and successfully installed an old version
of Fedora.  I want to be able to select different boot images in the
DHCP server based on a parameter sent from the grub.conf file.


The relevant section of my current dhcpd.conf file looks like this:
 
------------------------------------------------------------
subnet 192.168.67.128 netmask 255.255.255.128 {
 
 option routers   192.168.67.254;
 option subnet-mask  255.255.255.128;
 
 option ntp-servers  192.168.66.130;
 
 range dynamic-bootp 192.168.67.235 192.168.67.250;
 default-lease-time 172800;
 max-lease-time 345600;
 option domain-name-servers 192.168.67.134, 192.168.64.1;
 authoritative;
        class "pxeclients" {
                  match if substring (option vendor-class-identifier, 0, 9) = 
"PXEClient";
                  next-server 192.168.67.200;
                 
                  filename "fc6/vmlinuz";
          }
 
}
-------------------------------------------------------------

I can load a system with fc6 just fine. 
 
The grub menu.list (aka grub.conf) file looks like this:
(Some lines wrapped in the paste to email)
 ----------------------------------------------------------
default=0
timeout=30
#
title Linux_fc8_boot_phxbkup1
dhcp
root (nd)
kernel fc8/vmlinuz repo=192.168.67.200:/iso/fc8:/path ramdisk=10240 rw 
root=/dev/nfs boot=nfs nfsroot=192.168.67.200:/iso/fc8
initrd fc8/initrd.img
#
title Linux_fc6_boot_phxbkup1
dhcp
root (nd)
kernel fc6/vmlinuz repo=192.168.67.200:/iso/fc6:/pat ramdisk=10240 rw 
root=/dev/nfs boot=nfs nfsroot=192.168.67.200:/iso/fc6
initrd fc6/initrd.img
#
title Linux_fc4_boot_phxbkup1
dhcp
root (nd)
kernel fc4/vmlinuz repo=192.168.67.200:/iso/fc4:/pat ramdisk=10240 rw 
root=/dev/nfs boot=nfs nfsroot=192.168.67.200:/iso/fc4
initrd fc4/initrd.img
#
----------------------------------------------------

I can not load the fc4 or fc8 versions without changing the dhcpd.conf file.
This means I have the tftp boot server set up correctly (or at least close 
enough).
I also realize that I probably have more kernel options than I need.
What I would like to do is set up something like:

------------------------------------------------------------
subnet 192.168.67.128 netmask 255.255.255.128 {

        option routers                  192.168.67.254;
        option subnet-mask              255.255.255.128;

        option ntp-servers              192.168.66.130;

        range dynamic-bootp 192.168.67.235 192.168.67.250;
        default-lease-time 172800;
        max-lease-time 345600;
        option domain-name-servers 192.168.67.134, 192.168.64.1;
        authoritative;
        class "pxeclients" {
                  match if substring (option vendor-class-identifier, 0, 9) = 
"PXEClient";
                  next-server 192.168.67.200;
                 
                  if option dhcp-user-class = "fc4" {
                          filename "fc4/vmlinuz";
                  } elsif option dhcp-user-class = "fc8" {
                          filename "fc8/vmlinuz";
                  } else {
                          filename "fc6/vmlinuz";
                  }
          }

}
---------------------------------------------------------------------
The "if" statement is pulled out of an example I found on the internet.
The example was using the dhcp-user-class to set the default domain.
I have found reference to the grub " dhcp [--with-configfile] " and
also references to "option-150".   What I have not found is an example
that gets a parameter from the dhcp line in a grub.conf file to the
dhcp server so that it could be used in an "if" test.

Has anyone ever done this and has an example they would be willing to share?

Any advice in this area would be most appreciated.


Bob
Phoenix, AZ, USA


reply via email to

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