1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
5 | %general-entities;
|
---|
6 | ]>
|
---|
7 |
|
---|
8 | <sect1 id="dhcp-client" xreflabel="DHCP-&dhcp-version; Client Configuration">
|
---|
9 | <?dbhtml filename="dhcpclient.html"?>
|
---|
10 |
|
---|
11 |
|
---|
12 | <title>DHCP-&dhcp-version; Client Configuration</title>
|
---|
13 |
|
---|
14 | <indexterm zone="dhcp-client">
|
---|
15 | <primary sortas="b-dhclient">dhclient</primary>
|
---|
16 | </indexterm>
|
---|
17 |
|
---|
18 | <para>The <application>DHCP</application> package comes with
|
---|
19 | both a client (<command>dhclient</command>) and a server program for
|
---|
20 | using DHCP. If you want to install this package,
|
---|
21 | the instructions can be found at <xref linkend="dhcp"/>.
|
---|
22 | Note that if you only want to use the client, you
|
---|
23 | do <emphasis>not</emphasis> need to run the server and so do not need
|
---|
24 | the startup script and links provided for the server daemon.
|
---|
25 | You only need to run the DHCP server if you're providing
|
---|
26 | this service to a network, and it's likely that you'll know if that's the
|
---|
27 | case; if it isn't, don't run the server! Once you have installed the
|
---|
28 | package, return here for information on how to configure the client
|
---|
29 | (<command>dhclient</command>).</para>
|
---|
30 |
|
---|
31 | <sect2 role="configuration">
|
---|
32 | <title>Configuring DHCP Client</title>
|
---|
33 |
|
---|
34 | <para id="dhclient-service1010">To configure <command>dhclient</command>,
|
---|
35 | you need to first install the network service script,
|
---|
36 | <filename>/lib/services/dhclient</filename>
|
---|
37 | included in the <xref linkend="bootscripts"/> package
|
---|
38 | (as <systemitem class="username">root</systemitem>):</para>
|
---|
39 |
|
---|
40 | <indexterm zone="dhcp-client dhclient-service1010">
|
---|
41 | <primary sortas="f-dhclient">dhclient (service script)</primary>
|
---|
42 | </indexterm>
|
---|
43 |
|
---|
44 | <screen role='root'><userinput>make install-service-dhclient</userinput></screen>
|
---|
45 |
|
---|
46 | <para id="dhclient-config1">Next, create the
|
---|
47 | <filename>/etc/sysconfig/ifconfig.eth0</filename>
|
---|
48 | configuration file with the following commands as the <systemitem
|
---|
49 | class="username">root</systemitem> user. Adjust as
|
---|
50 | necessary for additional interfaces:</para>
|
---|
51 |
|
---|
52 | <indexterm zone="dhcp-client dhclient-config1">
|
---|
53 | <primary sortas="e-etc-sysconfig-...-dhclient">/etc/sysconfig/ifconfig.eth0</primary>
|
---|
54 | </indexterm>
|
---|
55 |
|
---|
56 | <screen role='root'><userinput>cat > /etc/sysconfig/ifconfig.eth0 << "EOF"
|
---|
57 | <literal>ONBOOT="yes"
|
---|
58 | IFACE="eth0"
|
---|
59 | SERVICE="dhclient"
|
---|
60 | DHCP_START="<replaceable><add additional start parameters here></replaceable> eth0"
|
---|
61 | DHCP_STOP="-r <replaceable><add additional stop parameters here></replaceable>"
|
---|
62 |
|
---|
63 | # Set PRINTIP="yes" to have the script print
|
---|
64 | # the DHCP assigned IP address
|
---|
65 | PRINTIP="no"
|
---|
66 |
|
---|
67 | # Set PRINTALL="yes" to print the DHCP assigned values for
|
---|
68 | # IP, SM, DG, and 1st NS. This requires PRINTIP="yes".
|
---|
69 | PRINTALL="no"</literal>
|
---|
70 | EOF</userinput></screen>
|
---|
71 |
|
---|
72 | <para>For more information on the appropriate
|
---|
73 | <envar>DHCP_START</envar> and <envar>DHCP_STOP</envar>
|
---|
74 | values, examine the man page for <command>dhclient</command>.</para>
|
---|
75 |
|
---|
76 | <para id="dhclient-config2">Finally, you should create the
|
---|
77 | <filename>/etc/dhclient.conf</filename> file using the following commands
|
---|
78 | as the <systemitem class="username">root</systemitem> user:</para>
|
---|
79 |
|
---|
80 | <indexterm zone="dhcp-client dhclient-config2">
|
---|
81 | <primary sortas="e-etc-dhclient.conf">/etc/dhclient.conf</primary>
|
---|
82 | </indexterm>
|
---|
83 |
|
---|
84 | <note>
|
---|
85 | <para>You'll need to add a second interface definition to the file if you
|
---|
86 | have more than one interface.</para>
|
---|
87 | </note>
|
---|
88 |
|
---|
89 | <screen role='root'><userinput>cat > /etc/dhclient.conf << "EOF"
|
---|
90 | <literal># dhclient.conf
|
---|
91 |
|
---|
92 | interface "eth0"{
|
---|
93 | prepend domain-name-servers 127.0.0.1;
|
---|
94 | request subnet-mask, broadcast-address, time-offset, routers,
|
---|
95 | domain-name, domain-name-servers, host-name;
|
---|
96 | require subnet-mask, domain-name-servers;
|
---|
97 | }
|
---|
98 | # end dhclient.conf</literal>
|
---|
99 | EOF</userinput></screen>
|
---|
100 |
|
---|
101 | </sect2>
|
---|
102 |
|
---|
103 | </sect1>
|
---|