0. Introduction

This is an RFC2131,RFC2132, and RFC1541 compliant DHCP client daemon.
RFC1541 was obsoleted by RFC2131, but there are still some RFC1541 compliant
DHCP servers. dhcpcd gets an IP address and other information from a
corresponding DHCP server, configures the network interface
automatically, and tries to renew the lease time according to RFC2131
or RFC1541 depending on the command line option.

1. Install

Make sure your kernel is compiled with support for SOCK_PACKET
(CONFIG_PACKET option). Cd to source distribution directory. Do
./configure --prefix=/
Please note the GNU default installation --prefix=/usr/local
is not what most users want for dhcpcd installation.
Edit Makefile to customize compile time options.
Do 'make' followed by 'make install'.
To enable dhcpcd error logging add the following line to your
/etc/syslog.conf file:
local0.*          /var/log/dhcpcd.log
and then refresh syslogd daemon:
kill -1 `cat /var/run/syslogd.pid`

Note
If you replace your network card or upgrade to a different version of
dhcpcd you might not be able to obtain the same old IP address from
DHCP server. This is because the DHCP server identifies clients by
ClientID DHCP option which by default is MAC address of the network
card. The work around is to use -I ClientID  option with some
unique "ClientID" string.
Also, upgrading to a different version of dhcpcd invalidates *.cache
file where dhcpcd stores IP address which it tries to renew on restart.

2. How to Use It

Invoke the client by typing 'dhcpcd'. Note you should NOT
explicitly put it in the background with the '&' character -
background processing is automatic unless 'dhcpcd' was
compiled with -DDEBUG flag. Dhcpcd will fork into background
as soon as it configures the interface. By default, dhcpcd will
attach to 'eth0' unless you explicitly give an interface name on the
command line.
The example below demonstrates dhcpcd usage in a case where
linux box serves as a router/firewall for the local network 192.168.12.0.

if dhcpcd eth1; then
  inetd
  /usr/sbin/sendmail -bd
  httpd
  echo 1 > /proc/sys/net/ipv4/ip_forward
  modprobe ip_tables
  modprobe iptable_nat
  modprobe iptable_filter
  modprobe ipt_MASQUERADE
  modprobe ip_nat_ftp
  modprobe ip_conntrack_ftp
  iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
else
  echo "****  Unable to configure eth0"
fi

The bootup process will wait until 'dhcpcd' configures
interface or until dhcpcd times out before proceeding further.

Any time dhcpcd configures or shuts down interface it will try to
execute /etc/dhcpc/dhcpcd.exe script with appropriate
parameters passed. The exact pathname of the executable script can be
changed with "-c ExecFilePath" dhcpcd option. The <ConfigDir>
directory can be specified with "-L <ConfigDir>" option, otherwise
it defaults to /etc/dhcpc/. The dhcpcd.exe script invokation is:
/etc/dhcpc/dhcpcd.exe <HostInfoFilePath> <up|down|new> [-d]
where <HostInfoFilePath> is actually <ConfigDir>/dhcpcd-<interface>.info
file; optional parameter [-d] is a debug flag passed if dhcpcd has
been invoked with -d flag.  The second parameter to dhcpcd.exe script is
"up" if the interface has been configured with the same IP
address as before reboot, "down" if the interface has been shut
down, "new" if the interface has been configured with new IP address.

3. Supported DHCP Options

The current version of dhcpcd supports the following DHCP options:

  o lease time
  o renewal (T1) time
  o rebind (T2) time
  o netmask
  o broadcast address
  o router
  o dns
  o host name
  o domain name
  o nis domain name
  o nis servers
  o ntp servers
  o static routes

5. Cache File

dhcpcd saves the assigned IP address into the file
/var/cache/dhcpcd-<interface>.cache (the word <interface> is actually
replaced with the interface name like eth0, etc. to which dhcpcd is
attached) so that it can try to use that IP address when it is invoked
next time. Remove the file /var/cache/dhcpcd-<interface>.cache before
you invoke dhcpcd unless you like using the previously assigned IP
address.

6. Information File

dhcpcd writes the configuration information into
/var/cache/dhcpcd-<interface>.info file. The word <interface> is actually
replaced with the interface name like eth0, etc. to which dhcpcd is
attached. That file may be included into a Bourne or Korn shell script
to set an environment variables like e.g. HOSTNAME, DOMAIN, NETMASK, etc.
The supplied sample <ConfigDir>/dhcpcd.exe script demonstrates usage
of <ConfigDir>/dhcpcd-<interface>.info file.

7. Other Information

dhcpcd sends DHCP_RELEASE message to the DHCP server, deletes the
/var/cache/dhcpcd-<interface>.cache file and brings the attached
network interface down when it gets SIGHUP signal. It will
not send DHCP_RELEASE message and will not delete
<ConfigDir>/dhcpcd-<interface>.cache file in a case it gets
SIGTERM as normally happens upon reboot.

dhcpcd may be used to obtain multiple IP addresses for the same
dummy interface providing one invokes dhcpcd with
-I ClientID -L ConfigDir -T -c ExecFilePath
options where ClientID and ConfigDir are unique to each of the requested
IP addresses. The same way it can be used to obtain IP addresses
for virtual interfaces, e.g. eth0:1

dhcpcd currently supports only Ethernet link protocol.

8. In case dhcpcd does not work:
   Run 'dhcpcd -d' and mail me the relevant messages from /var/log/dhcpcd.log
   file. Also run
   tcpdump -evvn -i eth0
   and mail the results of that. If the things are too bad for you, reconfigure
   with the --enable-debug option and recompile 'dhcpcd'. Run 'dhcpcd -d' and
   mail what you see.
