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

    Restart DHCPD via console / ssh / commandline

    Scheduled Pinned Locked Moved DHCP and DNS
    6 Posts 3 Posters 7.3k 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.
    • luckman212L
      luckman212 LAYER 8
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • DerelictD
        Derelict LAYER 8 Netgate
        last edited by

        This should do it:

        pfSsh.php playback restartdhcpd

        Or option 12 at the console menu then playback restartdhcpd.

        Chattanooga, Tennessee, USA
        A comprehensive network diagram is worth 10,000 words and 15 conference calls.
        DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
        Do Not Chat For Help! NO_WAN_EGRESS(TM)

        cmcqueenC 1 Reply Last reply Reply Quote 1
        • luckman212L
          luckman212 LAYER 8
          last edited by

          Exactly what I needed, thank you! :)

          1 Reply Last reply Reply Quote 0
          • cmcqueenC
            cmcqueen @Derelict
            last edited by

            @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.

            DerelictD 1 Reply Last reply Reply Quote 0
            • DerelictD
              Derelict LAYER 8 Netgate @cmcqueen
              last edited by

              @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 or killall -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.

              Chattanooga, Tennessee, USA
              A comprehensive network diagram is worth 10,000 words and 15 conference calls.
              DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
              Do Not Chat For Help! NO_WAN_EGRESS(TM)

              cmcqueenC 1 Reply Last reply Reply Quote 1
              • cmcqueenC
                cmcqueen @Derelict
                last edited by

                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...

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