[050d775d] | 1 | <sect1 id="dhcpclient" xreflabel="Configuring the LFS bootscripts to support DHCP clients">
|
---|
| 2 | <?dbhtml filename="configdhcp.html" dir="connect"?>
|
---|
[36f9a23] | 3 | <title>Configuring the <acronym>LFS</acronym> bootscripts to support <acronym>DHCP</acronym> clients</title>
|
---|
[050d775d] | 4 |
|
---|
| 5 | <sect2><title>Config files</title>
|
---|
[23e6faf] | 6 | <para><filename>/etc/sysconfig/network</filename>,
|
---|
| 7 | <filename>/etc/sysconfig/network-devices/ifup-eth0</filename>,
|
---|
| 8 | <filename>/etc/sysconfig/network-devices/ifdown-eth0</filename>,
|
---|
| 9 | <filename>/etc/sysconfig/network-devices/ifconfig.eth0</filename></para>
|
---|
[050d775d] | 10 | </sect2>
|
---|
| 11 |
|
---|
| 12 | <sect2><title>Configuration Information</title>
|
---|
| 13 |
|
---|
| 14 | <para>Note that on this and the following pages, we
|
---|
[36f9a23] | 15 | use <emphasis role="strong">eth0</emphasis> as the example interface.
|
---|
[050d775d] | 16 | If you want to configure a different (or more than one) interface, simply
|
---|
[36f9a23] | 17 | replace <emphasis role="strong">eth0</emphasis> with the interface you wish to
|
---|
| 18 | use.</para>
|
---|
| 19 |
|
---|
| 20 | <para>These instructions will convert the configuration files from
|
---|
| 21 | <acronym>LFS</acronym> (a static configuration) to a configuration using the
|
---|
| 22 | <acronym>DHCP</acronym> protocol. Note that static and
|
---|
| 23 | <acronym>DHCP</acronym>-based interfaces can co-exist on a
|
---|
| 24 | <acronym>LFS</acronym> system. To do this, you should only make the
|
---|
| 25 | alterations to those interfaces which need to support
|
---|
| 26 | <acronym>DHCP</acronym>. All of the instructions on this page are applicable
|
---|
| 27 | no matter which <acronym>DHCP</acronym> client you intend to use.</para>
|
---|
[050d775d] | 28 |
|
---|
| 29 | <para>If the interface you intend to use as your default gateway is going to
|
---|
[36f9a23] | 30 | use <acronym>DHCP</acronym>, the first step is to remove the <envar>GATEWAY
|
---|
| 31 | </envar> and <envar>GATEWAY_IF</envar> variables
|
---|
[050d775d] | 32 | from <filename>/etc/sysconfig/network</filename>. This will only need to be
|
---|
| 33 | done once.</para>
|
---|
| 34 |
|
---|
[36f9a23] | 35 | <screen><userinput><command>cd /etc/sysconfig &&
|
---|
[050d775d] | 36 | cp network network.bak &&
|
---|
[36f9a23] | 37 | sed "s/GATEWAY/# GATEWAY/" network.bak > network</command></userinput></screen>
|
---|
[050d775d] | 38 |
|
---|
| 39 | <para>You then need to create scripts which will override the default
|
---|
[36f9a23] | 40 | network scripts and provide <acronym>DHCP</acronym> support. These two scripts
|
---|
| 41 | are generic and so for use with both <acronym>DHCP</acronym> clients. First,
|
---|
| 42 | the <filename>ifup-eth0</filename> script:</para>
|
---|
[050d775d] | 43 |
|
---|
[36f9a23] | 44 | <screen><userinput><command>cat > /etc/sysconfig/network-devices/ifup-eth0 << "EOF" </command>
|
---|
[050d775d] | 45 | #!/bin/sh
|
---|
| 46 |
|
---|
| 47 | source /etc/sysconfig/rc || exit
|
---|
| 48 | source $rc_functions || exit
|
---|
| 49 | source $network_devices/ifconfig.eth0 || exit
|
---|
| 50 |
|
---|
| 51 | echo "Bringing up the eth0 interface..."
|
---|
| 52 | modprobe eth0
|
---|
| 53 | loadproc $DHCP_PROG $DHCP_START
|
---|
[36f9a23] | 54 | <command>EOF</command></userinput></screen>
|
---|
[050d775d] | 55 |
|
---|
| 56 | <para>Then the <filename>ifdown-eth0</filename> script:</para>
|
---|
| 57 |
|
---|
[36f9a23] | 58 | <screen><userinput><command>cat > /etc/sysconfig/network-devices/ifdown-eth0 << "EOF" </command>
|
---|
[050d775d] | 59 | #!/bin/sh
|
---|
| 60 |
|
---|
| 61 | source /etc/sysconfig/rc || exit
|
---|
| 62 | source $rc_functions || exit
|
---|
| 63 | source $network_devices/ifconfig.eth0 || exit
|
---|
| 64 |
|
---|
| 65 | echo "Bringing down the eth0 interface..."
|
---|
| 66 | $DHCP_PROG $DHCP_STOP
|
---|
| 67 | evaluate_retval
|
---|
[36f9a23] | 68 | <command>EOF</command></userinput></screen>
|
---|
[050d775d] | 69 |
|
---|
| 70 | <para>Finally, we need to make these scripts executable:</para>
|
---|
| 71 |
|
---|
[36f9a23] | 72 | <screen><userinput><command>chmod 755 /etc/sysconfig/network-devices/ifup-eth0 &&
|
---|
| 73 | chmod 755 /etc/sysconfig/network-devices/ifdown-eth0</command></userinput></screen>
|
---|
[050d775d] | 74 |
|
---|
[2de3d9d] | 75 | <warning><para>
|
---|
| 76 | This script, in it's current state, <emphasis>will</emphasis> cause an
|
---|
| 77 | error at shutdown. ATM, It is best to just live with the error. The
|
---|
| 78 | network scripts for LFS and BLFS are currently being revised. In the
|
---|
| 79 | interim, you can use a simple workaround to rid yourself of the error.
|
---|
| 80 | Move K80network in your stop scripts to K49network. You must be
|
---|
| 81 | absolutely certain, however, that you have all network filesystems
|
---|
| 82 | unmounted before this script is executed.
|
---|
| 83 | </para></warning>
|
---|
| 84 |
|
---|
[050d775d] | 85 | </sect2>
|
---|
| 86 |
|
---|
| 87 | </sect1>
|
---|