Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Force DHCP to reread config???

    Scheduled Pinned Locked Moved DHCP and DNS
    7 Posts 3 Posters 2.9k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J Offline
      jtranholm
      last edited by

      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…

      1 Reply Last reply Reply Quote 0
      • C Offline
        chris4916
        last edited by

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

        Jah Olela Wembo: Les mots se muent en maux quand ils indisposent, agressent ou blessent.

        1 Reply Last reply Reply Quote 0
        • J Offline
          jtranholm
          last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • M Offline
            muswellhillbilly
            last edited by

            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.

            1 Reply Last reply Reply Quote 0
            • M Offline
              muswellhillbilly
              last edited by

              Hold the phone. What about this? https://doc.pfsense.org/index.php/How_can_I_reload_the_config_after_manually_editing_config.xml

              1 Reply Last reply Reply Quote 0
              • J Offline
                jtranholm
                last edited by

                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.

                1 Reply Last reply Reply Quote 0
                • J Offline
                  jtranholm
                  last edited by

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

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post
                  Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.