LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
LinkBack Search this Thread
Old 10-14-2012, 03:37 AM   #1
Linux Chips
LQ Newbie
 
Registered: Jul 2011
Posts: 21

Rep: Reputation: Disabled
external script/program - dhcp server


Hi All

i want to set up a new dhcp server, but what i need is not a static configurations. i want to calculate one of the options in an external script/program and give the results back, so it can be included in the offer packet. the closest thing i have found is "execute", but i can't get an output from it.
are there other servers with such a feature? or do i need to hack some code?

if i will be adding this to the source, any hints/suggestions will be appreciated.

thanks in advance
 
Old 10-14-2012, 11:43 AM   #2
Noway2
Senior Member
 
Registered: Jul 2007
Distribution: Ubuntu 10.10, Slackware 64-current
Posts: 2,120

Rep: Reputation: 776Reputation: 776Reputation: 776Reputation: 776Reputation: 776Reputation: 776Reputation: 776
From the DHCP man page:
Quote:
Dhcpd can be made to use an alternate configuration file with the -cf flag, an alternate lease file with the -lf flag, or an alternate pid file with the -pf flag. Because of the importance of using the same lease database at all times when running dhcpd in production, these options should be used only for testing lease files or database files in a non-production environment.
You will probably want to modify the init script that starts the DHCP server to perform the tests required and then select the appropriate file.
 
Old 10-15-2012, 04:36 AM   #3
Linux Chips
LQ Newbie
 
Registered: Jul 2011
Posts: 21

Original Poster
Rep: Reputation: Disabled
Post

hi Noway2

thanks for your reply, though it dose not serve my purpose. this is kind of static configurations selected at start up. what i need is to give back replies based on the request. e.g. based on mac address or time of day and some other attributes. so i can do something like:

Code:
    subnet 192.168.0.0 netmask 255.255.255.0 {
    range 192.168.0.20 192.168.0.250;
    option domain-name execute_GetOutPut(getdomainname,clientmac);
    option domain-name-servers execute_GetOutPut(getdomainip,clientmac);;
    option broadcast-address 192.168.0.255;
    option routers 192.168.0.1;
    next-server 192.168.0.1;
    option subnet-mask 255.255.255.0;
}
getdomainname would be an executable that would print the correct domain for this device to stdout.
any other ideas?? is it even possible??
 
Old 10-15-2012, 03:09 PM   #4
Noway2
Senior Member
 
Registered: Jul 2007
Distribution: Ubuntu 10.10, Slackware 64-current
Posts: 2,120

Rep: Reputation: 776Reputation: 776Reputation: 776Reputation: 776Reputation: 776Reputation: 776Reputation: 776
I don't know of any way to call functions dynamically from within the configuration file. I also don't know if DHCP supports this type of function. In all likelihood, you would have to modify the process daemon that performs the initialization to read this configuration line and make the call(s) and then set the options. The closest thing I know of in DHCP is to filter based on an attribute like MAC address and make static assignments. If you have a large number of entries, this could be a monster to feed and support.

My honest suggestion would be to take another look at how your network is partitioned and see if there is a way to break things down into more logical groupings that you could then zone off into common sections and write DHCP blocks for these sections.
 
Old 10-16-2012, 03:43 AM   #5
Linux Chips
LQ Newbie
 
Registered: Jul 2011
Posts: 21

Original Poster
Rep: Reputation: Disabled
thanks Noway2.... i am afraid that my setup requires per single user configuration and it would be very hard to put it all in a config file.
if any one is interested/willing to help , i ll try and dive into the code when i get some free time. if i get some thing working i ll be posting the result back here.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
shell script for a partial control over inputs to an external program njain Linux - Software 1 05-19-2010 07:57 PM
Run external program from python script MTK358 Programming 1 12-21-2009 06:26 PM
Script or program for continuously retrying to get an IP via DHCP Ken-ji Slackware 4 06-18-2008 12:30 AM
PHP script to retrieve records from MYSQL db and pass them to an external program Julianus Programming 3 08-03-2006 02:09 PM
dhcp server dropping external ip schurt Linux - Networking 7 07-11-2004 10:29 PM


All times are GMT -5. The time now is 03:17 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration