Hello,
I`m using DHCPD v3 since a few years and without any issue but at the last end it`s time to perform upgrade to ISC-DHCP-Server 4.1. For this purpose i`ve recently removed dhcp v3 from a linux server and upgraded the server with
yum install dhcp*.-
After performing the command the server was installed, i did the configuration of dhcpd.conf file and also linked our asmart.conf to dhcpd.conf. After couple hours I had a issue that the dhcp was offering two different offers to every cable modem. After two days, i even saw more then that. there are plenty of duplicate messages going to the modems.
After studing the dhcp server for a few hours or days, i notices that there is a PID file for every process.
In my case i got into the directory /var/run/ and saw the file dhcpd.pid.
[root@network ~]# cd /var/run/ [root@network run]# ls -l dhcpd.pid -rw-r--r--. 1 root root 5 Sep 13 21:51 dhcpd.pid
After checking if the dhcp server is running, i noticed that the dhcp is running.
[root@network run]# service dhcpd status dhcpd (pid 3283) is running...
On the dhcpd.pid file i notice the same PID - process ID of the dhcp server service.
So up to here everything seems to be correctly working
But if you check the dhcp process, you`ll notice couple instances of dhcp server running on the same port. 69 .
[root@ABS run]# ps aux | grep -i dhcp dhcpd 6666 0.0 0.2 56148 9372 ? Ss 01:27 0:00 /usr/sbin/dhcpd -user dhcpd -group dhcpd eth0 dhcpd 7173 0.0 0.2 56148 9372 ? Ss 01:28 0:00 /usr/sbin/dhcpd -user dhcpd -group dhcpd eth0 dhcpd 7574 0.0 0.2 56148 9376 ? Ss 01:28 0:00 /usr/sbin/dhcpd -user dhcpd -group dhcpd eth0 dhcpd 7601 0.0 0.2 56148 9376 ? Ss 01:28 0:00 /usr/sbin/dhcpd -user dhcpd -group dhcpd eth0 root 7613 0.0 0.0 105372 880 pts/0 S+ 01:28 0:00 grep -i dhcp
If you check the dhcp logs that are written to /var/log/messages, you`ll notice for every message duplicates like
multiple dhcp packs, multiple dhcp discovers, offers and so one.
The problems begins here if you do any change to the hosts on dhcp server. The Server is forwarding multiple dhcp offers with multiple filenames and multiple services and the cable modem is sometimes accepting the right one and sometimes the wrong one.
Even if you remove any host to de-activate his internet access, he will get the last config file that he had.
Also de-activation won`t work at all as you can see below.
After typing pkill -9 dhcpd , i saw that multiple instances are gone or even if I reboot the cmts all instances are being removed.
Then i looked into the dhcpd file, located in /etc/init.d/ directory where everything begins when we execute anything on the dhcp service. I added a line when you start the dhcp service to stop first every instance of the dhcp server.
start() { [ `id -u` -eq 0 ] || return 4 [ -x $exec ] || return 5 [ -f $config ] || return 6 #Added By A.GASHI to close the process on every start command killproc $prog rh_status_q && return 0 echo -n $"Starting $prog: " # tell portreserve to release the port [ -x /sbin/portrelease ] && /sbin/portrelease dhcpd &>/dev/null || : daemon --pidfile=$pidfile $exec -user $user -group $group $DHCPDARGS 2>/dev/null RETVAL=$? echo [ $RETVAL -eq 0 ] && touch $lockfile return $RETVAL }
On stop i changed the stop without any pid.
stop() { [ `id -u` -eq 0 ] || return 4 rh_status_q || return 0 echo -n $"Shutting down $prog: " # Comment out this line -> killproc -p $pidfile $prog #AND Added the below line to Closs the process based on the program and not pid killproc $prog RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f $lockfile return $RETVAL }
To perform the tests i used the below commands
autofs.fifo-misc ConsoleKit dhcpd.pid lvm ntpd.pid rpcbind.sock sm-notify.pid winbindd [root@ABS run]# ps aux | grep -i dhcp dhcpd 12763 0.0 0.2 56148 9372 ? Ss 01:40 0:00 /usr/sbin/dhcpd -user dhcpd -group dhcpd eth0 root 12898 0.0 0.0 105372 872 pts/0 S+ 01:40 0:00 grep -i dhcp [root@ABS run]# rm -rf dhcpd.pid [root@ABS run]# service dhcpd start Starting dhcpd: [ OK ] [root@ABS run]# ps aux | grep -i dhcp dhcpd 13057 0.0 0.2 56148 9376 ? Ss 01:40 0:00 /usr/sbin/dhcpd -user dhcpd -group dhcpd eth0 root 13097 0.0 0.0 105372 876 pts/0 S+ 01:40 0:00 grep -i dhcp [root@ABS run]#
As you can see even after removing the dhcpd.pid the dhcp server instance isn`t created twice and this issue seems to be solved.
Probably that`s not the best way to solve it, but as this brings to me a solution, i`ll stick to this until any other solution that i`ll get.