1 | <sect1 id="connect-dhcp-client">
|
---|
2 | <?dbhtml filename="dhcpclient.html"?>
|
---|
3 | <title>DHCP-&dhcp-version;</title>
|
---|
4 |
|
---|
5 | <para>The <application><acronym>DHCP</acronym></application> package comes with
|
---|
6 | both a client (called <command>dhclient</command>) and a server program for
|
---|
7 | using <acronym>DHCP</acronym>. If you want to install this package,
|
---|
8 | the instructions can be found at <xref linkend="dhcp"/>.
|
---|
9 | Note that if you only want to use the client, you
|
---|
10 | do <emphasis>not</emphasis> need to run the server and so do not need
|
---|
11 | the startup script and links provided for the server daemon.
|
---|
12 | You only need to run the <acronym>DHCP</acronym> server if you're providing
|
---|
13 | this service to a network, and it's likely that you'll know if that's the
|
---|
14 | case; if it isn't, don't run the server! Once you have installed the
|
---|
15 | package, return here for information on how to configure the client
|
---|
16 | (<command>dhclient</command>).</para>
|
---|
17 |
|
---|
18 | <para>To configure <command>dhclient</command>, we need to first install
|
---|
19 | the network service script,
|
---|
20 | <filename>/etc/sysconfig/network-devices/services/dhclient</filename>
|
---|
21 | included in the <xref linkend="intro-important-bootscripts"/> package.</para>
|
---|
22 |
|
---|
23 | <screen><userinput><command>make install-service-dhclient</command></userinput></screen>
|
---|
24 |
|
---|
25 | <para>Next, create the <filename>ifconfig.eth0</filename>
|
---|
26 | file with the following commands. Adjust as necessary for additional
|
---|
27 | interfaces.</para>
|
---|
28 |
|
---|
29 | <para><emphasis>Note</emphasis>: this will overwrite any existing file.</para>
|
---|
30 |
|
---|
31 | <screen><userinput><command>cat > /etc/sysconfig/network-devices/ifconfig.eth0 << "EOF"</command>
|
---|
32 | ONBOOT=yes
|
---|
33 | DHCP_START="<place appropriate start parameters here>"
|
---|
34 | DHCP_STOP="-r <add additional stop parameters here>"
|
---|
35 | SERVICE=dhclient
|
---|
36 | <command>EOF</command></userinput></screen>
|
---|
37 |
|
---|
38 | <para>For more information on the appropriate
|
---|
39 | <envar>DHCP_START</envar> and <envar>DHCP_STOP</envar>
|
---|
40 | values, examine the man page for <command>dhclient</command>.</para>
|
---|
41 |
|
---|
42 | <para> You should then create
|
---|
43 | the <filename>/etc/dhclient.conf</filename> using the following
|
---|
44 | commands. Append to the file if you have more than one interface:</para>
|
---|
45 |
|
---|
46 | <screen><userinput><command>cat > /etc/dhclient.conf << "EOF"</command>
|
---|
47 | # dhclient.conf
|
---|
48 |
|
---|
49 | interface "eth0"{
|
---|
50 | prepend domain-name-servers 127.0.0.1;
|
---|
51 | request subnet-mask, broadcast-address, time-offset, routers,
|
---|
52 | domain-name, domain-name-servers, host-name;
|
---|
53 | require subnet-mask, domain-name-servers;
|
---|
54 | }
|
---|
55 | # end dhclient.conf
|
---|
56 | <command>EOF</command></userinput></screen>
|
---|
57 |
|
---|
58 | <para>Finally, if the <acronym>DHCP</acronym> configured interface is
|
---|
59 | used as your default gateway, you should remove the GATEWAY and GATEWAY_IF
|
---|
60 | variables from <filename>/etc/sysconfig/network</filename>: </para>
|
---|
61 |
|
---|
62 | <screen><userinput><command>sed -i "s/GATEWAY/#GATEWAY/" /etc/sysconfig/network</command></userinput></screen>
|
---|
63 |
|
---|
64 | </sect1>
|
---|