home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  

Book HomeTCP/IP Network AdministrationSearch this book

D.2. The dhcpd Command

The syntax of the dhcpd command is:

 dhcpd [-p port] [-f] [-d] [-cf config-file] [-lf lease-file] [if0 [ifn]] 

dhcpd usually is run without any command-line arguments. Most of the arguments are used only when testing and debugging. Two of the command-line arguments handle special configuration requirements:


Runs dhcpd in foreground mode. By default, dhcpd runs as a background daemon process. Use -f when dhcpd is started from inittab on a System V Unix system.

if0 [...ifn]

Lists the interfaces on which dhcpd should listen for BOOTREQUEST packets. This is a whitespace-separated list of interface names. For example, dhcpd ec0 ec1 wd0 tells dhcpd to listen to interfaces ec0, ec1, and wd0. Normally this argument is not required. In most cases dhcpd locates all installed interfaces and eliminates the no-broadcast interfaces automatically. Use this argument only if it appears that dhcpd is failing to locate the correct interfaces.

All of the remaining command-line arguments are used for debugging or testing:

-p port

Causes dhcpd to listen to a nonstandard port. The well-known port for DHCP is 67. Changing it means that clients cannot talk to the server. On rare occasions this is done during testing.


Routes error messages to stderr. Normally error messages are written via syslog with facility set to DAEMON.

-cf config-file

Causes dhcpd to read the configuration from the file identified by config-file instead of from dhcpd.conf. Use this only to test a new configuration before it is installed in dhcpd.conf. Use the standard file for production.

-lf lease-file

Causes dhcpd to write the address lease information to the file identified by lease-file instead of to dhcpd.leases. Use this only for testing. Changing the name of the lease file could cause dynamic addresses to be misallocated. Use this argument with caution.

Kill the dhcpd daemon with the SIGTERM signal. The process ID (PID) of the dhcpd daemon is found in the /var/run/dhcpd.pid file. For example:

 # kill -TERM 'cat /var/run/dhcpd.pid'

dhcpd uses three files. It writes its PID to /var/run/dhcpd.pid, maintains a record of dynamic address leases in /var/db/dhcpd.leases, and reads its configuration from /etc/dhcpd.conf. These last two files are created by you. Create an empty lease file before you run dhcpd the first time, e.g., touch /var/db/dhcpd.leases. Create a configuration and store it in dhcpd.conf.

Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.