<?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;
]>

<sect1 id="dhcp-client" xreflabel="DHCP-&dhcp-version; Client Configuration">
  <?dbhtml filename="dhcpclient.html"?>

  <sect1info>
    <othername>$LastChangedBy: krejzi $</othername>
    <date>$Date: 2012-08-14 18:00:47 -0400 (Tue, 14 Aug 2012) $</date>
  </sect1info>

  <title>DHCP-&dhcp-version; Client Configuration</title>

  <indexterm zone="dhcp-client">
    <primary sortas="b-dhclient">dhclient</primary>
  </indexterm>

  <para>The <application>DHCP</application> package comes with
  both a client (<command>dhclient</command>) and a server program for
  using DHCP.  If you want to install this package,
  the instructions can be found at <xref linkend="dhcp"/>.
  Note that if you only want to use the client, you
  do <emphasis>not</emphasis> need to run the server and so do not need
  the startup script and links provided for the server daemon.
  You only need to run the DHCP server if you're providing
  this service to a network, and it's likely that you'll know if that's the
  case; if it isn't, don't run the server!  Once you have installed the
  package, return here for information on how to configure the client
  (<command>dhclient</command>).</para>

  <sect2 role="configuration">
    <title>Configuring DHCP Client</title>

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

      <indexterm zone="dhcp-client dhclient-service1010">
        <primary sortas="f-dhclient">dhclient (service script)</primary>
      </indexterm>

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

    <para id="dhclient-config1">Next, create the
    <filename>/etc/sysconfig/ifconfig.eth0</filename>
    configuration file with the following commands as the <systemitem
    class="username">root</systemitem> user.  Adjust as
    necessary for additional interfaces:</para>

    <indexterm zone="dhcp-client dhclient-config1">
      <primary sortas="e-etc-sysconfig-...-dhclient">/etc/sysconfig/ifconfig.eth0</primary>
    </indexterm>

<screen role='root'><userinput>cat &gt; /etc/sysconfig/ifconfig.eth0 &lt;&lt; "EOF"
<literal>ONBOOT="yes"
IFACE="eth0"
SERVICE="dhclient"
DHCP_START="<replaceable>&lt;add additional start parameters here&gt;</replaceable> eth0"
DHCP_STOP="-r <replaceable>&lt;add additional stop parameters here&gt;</replaceable>"

# Set PRINTIP="yes" to have the script print
# the DHCP assigned IP address
PRINTIP="no"

# Set PRINTALL="yes" to print the DHCP assigned values for
# IP, SM, DG, and 1st NS. This requires PRINTIP="yes".
PRINTALL="no"</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>dhclient</command>.</para>

    <para id="dhclient-config2">Finally, you should create the
    <filename>/etc/dhclient.conf</filename> file using the following commands
    as the <systemitem class="username">root</systemitem> user:</para>

    <indexterm zone="dhcp-client dhclient-config2">
      <primary sortas="e-etc-dhclient.conf">/etc/dhclient.conf</primary>
    </indexterm>

    <note>
      <para>You'll need to add a second interface definition to the file if you
      have more than one interface.</para>
    </note>

<screen role='root'><userinput>cat &gt; /etc/dhclient.conf &lt;&lt; "EOF"
<literal># dhclient.conf

interface "eth0"{
prepend domain-name-servers 127.0.0.1;
request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, host-name;
require subnet-mask, domain-name-servers;
}
# end dhclient.conf</literal>
EOF</userinput></screen>

  </sect2>

</sect1>
