DHCP Server organization

TheBearAK

New Member
Joined
Nov 17, 2021
Messages
10
Reaction score
5
Credits
100
I tried to use 'includes' in the dhcpd.conf but it doesn't seem to work.

I thought it would be clever to have each subnet in its own .conf file:

/etc/dhcp/dhcpd.conf

/etc/dhcp/subnets/<network.conf>

Then just have:

include "/etc/dhcp/subnets/sub10.conf";
include "/etc/dhcp/subnets/sub20.conf";
include "/etc/dhcp/subnets/statics.conf";

in the dhcpd.conf file.

For some reason it won't keep all of the configurations, just the last one read.
Each "subNN.conf" has no global, only subnet specific configurations.
 


I checked the dhcpd documentation, no where is there a mention of "include" as setting so I don't think it's supported. What you could do is create a script that uses a template file with a basic configuration that checks a certain directory for the files with where you have the sub-nets defined using cat to the basic configuration and all the sub-net files when a new file has been added to the the subnet directory or when one of the files in the sub-net directory has been changed. The end result will be that you have the different sub-nets sorted into different files and your script creates one one big configuration of the main configuration and the sub-net configuration files.
 
Interesting, because I can get it to include one file, but it is reading multiple files where I run into an issue. Like it tosses out the previous configurations and only uses the last loaded.

I've got a virtual network with virtual machines set up to test things. I'm trying a different approach to the organization.
More like apache with "conf-enabled" and "conf-available" directories and sym-links inside conf-enable to point to conf-availables. I discovered isc-dhcp does not like wildcards in the includes though. Still exploring. Might be just a syntax issue.
 

Members online


Top