source: connect/dhcp/bootscripts.xml@ 58a6bfc

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 6.0 6.1 6.2 6.2.0 6.2.0-rc1 6.2.0-rc2 6.3 6.3-rc1 6.3-rc2 6.3-rc3 7.10 7.4 7.5 7.6 7.6-blfs 7.6-systemd 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 9.0 9.1 basic bdubbs/svn elogind gnome kde5-13430 kde5-14269 kde5-14686 kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts krejzi/svn lazarus lxqt nosym perl-modules plabs/newcss plabs/python-mods python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition systemd-11177 systemd-13485 trunk upgradedb v5_1 v5_1-pre1 xry111/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since 58a6bfc was 58a6bfc, checked in by Tushar Teredesai <tushar@…>, 20 years ago

DHCP Fix as per Bug 320

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@1577 af4574ff-66df-0310-9fd7-8a98e5e911e0

  • Property mode set to 100644
File size: 4.1 KB
Line 
1<sect1 id="dhcpclient" xreflabel="Configuring the LFS bootscripts to support DHCP clients">
2<?dbhtml filename="configdhcp.html" dir="connect"?>
3<title>Configuring the <acronym>LFS</acronym> bootscripts to support <acronym>DHCP</acronym> clients</title>
4
5<sect2><title>Config files</title>
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>
10</sect2>
11
12<sect2><title>Configuration Information</title>
13
14<para>Note that on this and the following pages, we
15use <emphasis role="strong">eth0</emphasis> as the example interface.
16If you want to configure a different (or more than one) interface, simply
17replace <emphasis role="strong">eth0</emphasis> with the interface you wish to
18use.</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
25alterations to those interfaces which need to support
26<acronym>DHCP</acronym>. All of the instructions on this page are applicable
27no matter which <acronym>DHCP</acronym> client you intend to use.</para>
28
29<para>If the interface you intend to use as your default gateway is going to
30use <acronym>DHCP</acronym>, the first step is to remove the <envar>GATEWAY
31</envar> and <envar>GATEWAY_IF</envar> variables
32from <filename>/etc/sysconfig/network</filename>. This will only need to be
33done once.</para>
34
35<screen><userinput><command>cd /etc/sysconfig &amp;&amp;
36cp network network.bak &amp;&amp;
37sed "s/GATEWAY/# GATEWAY/" network.bak > network</command></userinput></screen>
38
39<para>You then need to create scripts which will override the default
40network scripts and provide <acronym>DHCP</acronym> support. These two scripts
41are generic and so for use with both <acronym>DHCP</acronym> clients. First,
42the <filename>ifup-eth0</filename> script:</para>
43
44<screen><userinput><command>cat &gt; /etc/sysconfig/network-devices/ifup-eth0 &lt;&lt; "EOF" </command>
45#!/bin/sh
46
47source /etc/sysconfig/rc || exit
48source $rc_functions || exit
49source $network_devices/ifconfig.eth0 || exit
50
51echo "Bringing up the eth0 interface..."
52modprobe eth0
53loadproc $DHCP_PROG $DHCP_START
54<command>EOF</command></userinput></screen>
55
56<para>Then the <filename>ifdown-eth0</filename> script:</para>
57
58<screen><userinput><command>cat &gt; /etc/sysconfig/network-devices/ifdown-eth0 &lt;&lt; "EOF" </command>
59#!/bin/sh
60
61source /etc/sysconfig/rc || exit
62source $rc_functions || exit
63source $network_devices/ifconfig.eth0 || exit
64
65echo "Bringing down the eth0 interface..."
66$DHCP_PROG $DHCP_STOP
67evaluate_retval
68<command>EOF</command></userinput></screen>
69
70<para>Next, we need to make corrections to the
71<filename>/etc/hosts</filename> file. Be sure to replace
72<emphasis role="strong">HOSTNAME</emphasis> and
73<emphasis role="strong">DOMAIN_NAME</emphasis> with apropriate values.</para>
74
75<screen><userinput><command>mv -f /etc/hosts /etc/hosts.bak &amp;&amp;
76cat &gt; /etc/hosts &lt;&lt; "EOF" </command>
77# Begin /etc/hosts
78
79127.0.0.1 HOSTNAME HOSTNAME.DOMAIN_NAME localhost localhost.localdomain
80
81# End /etc/hosts
82<command>EOF</command></userinput></screen>
83
84<para>Finally, we need to make the scripts executable:</para>
85
86<screen><userinput><command>chmod 755 /etc/sysconfig/network-devices/ifup-eth0 &amp;&amp;
87chmod 755 /etc/sysconfig/network-devices/ifdown-eth0</command></userinput></screen>
88
89<warning><para>
90This script, in it's current state, <emphasis>will</emphasis> cause an
91error at shutdown. ATM, It is best to just live with the error. The
92network scripts for LFS and BLFS are currently being revised. In the
93interim, you can use a simple workaround to rid yourself of the error.
94Move K80network in your stop scripts to K49network. You must be
95absolutely certain, however, that you have all network filesystems
96unmounted before this script is executed.
97</para></warning>
98
99</sect2>
100
101</sect1>
Note: See TracBrowser for help on using the repository browser.