Force DHCP to reread config???



  • I need to force IPv4-changes for some devices at our network (new IPv4-addresses at the beginning of every day).

    For the devices I have created static DHCP mappings where defaultleasetime=3600 and maxleasetime=7200. And related to changing the mapped IPv4-addresses I have created a script that changes the mapping IPv4-addresses in the /cf/conf/config.xml file and afterwards deletes the /tmp/config.cache file.

    But I have one problem:
    How do I force the DHCP-service to reread the configuration (from /cf/conf/config.xml) and possibly restart the service. - From a command line script…



  • Wouldn't shorter lease associated with DHCP service stop/start in crontab do the job?



  • Possibly… A lot of devices try to renew their IPv4-address when it expires, and they can therefore maintain the same IP because the DHCP-client just request renewal.

    But that's not what I was asking for. I was quite simply asking for a command to force DHCP to read the config. When you create changes in the webinterface, you're asked to read the changes into the service. I am simply looking for the same feature initiated from the command line.



  • As far as I know, the only way to get the dhcp daemon to re-read the config is to restart the service.

    run a 'kill -9' against the dhcpd service, then:

    /usr/local/sbin/dhcpd -user dhcpd -group _dhcp -chroot /var/dhcpd -cf /var/dhcpd/etc/dhcpd.conf [interface_your_dhcp_service_listens_on]

    If what you mean is what command updates the dhcpd.conf file from the config.xml file, I think that may be more of a developer question. Not sure what sets the rest of the system configs from the main config.xml, but if someone else knows maybe they'll post the answer shortly.





  • You're right… I have just tested it by running the following command:
    pfSsh.php playback restartdhcpd
    And when I afterwards looked into the /var/dhcpd/etc/dhcpd.conf file I saw the changes.

    Unfortunately this means that I have misdiagnosed the problem:
    We have 2 pfSense firewalls connected in a redundancy setting using CARP/pfsync/XMLRPC Sync. And these DHCP-changes are not transferred to the second firewall.

    When I login to the master-firewall webinterface and apply the DHCP-settings they are transferred to the secondary firewall. But the changes created by scripts are not transferred automatically.



  • Related to the link… That's the reason why I wrote that I deleted the /tmp/config.cache file (second paragraph of initial statement).


Log in to reply