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

    How to restart dhcpd?

    Scheduled Pinned Locked Moved DHCP and DNS
    4 Posts 4 Posters 8.5k 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.
    • G
      gwa
      last edited by

      Running a Captive Portal for a library. They want access turned off after hours. If I use cron to set LAN interface to down, sometimes the DHCP server stops. I can issue the start command via cron:

      /usr/local/sbin/dhcpd -user dhcpd -group _dhcp -chroot /var/dhcpd -cf /var/dhcpd/etc/dhcpd.conf vr0

      but sometimes dhcpd is already running. Is there a restart option or script?

      Thanks

      1 Reply Last reply Reply Quote 0
      • P
        pmvalente
        last edited by

        I'm not the most qualify person to sugest this, but why don't you invoke stop dhcpd first and then start it?

        1 Reply Last reply Reply Quote 0
        • jahonixJ
          jahonix
          last edited by

          Just use a different approach!

          At  Firewall | Schedules  create surftimes or off-times and apply them to allow or deny rules.
          This way traffic gets blocked by a rule and not because an IF is down. Solves your problems with the DHCP server instantly.

          1 Reply Last reply Reply Quote 0
          • jimpJ
            jimp Rebel Alliance Developer Netgate
            last edited by

            The scheduled rules approach should work.

            That said, if you want to continue using your cron method your best option is to killall -9 dhcpd before restarting it, that way it won't ever be running when you run it from cron.

            Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

            Need help fast? Netgate Global Support!

            Do not Chat/PM for help!

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