?
Solved

including additional configs outside of dhcpd.conf

Posted on 2004-04-17
9
Medium Priority
?
1,077 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
9 Comments
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 10852712
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
ID: 10852724
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
ID: 10854238
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
7 Extremely Useful Linux Commands for Beginners

Just getting started with Linux? Here's a quick start guide that has 7 commands that we believe will come in handy.

 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 10854452
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
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 10854502
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
ID: 10854511
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
ID: 10854692
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
ID: 10866179
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 1000 total points
ID: 10867397
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

Create the perfect environment for any meeting

You might have a modern environment with all sorts of high-tech equipment, but what makes it worthwhile is how you seamlessly bring together the presentation with audio, video and lighting. The ATEN Control System provides integrated control and system automation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Suggested Courses

770 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