<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
   "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  <!ENTITY % general-entities SYSTEM "../../general.ent">
  %general-entities;

  <!ENTITY dhcpcd-download-http "http://roy.marples.name/downloads/dhcpcd/dhcpcd-&dhcpcd-version;.tar.bz2">
  <!ENTITY dhcpcd-download-ftp  "ftp://roy.marples.name/pub/dhcpcd/dhcpcd-&dhcpcd-version;.tar.bz2">
  <!--<!ENTITY dhcpcd-download-ftp  "ftp://ftp.osuosl.org/pub/gentoo/distfiles/dhcpcd-&dhcpcd-version;.tar.bz2">-->
  <!ENTITY dhcpcd-md5sum        "ffb716b0e9327968e7200d519e1d4c0d">
  <!ENTITY dhcpcd-size          "160 KB">
  <!ENTITY dhcpcd-buildsize     "2.2 MB">
  <!ENTITY dhcpcd-time          "less than 0.1 SBU">
]>

<sect1 id="dhcpcd" xreflabel="dhcpcd-&dhcpcd-version;">
  <?dbhtml filename="dhcpcd.html"?>

  <sect1info>
    <othername>$LastChangedBy: bdubbs $</othername>
    <date>$Date: 2015-03-01 20:45:33 -0500 (Sun, 01 Mar 2015) $</date>
  </sect1info>

  <title>dhcpcd-&dhcpcd-version;</title>

  <indexterm zone="dhcpcd">
    <primary sortas="a-dhcpcd">dhcpcd</primary>
  </indexterm>

  <sect2 role="package">
    <title>Introduction to dhcpcd</title>

    <para><application>dhcpcd</application> is an implementation of the
    DHCP client specified in RFC2131. A DHCP client is useful for connecting
    your computer to a network which uses DHCP to assign network
    addresses. dhcpcd strives to be a fully featured, yet very lightweight
    DHCP client.</para>

    &lfs77_checked;

    <bridgehead renderas="sect3">Package Information</bridgehead>
    <itemizedlist spacing="compact">
      <listitem>
        <para>Download (HTTP): <ulink url="&dhcpcd-download-http;"/></para>
      </listitem>
      <listitem>
        <para>Download (FTP): <ulink url="&dhcpcd-download-ftp;"/></para>
      </listitem>
      <listitem>
        <para>Download MD5 sum: &dhcpcd-md5sum;</para>
      </listitem>
      <listitem>
        <para>Download size: &dhcpcd-size;</para>
      </listitem>
      <listitem>
        <para>Estimated disk space required: &dhcpcd-buildsize;</para>
      </listitem>
      <listitem>
        <para>Estimated build time: &dhcpcd-time;</para>
      </listitem>
    </itemizedlist>

    <bridgehead renderas="sect3">dhcpcd Dependencies</bridgehead>

    <bridgehead renderas="sect4">Optional</bridgehead>
    <para role="optional">
      <xref linkend="llvm"/> (with Clang)
    </para>

    <para condition="html" role="usernotes">User Notes:
    <ulink url="&blfs-wiki;/dhcpcd"/></para>

  </sect2>

  <sect2 role="installation">
    <title>Installation of dhcpcd</title>

    <para>Install <application>dhcpcd</application> by running the following
    commands:</para>

<screen><userinput>./configure --libexecdir=/lib/dhcpcd \
            --dbdir=/var/tmp         &amp;&amp;
make</userinput></screen>

    <para>This package does not come with a test suite.</para>

    <para>Now, as the <systemitem class="username">root</systemitem> user:</para>

<screen role='root'><userinput>make install</userinput></screen>

<!--
    <para>By default, a plain text lease info file isn't created but the
    <application>dhcpcd</application> provides a hook which can be used for creating
    such a file. Install the hook by running the following
    commands as the <systemitem class="username">root</systemitem> user:</para>

<screen role='root'><userinput>sed -i "s;/var/lib;/run;g" dhcpcd-hooks/50-dhcpcd-compat &amp;&amp;
install -v -m 644 dhcpcd-hooks/50-dhcpcd-compat /lib/dhcpcd/dhcpcd-hooks/</userinput></screen>
-->

  </sect2>

  <sect2 role="commands">
    <title>Command Explanations</title>

    <para>
      <parameter>--libexecdir=/lib/dhcpcd</parameter>: The default
      <filename class="directory">/libexec</filename> is not FHS-compliant.
      Since this directory may need to be available early in the boot,
      <filename class="directory">/usr/libexec</filename> cannot be used either.
    </para>

    <para>
      <parameter>--dbdir=/var/tmp</parameter>: The default
      <filename class="directory">/var/lib</filename> is not FHS-compliant
    </para>

    <para>
      <option>--with-hook=...</option>: You can optionally install more hooks,
      for example to install some configuration files such as
      <filename>ntp.conf</filename>. The set of hooks is in the
      <filename class="directory">dhcpcd-hooks</filename> directory in the
      build tree.
    </para>
  </sect2>

  <sect2 role="configuration">
    <title>Configuring dhcpcd</title>

    <sect3 id="dhcpcd-config">
      <title>Config Files</title>

      <para><filename>/etc/dhcpcd.conf</filename></para>

      <indexterm zone="dhcpcd dhcpcd-config">
        <primary sortas="e-etc-dhcpcd-dhcpcd-conf">/etc/dhcpcd/dhcpcd.conf</primary>
      </indexterm>

    </sect3>

    <sect3 id="dhcpcd-init">
      <title>General Configuration Information</title>

      <para>To configure <command>dhcpcd</command>, you need to first install
      the network service script,
      <filename>/lib/services/dhcpcd</filename>
      included in the <xref linkend="bootscripts"/> package
      (as user <systemitem class="username">root</systemitem>):</para>

      <indexterm zone="dhcpcd dhcpcd-init">
        <primary sortas="f-dhcpcd">dhcpcd (service script)</primary>
      </indexterm>

