|
|
If there is no IP address specified for a DHCP client in the DHCP configuration file, dhcpd requests an address from the Address Allocation Server (aasd) which allocates an address from a pool of addresses consistent with the client's subnet. The Address Allocation Server provides the same service to other daemons which need to assign temporary addresses.
dhcpd can be configured to run from inetd by including the following line in the file /etc/inetd.conf:
bootps dgram/i udp wait root /etc/dhcpd dhcpdThis mode of operation is referred to as ``inetd mode'' and causes dhcpd to be started only when a DHCP request arrives. If it does not receive another packet within fifteen minutes of the last one it received, it will exit to conserve system resources. The -t option controls this timeout (see ``Options'').
When running dhcpd and bootpd on the same host, dhcpd forwards BOOTP packets to the port specified with the -b option. bootpd must be run in "slave mode" (with the -S option). In this mode, bootpd listens on an alternate port. The port ``bootps-alt'' is defined to be 950 in /etc/services, but it can be anything less than 1024.
To run dhcpd and bootpd on the same host from inetd, use the following two lines in the file /etc/inetd.conf:
bootps dgram/i udp wait root /etc/dhcpd dhcpd -b bootps-alt bootps-alt dgram udp wait root /etc/bootpd bootpd -Sdhcpd can also uses BOOTP gateways (see bootpgw(ADMN)) to forward DHCP packets to DHCP clients on another subnet.
It is also possible to run dhcpd in ``standalone mode'' (without inetd) by simply invoking it from a shell like any other regular command. dhcpd automatically detects whether it was invoked from inetd or from a shell and automatically selects the appropriate mode.
To run dhcpd and bootpd on the same
host in ``standalone mode'', use the following two
commands:
/etc/dhcpd -b port
/etc/bootpd -S -P port
where port is the alternate port where bootpd is listening for BOOTP packets forwarded by dhcpd.
When dhcpd receives a packet, it checks the modification time of the configuration file and reloads the database if necessary. It then constructs the set of parameters corresponding to the client from the DHCP configuration file and responds to the client.
During initialization, dhcpd determines the UDP port numbers to be used by calling getservbyname (see getservent(SLIB)) which normally reads /etc/services. Two service names (and port numbers) are used: