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.

dhcpcd-1.3 has been reported to compile
on Intel,PPC, and Alpha-based Linux platforms
providing glibc-2.0.5 or later has been
installed. Please refer to the Notes below for details.
Steve Dunham <dunham@cps.msu.edu> put together
a patch for dhcpcd-1.3 to make it work on
Linux Sparc and ARM platforms. The patch is available at
http://www.cse.msu.edu/~dunham/out/dhcpcd-align.patch.

dhcpcd-1.3 has been reported as compatible with DHCP servers
used by the following network service providers:

1. Time Warner RoadRunner http://www.rr.com/
2. MediaOne (now AT&T Broadband) http://www.mediaone.com/
3. @Home Networks http://www.home.com/
4. France Telecom ADSL http://www.wanadoo.fr/
5. USWest.net DSL http://www.uswest.com/
6. France CyberCable http://www.cybercable.fr/
7. BellSouth ADSL http://www.bellsouth.net/
8. BCtel Multimedia Gateway ADSL http://www.bctel.net/
9. Cogeco Cable Canada http://www.cogeco.ca/
10.Sympatico High Speed Edition ADSL http://www.hse.sympatico.ca/
11.Adelphia PowerLink http://powerlink.adelphia.net/
12.Videotron, Canada http://www.videotron.ca/
13.Access Cable, Nova Scotia, Canada http://www.accesscable.net/
14.A2000 Cable, Netherlands http://www.a2000.nl/
15.Tele-Communications, Inc http://www.tci.com/
16.Telenet, Belgium http://www.telenet.be/
17.Telekabel Wien, Austria http://www.telekabel.at/
18.RMCnet, France http://www.rmcnet.fr/
19.Retecal, Spain http://www.retecal.es/
20.TVD, Belgium  http://www.tvd.net/
21.Optimum Online, NY  http://www.optimumonline.com/
22.Knology Comm.  http://www.knology.com/
23.Highpernet, Switzeland. http://www.highpernet.ch/
24.TeledisNet, Belgium. http://www.teledisnet.be/
25.Southwestern Bell DSL. http://www.swbell.net/
26.Brutele, Belgium.  http://www.brutele.be/
27.Telus, Canada.  http://www.telusplanet.net/
28.Chello, Netherlands.  http://www.chello.nl/
29.RCN. http://www.rcn.com/
30.Pandora, Belgium. http://www.pandora.be/
31.Armstrong's Cable Services, PA. http://www.zbzoom.net/
32.21st Century, Chicago. http://www.21stcentury.net/
33.Supercable, Spain. http://www.supercable.es/
34.Primacom, Germany. http://www.primacom.net/
35.Click! Network, Tacoma, WA. http://www.click-network.com/
36.Telocity, Cupertino, CA. http://www.telocity.com/
37.Charter Communications. http://www.chartercom.com/
38.Tebenet, Netherlands. http://www.tebenet.nl/
39.ZoomTown, Cincinnati, OH. http://www.zoomtown.com/
40.Telecom New Zealand Jetstream ADSL. http://www.telecom.co.nz/
41.Belgacom Turboline ADSL. http://www.turboline.be/
42.ISP Channel. http://www.ispchannel.com/
43.Telia.Com Sweden. http://www.telia.com/
44.Netcabo Portugal. http://www.netcabo.pt/
45.CyberCity xDSL, Denmark. http://www.cybercity.dk/
46.Tokyo Metallic Comm. http://www.metallic.co.jp/
47.Telenor, Norway. http://www.telenor.no/
48.Telstra, Austria. http://www.telstra.com/
49.Look Wireless, Montreal. http://www.look.ca/
50.Virtua, Brazil. http://www.virtua.com.br/
51.Verizon DSL. http://www.verizon.com/dsl/
52.Sonera, Netherlands. http://www.soneraplaza.nl/
53.NTL, UK. http://www.ntl.co.uk/cablemodems/
54.Telewest, UK. http://www.telewest.co.uk/
55.VTR, Chile. http://www.vtr.net/
56.Millennium Digital Media. http://www.mdm.net/

if you have been successfully using dhcpcd-1.3
on your network please report the fact along
with network provider's name/URL/whatever and dhcpcd version
to the author <sv@phystech.com>.

dhcpcd-1.3 primary web site is
http://www.phystech.com/download/
ftp://ftp.phystech.com/pub/