<screen role='root'><userinput>make install-service-dhcpcd</userinput></screen>

      <para>Whenever <command>dhcpcd</command> configures or shuts down
      a network interface, it executes hook scripts. For more details
      about those scripts, see the <command>dhcpcd-run-hooks</command> and
      <command>dhcpcd</command> man pages.</para>

      <para id="dhcpcd-config2">Finally, as the <systemitem
      class="username">root</systemitem> user create the
      <filename>/etc/sysconfig/ifconfig.eth0</filename>
      configuration file using the following commands.  Adjust appropriately
      for additional interfaces:</para>

      <indexterm zone="dhcpcd dhcpcd-config2">
        <primary sortas="e-etc-sysconfig-dhcpcd">/etc/sysconfig/ifconfig.eth0 (dhcpcd)</primary>
      </indexterm>

<screen role='root'><userinput>cat &gt; /etc/sysconfig/ifconfig.eth0 &lt;&lt; "EOF"
<literal>ONBOOT="yes"
IFACE="eth0"
SERVICE="dhcpcd"
DHCP_START="-b -q <replaceable>&lt;insert appropriate start options here&gt;</replaceable>"
DHCP_STOP="-k <replaceable>&lt;insert additional stop options here&gt;</replaceable>"</literal>
EOF</userinput></screen>

      <para>For more information on the appropriate <envar>DHCP_START</envar> and
      <envar>DHCP_STOP</envar> values, examine the man page for
      <command>dhcpcd</command>.</para>

      <note>

        <para id="dhcpcd-config3">The default behavior of
        <command>dhcpcd</command> sets the hostname and mtu settings.  It also
        overwrites <filename>/etc/resolv.conf</filename> and
        <filename>/etc/ntp.conf</filename>.

        These modifications to system files and settings on system
        configuration files are done by hooks which are stored in <filename
        class="directory">/lib/dhcpcd/dhcpcd-hooks</filename>.

        Setup <command>dhcpcd</command> by removing or adding hooks from/to
        that directory.  The execution of hooks can be disabled by using the
        <option>--nohook</option> (<option>-C</option>) command line option or
        by the <option>nohook</option> option in the
        <filename>/etc/dhcpcd.conf</filename> file.</para>

        <para>Review the <command>dhcpcd</command> man page for switches to add
        to the <envar>DHCP_START</envar> value.</para>

      </note>

      <indexterm zone="dhcpcd dhcpcd-config3">
        <primary sortas="e-etc-resolv.conf">/etc/resolv.conf</primary>
      </indexterm>
    </sect3>

    <sect3 id="dhcpcd-init2">
      <title>Configuration Information: fixed ip</title>

      <para id="dhcpcd-config4">Although not usual, it is possible that you need
        to configure <application>dhcpcd</application> to use a fixed ip. Here,
        we give an example. As the
        <systemitem class="username">root</systemitem> user create the
        <filename>/etc/sysconfig/ifconfig.eth0</filename> configuration file
        using the following commands.  Adjust appropriately for additional
        interfaces and for the actual ip and router you need:</para>

      <indexterm zone="dhcpcd dhcpcd-config4">
        <primary sortas="e-etc-sysconfig-dhcpcd">/etc/sysconfig/ifconfig.eth0 (dhcpcd)</primary>
      </indexterm>

<screen role='root'><userinput>cat &gt; /etc/sysconfig/ifconfig.eth0 &lt;&lt; "EOF"
<literal>ONBOOT="yes"
IFACE="eth0"
SERVICE="dhcpcd"
DHCP_START="-b -q -S ip_address=192.168.0.10/24 -S routers=192.168.0.1"
DHCP_STOP="-k"</literal>
EOF</userinput></screen>

      <para>You can either use DNS servers in
        <filename>/etc/resolv.conf</filename> from another system, your
        preferred servers, or just the example
        <filename>/etc/resolv.conf.head</filename> file below as is:</para>

<screen role='root'><userinput>cat &gt; /etc/resolv.conf.head &lt;&lt; "EOF"
<literal># OpenDNS servers
nameserver 208.67.222.222
nameserver 208.67.220.220</literal>
EOF</userinput></screen>

    </sect3>

  </sect2>

  <sect2 role="content">
    <title>Contents</title>

    <segmentedlist>
      <segtitle>Installed Program</segtitle>
      <segtitle>Installed Library</segtitle>
      <segtitle>Installed Directory</segtitle>

      <seglistitem>
        <seg>dhcpcd</seg>
        <seg>/lib/dhcpcd/dev/udev.so</seg>
        <seg>/lib/dhcpcd</seg>
      </seglistitem>
    </segmentedlist>

    <variablelist>
      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
      <?dbfo list-presentation="list"?>
      <?dbhtml list-presentation="table"?>

      <varlistentry id="dhcpcd-prog">
        <term><command>dhcpcd</command></term>
        <listitem>
          <para>is an implementation of the DHCP client specified
          in RFC2131.</para>
          <indexterm zone="dhcpcd dhcpcd-prog">
            <primary sortas="b-dhcpcd">dhcpcd</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="dhcpcd-udev">
        <term><filename class="libraryfile">udev.so</filename></term>
        <listitem>
          <para>
            add udev support for interface arrival and departure; this is
            because udev likes to rename the interface, which it can't do if
            dhcpcd grabs it first.
          </para>
          <indexterm zone="dhcpcd dhcpcd-udev">
            <primary sortas="c-dhcpcd-udev">udev.so</primary>
          </indexterm>
        </listitem>
      </varlistentry>

    </variablelist>

  </sect2>

</sect1>
