Restart DHCPD via console / ssh / commandline
-
Is there a (relatively) simple way to restart the dhcpd service from the commandline? I went meandering through the source code and fell down the rabbit hole pretty fast. I found /usr/local/www/status_services.php and saw that it referenced a function called services_dhcpd_configure() which is contained in /etc/inc/service-utils.inc – but when I started browsing through that I started to drown.
Is this possible to do? much obliged
-
This should do it:
pfSsh.php playback restartdhcpd
Or option 12 at the console menu then playback restartdhcpd.
-
Exactly what I needed, thank you! :)
-
@derelict said in Restart DHCPD via console / ssh / commandline:
pfSsh.php playback restartdhcpd
Is there a way to do it without having the configuration files be overwritten? Namely
/var/dhcpd/etc/dhcpd.conf
and
/var/dhcpd/etc/dhcpdv6.conf
.I am hoping to edit
dhcpdv6.conf
just for experimentation, but when I restart dhcpd using the above command, my changes get overwritten. -
@cmcqueen Are you making manual changes to the files then restarting it? It is expected that they will be rewritten in that case. It is not supported in pfSense.
You could
ps -axwwww | grep dhcpd
, get the proper command line, kill it, then re run the command line./root: ps -axwww | grep dhcp ... 96112 - Ss 0:00.30 /usr/local/sbin/dhcpd -user dhcpd -group _dhcp -chroot /var/dhcpd -cf /etc/dhcpd.conf -pf /var/run/dhcpd.pid vtnet0 vtnet2
/root:
kill 96612
/root:/usr/local/sbin/dhcpd -user dhcpd -group _dhcp -chroot /var/dhcpd -cf /etc/dhcpd.conf -pf /var/run/dhcpd.pid vtnet0 vtnet2
There is probably a better way to reload the configuration like
kill -HUP 96112
orkillall -HUP dhcpd
but you'd need to dig into the ISC dhcpd docs to get the proper method.Again, totally unsupported. If you want to manually configure dhcpd you could just use FreeBSD or Linux.
-
Thanks, that's very helpful.
I understand this is unsupported in pfSense. I'm experimenting because I'm an embedded firmware engineer working with a product that wants to get vendor config from DHCPv6.
@derelict said in Restart DHCPD via console / ssh / commandline:
There is probably a better way to reload the configuration like kill -HUP 96112 or killall -HUP dhcpd but you'd need to dig into the ISC dhcpd docs to get the proper method.
According to How to reload the dhcpd configuration file
At this time, the dhcpd server doesn't have any reload mechanism. It doesn't handle HUP signal nor have a 'soft' reconfiguration method. The server has to be stopped and restarted...