Solved

including additional configs outside of dhcpd.conf

Posted on 2004-04-17
9
1,069 Views
Last Modified: 2013-11-18
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
0
Comment
Question by:Airgazm
  • 6
  • 3
9 Comments
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
Comment Utility
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
0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
Comment Utility
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.
0
 

Author Comment

by:Airgazm
Comment Utility
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
0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
Comment Utility
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?
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 44

Expert Comment

by:Karl Heinz Kremer
Comment Utility
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?
0
 

Author Comment

by:Airgazm
Comment Utility
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.

http://www.experts-exchange.com/Networking/Unix_Networking/Q_20888407.html
0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
Comment Utility
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?
0
 

Author Comment

by:Airgazm
Comment Utility
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.
0
 
LVL 44

Accepted Solution

by:
Karl Heinz Kremer earned 250 total points
Comment Utility
It's more secure. When somebody compromises the dhcp server, they only have access to the files in the chroot jail (at least that's the idea). If you are not using this feature, you can use the "real" path to the file and don't have to map it to the chroot root directory.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
I will show you how to create a ASP.NET Captcha control without using any HTTP HANDELRS or what so ever. you can easily plug it into your web pages. For Example a = 2 + 3 (where 2 and 3 are 2 random numbers) Session("Answer") = 5 then we…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now