OpenBSD: Reload / Restart / Stop dhcpd Server Command

I manage MS-Windows server and recently started to play with OpenBSD server. How do I reload or restart the dhcpd server on OpenBSD using shell command line option?

Tutorial details
DifficultyEasy (rss)
Root privilegesYes
Requirementsdhcpd
Time1m
If you made changes to the configuration of your DHCP (dhcpd) server, you will have to stop and restart the server manually. On OpenBSD and Unix like operating system, you kill the dhcpd server and restart manually. Another option is to send HUP (SIGHUP) to dhcpd server.

ADVERTISEMENTS

Method#1: Find dhcpd PID and kill it

Type the following ps command to find dhcpd PID as root user:
# ps ax | grep dhcpd
Sample outputs:

USER       PID %CPU %MEM   VSZ   RSS TT   STAT STARTED       TIME COMMAND
_dhcp    13420  0.0  0.1   588   568 ??  Ss    10:27PM    0:00.04 dhcpd re0

You need to kill that process with kill command.
# kill -9 13420

To start dhcpd, type the following commands:
# touch /var/db/dhcpd.leases
# dhcpd -q re0

Method #2: Say hello to /etc/rc.d/dhcpd script

You can skip all of the above commands. Use rc script as follows to start, stop, restart, and check dhcpd server on OpenBSD:
/etc/rc.d/dhcpd start
/etc/rc.d/dhcpd stop
/etc/rc.d/dhcpd restart
/etc/rc.d/dhcpd check

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallCentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
4 comments… add one
  • Tom Feb 21, 2014 @ 17:14

    Why would you kill -9? That should only be used when a process is not responding.

  • df Oct 27, 2016 @ 10:13

    I’m using OpenBSD 6.0 and I know dhcpd is running (clients obtain leases), but I don’t have it on my list of processes:

    root@openbsd /root# ps aux | grep dhcpd
    root 49136 0.0 0.0 1996 1488 p0 R+ 12:10PM 0:00.00 grep dhcpd (z

    How do I check it’s PID?

    • Adrian Thompson Jan 4, 2017 @ 16:58

      Not really sure why you asked this question the PID is in your comments 49136.
      do a
      /etc/rc.d/dhcpd check
      /etc/rc.d/dhcpd restart
      ps -axc | grep ‘dhcpd’ | sed -E ‘s/([^ ]+){1}.*/\1/’
      That will give you your pid

      • Werner Strydom Jan 15, 2017 @ 1:09

        Adrian, 49136 looks like PID for the “grep” command and not DHCPD. I ran into this a couple of times before.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.