Linux – Configuring a DHCP server to serve multiple subnets on the same VLAN

dhcplinuxpxe-bootsubnetvlan

I have a VLAN composed of multiple subnets, and I would like to use DHCP to centralize IP address designation.

The DHCP server (100.100.25.88) is a Debian machine on the subnet 100.100.25.64/27. I would like to assign IP addresses to machines in the subnet 100.100.68.0/24. The ultimate goal is to enable PXE booting on all machines in the 100.100.68.0/24 subnet.

Below is my dhcpd.conf file,

# DHCP Configuration file
use-host-decl-names on;
ddns-update-style interim;
ignore client-updates;
next-server 100.100.25.88;

# Subnet of DHCP server
subnet 100.100.25.64 netmask 255.255.255.224 {
        option subnet-mask              255.255.255.224;
        range dynamic-bootp             100.100.25.66 100.100.25.94;
        default-lease-time              21600;
        max-lease-time                  43200;
        option domain-name-servers      100.100.25.69, 100.100.44.21;
        option routers                  100.100.25.65;
        filename "pxelinux.0";
}

# Subnet of client machines
subnet 100.100.68.0 netmask 255.255.255.0 {
        range dynamic-bootp             100.100.68.10 100.100.68.200;
        option subnet-mask              255.255.255.0;
        default-lease-time              21600;
        max-lease-time                  43200;
        option domain-name-servers      100.100.25.69, 100.100.44.21;
        option routers                  100.100.68.1;
        option broadcast-address        100.100.68.255;
        filename "pxelinux.0";
        allow unknown-clients;
}

The way I understand DHCP, the DHCP server should be broadcasting packets to broadcast address specified for the second subnet, 100.100.68.255. No clients are able to retrieve an IP address, though. Is this an error in my DHCP configuration, or possibly because the router does not enable DHCP relays?

Thanks!

Best Answer

If you want your DHCP server to receive client requests from other networks, you will need to set up a DHCP relay in each such network, and each relay will need to be configured to forward client requests to your DHCP server. I believe that the ISC DHCP package is capable of providing relay service, but I have never used it in that capacity. Many routers can also be configured to act as DHCP relays on networks they're attached to.

In your case, it seems logical to configure a DHCP relay on 100.100.68.1, since it's a router. However, any server (with a static IP) on the 100.100.68.0/24 network could just as easily fill that role.

(By the way, DHCP servers never broadcast, they always send direct (unicast) messages.)