1. Install

Make sure your kernel is compiled with support for SOCK_PACKET
(CONFIG_PACKET option). Cd to source distribution directory.
Do ./configure --prefix=/
Edit Makefile to customize compile time options.
Do 'make' followed by 'make install'.

  Note 1.
    to compile dhcpcd-1.3.X you have to install glibc-2.0.5 or later.
    dhcpcd-1.3.X will not compile under libc.5.
    If you don't have glibc installed you can use the precompiled
    binary included with the distribution.
    If you are trying to compile dhcpcd yourself and getting error
    "cannot find net/ethernet.h file", you don't have glibc
    installed. If you still want to compile dhcpcd with libc.5
    you may try to patch the distribution using libc.5-patch file included,
    however I did not test it.

  Note 2.
    the most recent releases of GNU C compiler, notably 
    gcc-2.8.1 are buggy. The same goes for egcs, as of 05/10/99.
    If you have compiled dhcpcd with gcc-2.8.1 or egcs you may
    get the following errors in dhcpcd.log file:

    May  4 12:43:03 dhcpcd[423]: corrupted UDP msg with uh_ulen=319 in_cksum=-2 discarded

    and dhcpcd won't work. The workaround is to compile dhcpcd without
    -O2 in Makefile.

  Note 3.
    if you are trying to run dhcpcd and are getting the following error in
    the log file

    dhcpcd[xx]: dhcpStart: socket(): Invalid argument

    it means you kernel is compiled without support for SOCK_PACKET
    (CONFIG_PACKET option).

  Note 4.
    if your dhcpcd binary compiles fine and runs OK with "--help" flag
    only and otherwise immediately coredumps with "Segmentation Fault" 
    error then delete /etc/dhcpc/dhcpcd-<interface>.cache file and
    try running dhcpcd again. There is a chance your dhcpcd cache file
    is from old version of dhcpcd.

You may want to 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`

2. How to Use It

Invoke the client by typing 'dhcpcd'. Note that 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.
Please note that 'dhcpcd -c filename' usage is no longer supported
in v.1.3. This is because processing in system bootup scripts
might depend on the outcome of interface configuration process
hence 'dhcpcd' should return some useful exit code to the parent
process before forking into background. The more appropriate way
to invoke 'dhcpcd' in system bootup scripts is as follows in
the example below where linux box serves as a router/firewall for
the local network 192.168.12.0.

-- - - - - - - - - -
if dhcpcd; then
  inetd
  /usr/sbin/sendmail -bd
  httpd
  echo 1 > /proc/sys/net/ipv4/ip_forward
  version_major="`uname -r | cut -d\. -f1`"
  version_minor="`uname -r | cut -d\. -f2`"
  if [ ${version_major} -gt 1 -a ${version_minor} -gt 0 ]; then
    ipchains -P forward MASQ
  else
    ipfwadm -F -p deny
    ipfwadm -F -a m -S 192.168.12.0/24 -D 0.0.0.0/0 -W eth0
  fi
  modprobe ip_masq_ftp
fi
- - - - - - - - - - -

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

In a case dhcpcd detects a change in assigned IP address it
will try to execute /etc/dhcpc/dhcpcd-interface.exe program.
The word <interface> is substituted by the actual interface name
like e.g. eth0. Caution: do not use /etc/dhcpc/dhcpcd-interface.exe
as a bootup script. It will not be executed if the assigned IP address
is the same as it was before reboot. The included sample
/etc/dhcpc/dhcpcd-eth0.exe will log the time of IP change
to /var/log/messages file.

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 static routes

5. Cache File

dhcpcd saves the assigned IP address to the file
'/etc/dhcpc/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 '/etc/dhcpc/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
/etc/dhcpc/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.

7. Other Information

dhcpcd sends DHCP_RELEASE message to the DHCP server, deletes the
/etc/dhcpc/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
/etc/dhcpc/dhcpcd-interface.cache file in a case it gets
SIGTERM as normally happens upon reboot.

dhcpcd currently does not support multiple IP addresses for the
same interface.
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 me the results of that.
   If the things are too bad for you,
   uncomment -DDEBUG flag in Makefile
   and recompile 'dhcpcd'. Run 'dhcpcd -d'
   and mail me what you see.

Sergei Viznyuk <sv@phystech.com>

