Intro
I am trying to use a centos box for DHCP and TFTP function, for iPXE boot. I have one subnet configured for DHCP, but it has multiple ranges and each range has a different iPXE boot URL.
Problem
Problem is that once the hosts boot into iPXE, it only takes the URL from the range that is at the very bottom, regardless of which range the DHCP IP is assigned from https://10.10.2.12:6501/vmw/rbd/tramp
For e.g., my host with 10.10.2.212
should get this iPXE URL https://10.10.2.12:6501/vmw/rbd/tramp
and my host with IP 10.10.2.52
should get this iPXE URL https://10.10.2.13:6501/vmw/rbd/tramp
but they are both iPXE booting from this URL https://10.10.2.12:6501/vmw/rbd/tramp
I have also tried to define the pool, but the filename option inside the pool does not take effect.
Desired results
my host with 10.10.2.212
should get this iPXE URL https://10.10.2.12:6501/vmw/rbd/tramp
and my host with IP 10.10.2.52
should get this iPXE URL https://10.10.2.13:6501/vmw/rbd/tramp
dhcpd.conf file
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.example
# see dhcpd.conf(5) man page
#
# Domain name
option domain-name "abc.xyz";
# DNS server ips
option domain-name-servers 8.8.8.8;
# Default lease time
default-lease-time 2592000;
# Max lease time
max-lease-time 5184000;
# Log method
log-facility local7;
authoritative;
# Subnet and ip ranges
# ESX ESXi_Mgmt subnet
subnet 10.10.2.0 netmask 255.255.254.0 {
range 10.10.2.52 10.10.2.211;
if ((exists user-class) and (option user-class = "iPXE")) {
filename "https://10.10.2.13:6501/vmw/rbd/tramp";
} else {
filename "undionly.kpxe";
}
range 10.10.2.212 10.10.3.117;
if ((exists user-class) and (option user-class = "iPXE")) {
filename "https://10.10.2.12:6501/vmw/rbd/tramp";
} else {
filename "undionly.kpxe";
}
option subnet-mask 255.255.254.0;
option broadcast-address 10.121.3.255;
option routers 10.121.2.1;
}
# Include reservations
include "/etc/dhcp/reservations.d/domain1.p.opensource";
include "/etc/dhcp/reservations.d/domain1.np.opensource";