LinuxCommandLibrary

dhcpd

Assign IP addresses to network devices

SYNOPSIS

dhcpd [-p port] [-d] [-f] [-cf config-file] [-lf lease-file] [-tf trace-file] [interface [ ... interface ]]

PARAMETERS

-p port
    Specifies the UDP port number to listen on. The default is 67.

-d
    Run as a foreground process. Useful for debugging.

-f
    Forces dhcpd to run as a foreground process even if the configuration file specifies background operation.

-cf config-file
    Specifies an alternate configuration file. The default is /etc/dhcp/dhcpd.conf.

-lf lease-file
    Specifies an alternate lease file. The default is /var/lib/dhcp/dhcpd.leases.

-tf trace-file
    Specifies a file to which packet tracing information should be logged.

interface [ ... interface ]
    Specifies the network interfaces to listen on. If no interfaces are specified, dhcpd listens on all broadcast interfaces.

DESCRIPTION

The dhcpd command is a daemon that implements the Dynamic Host Configuration Protocol (DHCP) server. Its primary function is to automatically assign IP addresses and other network configuration parameters to clients on a network, simplifying network administration.

dhcpd reads its configuration from /etc/dhcp/dhcpd.conf (or another specified file) which defines the IP address ranges to lease, lease durations, DNS servers to provide, and other relevant information. It listens for DHCP requests from clients and responds with appropriate offers and acknowledgements.

The server can be configured to provide static IP addresses based on client hardware addresses (MAC addresses), ensuring specific devices always receive the same IP address. It is essential for managing IP address allocation in medium to large networks, and can also be useful in smaller environments to avoid manually configuring each device.

CAVEATS

The dhcpd.conf file must be correctly configured for dhcpd to function properly. Incorrect configuration can lead to IP address conflicts and network instability. The DHCP server needs root privileges to bind to privileged ports and write to the lease file.

CONFIGURATION FILE

The dhcpd.conf file is crucial for configuring the DHCP server's behavior. It defines IP address ranges, lease times, DNS servers, and other DHCP options. The syntax of this file is complex and should be carefully reviewed.

LEASE FILE

The dhcpd.leases file stores information about the IP addresses that have been assigned to clients, their lease expiry times, and associated MAC addresses. It is essential for maintaining the state of the DHCP server and preventing IP address conflicts.

HISTORY

The DHCP protocol was developed to replace the earlier BOOTP protocol. dhcpd has been around for decades as a reliable and widely used DHCP server implementation on Unix-like systems. Over time, it has been improved to support new DHCP options, and has been enhanced with capabilities like failover and dynamic DNS updates.

SEE ALSO

dhclient(8), dhcpd.conf(5), dhcp-options(5)

Copied to clipboard