• 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. How to Set Environment Variables for a systemd Service in CentOS/RHEL 7
  2. How to manage File and Directory Permissions/Ownerships in Linux
  3. CentOS / RHEL 7 firewalld : Command line reference (Cheat Sheet)
  4. How to configure and Manage Network Connections using nmcli
  5. RHEL 7 – RHCSA Notes : Configure a system to use time services
  6. NFSv4 Client Shows “nobody” As Owner And Group For Mount Point (CentOS/RHEL)
  7. How to extract RPM package without installing it
  8. CentOS / RHEL 6 : How to disable telnet service
  9. How to change the default location (/var/cache/yum) of yum cache
  10. How to Check if any of the RPM files were tampered with

You May Also Like

Primary Sidebar

Recent Posts

  • What are different Oracle Database Vault Roles
  • Unable to export realm protected table using data pump
  • Beginners Guide to Oracle Database Vault
  • How to Disable IPv6 on Ubuntu 18.04 Bionic Beaver Linux
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary