Link to home
Start Free TrialLog in
Avatar of Airgazm
Airgazm

asked on

including additional configs outside of dhcpd.conf

Hi,

I have a dhcpd.conf file.  for organization purposes, I want to build files outside of dhcpd.conf that will store static ip - mac address mappings.  

I put the following in my dhcpd.conf

include "/etc/dhcpd.static";

but I get the following error upon dhcpd start.
/etc/dhcpd.conf line 16: expecting a declaration.

even with nothing in the dhcpd.static file, I get the error.  

Doesn't a config file like dhcpd.conf work the same way a config file for say /etc/apache/httpd.conf , as I have "include" referenced for virtual hosts (virtual.host) working just fine.

curious why I get this error.

thanks

-Air
Avatar of Karl Heinz Kremer
Karl Heinz Kremer
Flag of United States of America image

No, you cannot just use the syntax and conventions of one configuration file and apply it to another file format. The dhcpd config file does not support any include mechanism
If you need a component of the file that you can change, you could work with three files: A template file, your include file and the actual dhcpd.conf file, which would  be generated just before dhcpd gets started. You would then use either a macro processor (e.g. m4) or a Perl script that would merge your two files and write it out as the "real" dhcpd.conf file.

But, before you do that, you should take some time to find out if you really need this mechanism at all.
Avatar of Airgazm
Airgazm

ASKER

yes, I am thinking about writing a script just like you suggested.  thx

I am curious the "include" because I found this "include "/etc/dhcpd.master";  in the dhcpd.conf man file.

http://www.daemon-systems.org/man/dhcpd.conf.5.html


Thanks

-Air
You are right, I just checked the man page on my system, it's listed. I've never used this feature (you probably can tell :-)

But, what I said is still true: You cannot assume something is supported, just because some other product supports it.

Which dhcpd are you using? Which distribution are you using?
Is your dhcpd running in a chroot jail? If so, you need to put the file into the chroot directory. I just tried this with my system, and it did actually work. Check the command line dhcpd is started with:

ps -auxww | grep dhcpd

Do you see a -chroot parameter?
Avatar of Airgazm

ASKER

I wasn't sure if the syntax "include" was a shell command or part of the program.  Not sure how dhcpd works in that regard.  

I'm using debian, with ISC DHCP.

I guess i can just use one dhcpd config file but it would be nice to be able to place the other data in additional files.  There is also this other post I responded to on EE that is kinda what I'm trying to do here.

https://www.experts-exchange.com/questions/20888407/Generate-dhcpd-conf-from-SQL-database.html
As I said, it works for me. And I'm also using ISC DHCP, version 3.0.1rc13
Did you check if the daemon is running in a chroot jail?
Avatar of Airgazm

ASKER

I had version 2.2, I just upgraded to DHCP 3.0.1rc9
I built a script that processes the the dhcpd.conf and restarts the service.
I don't think its running in a chroot jail though, does it need to be for any reason.
ASKER CERTIFIED SOLUTION
Avatar of Karl Heinz Kremer
Karl Heinz Kremer
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial