• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

CentOS / RHEL 7 : How to specify command-line arguments and options when the dhcpd service is started

By admin

Dynamic Host Configuration Protocol (DHCP) allows client machines to automatically obtain network configuration information from a DHCP server each time they connect to the network. The DHCP server is configured with a range of IP addresses and other network configuration parameters.

When the client machine is configured to use DHCP, the client daemon, dhclient, contacts the server daemon, dhcpd, to obtain the networking parameters. Because DHCP is broadcast based, both the client and the server must be on the same subnet.

Specifying command-line arguments and options while starting dhcpd service

1. To specify command-line arguments and options when the dhcpd service is started, copy the /usr/lib/systemd/system/dhcpd.service file to the /etc/systemd/system/ directory:

# cp /usr/lib/systemd/system/dhcpd.service /etc/systemd/system/

2. You can then edit the /etc/systemd/system/dhcpd.service file and append command-line arguments and options to the ExecStart line. For example, if your DHCP server has multiple network interfaces (eth0, eth1, eth2) but you want only the dhcpd service to listen for DHCP requests on eth2, include eth2 as a command-line argument:

# vi /etc/systemd/system/dhcpd.service ExecStart=/usr/sbin/dhcpd -f -cf /etc/dhcp/dhcpd.conf -user
dhcpd -group dhcpd --no-pid eth2

3. When you enable the service to start at boot time, a symbolic link is created to the dhcpd.service file in the /etc/systemd/system/ directory rather than the file in the /usr/lib/systemd/system/ directory:

# systemctl enable dhcpd
ln –s ‘/etc/systemd/system/dhcpd.service’ ‘/etc/systemd/system/multi-user.target.wants/dhcpd.service’

Refer to the dhcpd man page for additional command-line options and arguments. Some of the most commonly available options are described below:

  • -p [port]: Specifies the UDP port number on which dhcpd listens. The default is port 67.
  • -f: Runs the dhcpd as a foreground process instead of a background daemon. This is helpful when debugging a problem.
  • -d: Logs the DHCP server daemon to the standard error descriptor. This is helpful when debugging. If this is not specified, dhcpd logs all output using syslog.
  • -cf [filename]: Specifies the location of the configuration file. The default configuration file is /etc/dhcp/dhcpd.conf.
  • -lf [filename]: Specifies the location of the lease database file. The default lease file is /var/lib/dhcpd/dhcpd.leases.
  • -q: Specifies to be quiet at startup. This suppresses printing of the entire copyright message when starting the daemon.
  • –no-pid: Disables writing pid (Process ID) files. With this option, the service does not check for an existing server process.

Filed Under: CentOS/RHEL 7, Linux

Some more articles you might also be interested in …

  1. 5 Useful Command Examples to Monitor User Activity under Linux
  2. CentOS / RHEL : How to find RPM installation date and time
  3. Unable to set a GRUB password on a Raspberry Pi 3 system
  4. How to resize (extend) a partition-based file system in Linux
  5. How to load SELinux Module For Oracleasm
  6. CentOS / RHEL 7 : Configuring an NFS server and NFS client
  7. How to Setup a squid proxy server on CentOS/RHEL 7
  8. How to disable write access to USB devices using “hdparm” tool
  9. Linux OS Service ‘cpuspeed’
  10. How to Configure iSCSI Initiator and iSCSI Timeouts in CentOS/RHEL 7

You May Also Like

Primary Sidebar

Recent Posts

  • How to disable ACPI in CentOS/RHEL 7
  • How to Use real-time query to access data on a physical standby database
  • CentOS/RHEL 8: “ACPI MEMORY OR I/O RESET_REG” Server Hung after reboot
  • How to Create a Physical Standby Database by Using SQL and RMAN Commands
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary