[050d775d] | 1 | <sect1 id="dhcpclient" xreflabel="Configuring the LFS bootscripts to support DHCP clients">
|
---|
| 2 | <?dbhtml filename="configdhcp.html" dir="connect"?>
|
---|
| 3 | <title>Configuring the LFS bootscripts to support DHCP clients</title>
|
---|
| 4 |
|
---|
| 5 | <sect2><title>Config files</title>
|
---|
| 6 | <para><userinput>/etc/sysconfig/network,
|
---|
| 7 | /etc/sysconfig/network-devices/ifup-eth0,
|
---|
| 8 | /etc/sysconfig/network-devices/ifdown-eth0,
|
---|
[40fb8a38] | 9 | /etc/sysconfig/network-devices/ifconfig.eth0</userinput></para>
|
---|
[050d775d] | 10 | </sect2>
|
---|
| 11 |
|
---|
| 12 | <sect2><title>Configuration Information</title>
|
---|
| 13 |
|
---|
| 14 | <para>Note that on this and the following pages, we
|
---|
| 15 | use <userinput>eth0</userinput> as the example interface.
|
---|
| 16 | If you want to configure a different (or more than one) interface, simply
|
---|
| 17 | replace <userinput>eth0</userinput> with the interface you wish to use.</para>
|
---|
| 18 |
|
---|
| 19 | <para>These instructions will convert the configuration files from LFS
|
---|
| 20 | (a static configuration) to a configuration using the DHCP protocol.
|
---|
| 21 | Note that static and DHCP-based interfaces can co-exist on a LFS system. To
|
---|
| 22 | do this, you should only make the alterations to those interfaces which
|
---|
| 23 | need to support DHCP. All of the instructions on this page are applicable
|
---|
| 24 | no matter which DHCP client you intend to use.</para>
|
---|
| 25 |
|
---|
| 26 | <para>If the interface you intend to use as your default gateway is going to
|
---|
| 27 | use DHCP, the first step is to remove the GATEWAY and GATEWAY_IF variables
|
---|
| 28 | from <filename>/etc/sysconfig/network</filename>. This will only need to be
|
---|
| 29 | done once.</para>
|
---|
| 30 |
|
---|
| 31 | <para><screen><userinput>cd /etc/sysconfig &&
|
---|
| 32 | cp network network.bak &&
|
---|
| 33 | sed "s/GATEWAY/# GATEWAY/" network.bak > network</userinput></screen></para>
|
---|
| 34 |
|
---|
| 35 | <para>You then need to create scripts which will override the default
|
---|
| 36 | network scripts and provide DHCP support. These two scripts are generic and
|
---|
| 37 | so for use with both DHCP clients. First, the
|
---|
| 38 | <filename>ifup-eth0</filename> script:</para>
|
---|
| 39 |
|
---|
[40fb8a38] | 40 | <para><screen><userinput>cat > /etc/sysconfig/network-devices/ifup-eth0 << "EOF" </userinput>
|
---|
[050d775d] | 41 | #!/bin/sh
|
---|
| 42 |
|
---|
| 43 | source /etc/sysconfig/rc || exit
|
---|
| 44 | source $rc_functions || exit
|
---|
| 45 | source $network_devices/ifconfig.eth0 || exit
|
---|
| 46 |
|
---|
| 47 | echo "Bringing up the eth0 interface..."
|
---|
| 48 | modprobe eth0
|
---|
| 49 | loadproc $DHCP_PROG $DHCP_START
|
---|
| 50 | <userinput>EOF</userinput></screen></para>
|
---|
| 51 |
|
---|
| 52 | <para>Then the <filename>ifdown-eth0</filename> script:</para>
|
---|
| 53 |
|
---|
[40fb8a38] | 54 | <para><screen><userinput>cat > /etc/sysconfig/network-devices/ifdown-eth0 << "EOF" </userinput>
|
---|
[050d775d] | 55 | #!/bin/sh
|
---|
| 56 |
|
---|
| 57 | source /etc/sysconfig/rc || exit
|
---|
| 58 | source $rc_functions || exit
|
---|
| 59 | source $network_devices/ifconfig.eth0 || exit
|
---|
| 60 |
|
---|
| 61 | echo "Bringing down the eth0 interface..."
|
---|
| 62 | $DHCP_PROG $DHCP_STOP
|
---|
| 63 | evaluate_retval
|
---|
| 64 | <userinput>EOF</userinput></screen></para>
|
---|
| 65 |
|
---|
| 66 | <para>Finally, we need to make these scripts executable:</para>
|
---|
| 67 |
|
---|
[3d60760] | 68 | <para><screen><userinput>chmod 755 /etc/sysconfig/network-devices/ifup-eth0 &&
|
---|
| 69 | chmod 755 /etc/sysconfig/network-devices/ifdown-eth0</userinput></screen></para>
|
---|
[050d775d] | 70 |
|
---|
| 71 | </sect2>
|
---|
| 72 |
|
---|
| 73 | </sect1>
|
---|
| 74 |
|
---|