Score:1

How does the variable "pxe_default_server" get set in Red Hat 7.9?

uz flag

We have a RHEL 7.9 server that is acting as a DHCP/TFTP (PXE) server servicing multiple subnets. Below is a copy of our dhcpd.conf file (the DHCP/PXE server is X.Y.145.98):

allow bootp;
allow booting;
max-lease-time 1200;
default-lease-time 900;

subnet X.Y.145.96 netmask 255.255.255.224 {
  option routers X.Y.145.126;
  range X.Y.145.100 X.Y.145.105;
  next-server X.Y.145.98;
  filename "pxelinux.0"
}

subnet X.Y.145.144 netmask 255.255.255.248 {
  option routers X.Y.145.145;
  range X.Y.145.146 X.Y.145.150;
  next-server X.Y.145.98;
  filename "pxelinux.0"
}

The problem we are seeing is that the grub.cfg is grabbing the IP of the options router parameter for the variable pxe_default_server instead of the next-server parameter. This (pxe_default_server) is then used to define the variable net_default_server parameter and our PXE fails because it is point to the gateway IP instead of the DHCP/PXE server IP. If we edit the grub.cfg file to hard code the pxe_default_server parameter to be equal to the IP of the DHCP/PXE server...we can boot fine and pull down an image. Is there a different parameter I should be using?

Score:0
cu flag
allow bootp;
allow booting;
max-lease-time 1200;
default-lease-time 900;

subnet X.Y.145.96 netmask 255.255.255.224 {
  option routers X.Y.145.126;
  option pxe-server-name X.Y.145.98;
  range X.Y.145.100 X.Y.145.105;
  next-server X.Y.145.98;
  filename "pxelinux.0";
}

subnet X.Y.145.144 netmask 255.255.255.248 {
  option routers X.Y.145.145;
  option pxe-server-name X.Y.145.98;
  range X.Y.145.146 X.Y.145.150;
  next-server X.Y.145.98;
  filename "pxelinux.0";
}
Score:0
za flag
Pat

Grub is surely getting confused, but your dhcpd.confg has issues.

  1. You have 2 subnets but you are providing in both the same "next-server" IP that means that for one subnet the TFTP server might not be visible depending on your layout.
  2. You are not defining the "broadcast-address" per subnet
  3. You are providing PXE data even to not PXE booting clients.

See here an example: https://www.redhat.com/sysadmin/pxe-boot-uefi

# DHCP Server Configuration File
#
#. see /usr/share/doc/dhcp*/dhcpd.conf.example
#
#. see dhcpd.conf(5) man page


option rfc3442-classless-static-routes code 121 = array of integer 8;
option ms-classless-static-routes code 249 = array of integer 8;
option space pxelinux;
option pxelinux.magic code 208 = string;
option pxelinux.configfile code 209 = text;
option pxelinux.pathprefix code 210 = text;
option pxelinux.reboottime code 211 = unsigned integer 32;
option architecture-type code 93 = unsigned integer 16;
subnet 192.168.1.0 netmask 255.255.255.0 {
   option routers 192.168.1.0;
   option subnet-mask 255.255.255.0;
   option broadcast-address 192.168.1.255;
}

subnet 192.168.2.0 netmask 255.255.255.0 {
   option routers 192.168.2.1;
   option subnet-mask 255.255.255.0;
   option broadcast-address 192.168.2.255;
   range 192.168.2.2 192.168.2.254;

   class "pxeclients" {
     match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
     next-server 192.168.1.10;
     if option architecture-type = 00:07 {
        filename "shim.efi";
        } else {
        filename "pxelinux/pxelinux.0";
     }
   }
}

subnet 192.168.3.0 netmask 255.255.255.0 {
   option routers 192.168.3.1;
   option subnet-mask 255.255.255.0;
   option broadcast-address 192.168.3.255;
   range 192.168.3.2 192.168.3.254;

   class "pxeclients" {
     match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
     next-server 192.168.1.10;
     if option architecture-type = 00:07 {
        filename "shim.efi";
        } else {
        filename "pxelinux/pxelinux.0";
     }
   }
}
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.