DHCP - Docsis | docsis.org

You are here

DHCP - Docsis

2 posts / 0 new
Last post
DHCP - Docsis


I currently use a software that I develop in php to edit the dhcpd.conf file, after I make a change I have to restart for the changes to be applied, also only one person can use it, because if two people, for example, coincide editing or doing a registration of a new user can cause an error in the correct writing of all the information in the dhcpd.conf file.

What alternative can I use to solve this, to have a dhcp that several people can manipulate at the same time, to edit, register, change plans, without any problem.


The front end script where

The front end script where people are making changes should not directly write the dhcpd.conf / restart dhcpd

You should split it into 2 scripts.
For example

The front end script should be manipulating a database (modems / plans etc)
Multiple people can be using the front end simultaneously.

Back end script runs periodically from crontab, doing steps like this :
* extract the information from database and writes dhcpd.conf.new
* compare ("diff") dhcpd.conf.new to the running dhcpd.conf
* If a change is detected :
-- For sanity purposes check the diff for how many lines have changed. If over a particular threshold abort and send an email warning (something has gone wrong, too many changes, you dont want to overwrite the current config with this potentially faulty config)
-- otherwise cp dhcpd.conf dhcpd.conf.old, cp dhcpd.conf.new dhcpd.conf, restart dhcpd

Or rather than running from crontab and building entire file every time, backend script might be checking a database table for a flag "rebuild required" or somesuch which has been set when front end script has made a change. When backend script sees this flag : it clears the flag / rebuilds the dhcpd.conf / restarts dhcpd

Log in or register to post comments