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.

 

War diese Antwort hilfreich? 0 Benutzer fanden dies hilfreich (0 Stimmen)