Solved

including additional configs outside of dhcpd.conf

Posted on 2004-04-17
9
1,071 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
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
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 
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 250 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
monitor and log every file access on redhat/linux 4 123
Having Returning  Anonymous Function Access Global Function 7 93
Grunt No Clean Targets 6 157
Where do I learn ES6? 3 69
There are two main kinds of selectors in CSS: One is base selector like h1, h2, body, table or any existing HTML tags.  For instance, the following rule sets all paragraphs (<p> elements) to red: (CODE) CSS also allows us to define our own custom …
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 …
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

809 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