Restart DHCP Service



  • I have an issue with a router I have deployed in a hotel with 12 access points. It's not properly turning over DHCP leases as they expire, so the scope becomes full and new devices can't join the network.

    As a solution I've set a cron to reboot the router every three hours and that's working well but it also causes about 30 seconds of downtime every three hours. Is there a way to restart the dhcpd service instead? I've tried isc-dhcpd restart and service dhcpd restart without any luck.

    • <dhcpd>- <lan><enable>- <range><from>10.11.1.30</from>
        <to>10.11.1.252</to></range>
        <defaultleasetime>10800</defaultleasetime>
        <maxleasetime>86400</maxleasetime>
        <netmask><failover_peerip><gateway><ddnsdomain><next-server><filename></filename></next-server></ddnsdomain></gateway></failover_peerip></netmask></enable></lan></dhcpd>

    Thanks for your help!



  • Not directly answering your question - but why do you have the default lease time set to 86400 seconds (24 hours). Maybe that is why you do not see the leases turning over.
    I think the default is 2 hours, and that is likly to be reasonable. Clients that are still running will simply send a request to renew their lease before it expires, thus keeping the same IP address. Clients that are finished will have the lease expire at the end of 2 hours and it can be reused.
    And if you really do have a couple of hundred different devices in a 2 hour period, then expand the subnet and allocate a bigger DHCP range.



  • I personally set the default lease on my guest network to an hour. With how many devices come and go, there's no reason to have a lease time much higher. The difference in traffic between that and a 2+ hour lease is negligible.


  • Rebel Alliance Global Moderator

    While I agree decrease in lease time and or increasing scope for number of ips is better option.  You can restart a service with pfSsh.sh playback svc command servicename

    So example

    [2.1.2-RELEASE][root@pfsense.local.lan]/root(2): pfSsh.php playback svc restart dhcpd

    Starting the pfSense shell system…............

    Attempting to issue restart to dhcpd service...

    dhcpd has been restarted.

    So you could create a cron job for this command if needed..  But it really shouldn't be needed, since leases should expire, etc.



  • I have experimented with different values for lease expiration and settled on a day to try and make it as painless as possible for guests who say check in a 6PM and use their computer the following morning. I was trying to rule out an issue with shorter leases where a single user may be assigned several different addresses thereby consuming multiple addresses over the course of their stay. It seemed like this may have been happening as at any time there may have been 60 devices but yet nearly the entire scope was consumed.

    However, I will change it back to a shorter lease time as I think the real cause of the issue was in the naming of the access points, they had been identical and so guests were jumping between them and I think that was in fact causing the multiple leases to a single device. So now SSID are 1, 2, 3, etc…

    I'll also try setting up a cron with the service reboot, thanks very much.

    Any other suggestions, they are all greatly appreciated.