source: connect/dhcp/config.xml@ 3df04a7f

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 v1_0 v5_0 v5_0-pre1 v5_1 v5_1-pre1 xry111/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since 3df04a7f was f45b1953, checked in by Mark Hymers <markh@…>, 22 years ago

Initial revision

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

  • Property mode set to 100644
File size: 3.0 KB
Line 
1<sect1 id="dhcpclient" xreflabel="Configuring dhcp for a client">
2<?dbhtml filename="configdhcp.html" dir="connect"?>
3<title>Configuring dhcp for a client</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,
9/etc/sysconfig/networkdevices/ifconfig.eth0</userinput></para>
10</sect2>
11
12<sect2><title>Configuration Information</title>
13
14<para>Note that we use <userinput>eth0</userinput> as the interface
15throughout these instructions. If you want to configure a different (or
16more than one) interface, simply replace <userinput>eth0</userinput>
17with 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 DHCP configuration. Note that static and
21DHCP interfaces can co-exist on a LFS system, only make the
22alterations to those interfaces which need to support DHCP.</para>
23
24<para>The first step is to remove the GATEWAY and GATEWAY_IF variables
25from <filename>/etc/sysconfig/network</filename>. This should only be done
26if the default interface you intend to use will be using DHCP and only
27needs to be done once; regardless of how many interfaces you are setting
28up.</para>
29
30<para><screen><userinput>cd /etc/sysconfig &amp;&amp;
31cp network network.bak &amp;&amp;
32sed "s/GATEWAY/# GATEWAY/" network.bak > network</userinput></screen></para>
33
34<para>Now you can create the appropriate <filename>ifconfig.eth0</filename>
35file with the following commands (note that this will overwrite any
36existing file):</para>
37
38<para><screen><userinput>cd /etc/sysconfig/network-devices &amp;&amp;
39cat &gt; ifconfig.eth0 &lt;&lt; "EOF"</userinput>
40ONBOOT=yes
41DHCP_PROG=&lt;path to dhcp&gt;
42DHCP_START=&lt;start parameters&gt;
43DHCP_STOP=&lt;stop parameter&gt;
44<userinput>EOF</userinput></screen></para>
45
46<para>Review the appropriate manpages for parameters; for example, the
47stop parameter for dhcpcd is '-k', while the stop parameter for dhclient
48is '-r'.</para>
49
50<para>You then need to create DHCP specific scripts. First, the
51<filename>ifup-eth0</filename> script:</para>
52
53<para><screen><userinput>cat &gt; ifup-eth0 &lt;&lt; "EOF" </userinput>
54#!/bin/sh
55
56source /etc/sysconfig/rc || exit
57source $rc_functions || exit
58source $network_devices/ifconfig.eth0 || exit
59
60echo "Bringing up the eth0 interface..."
61modprobe eth0
62loadproc $DHCP_PROG $DHCP_START
63<userinput>EOF</userinput></screen></para>
64
65<para>Then the <filename>ifdown-eth0</filename> script:</para>
66
67<para><screen><userinput>cat &gt; ifdown-eth0 &lt;&lt; "EOF" </userinput>
68#!/bin/sh
69
70source /etc/sysconfig/rc || exit
71source $rc_functions || exit
72source $network_devices/ifconfig.eth0 || exit
73
74echo "Bringing down the eth0 interface..."
75$DHCP_PROG $DHCP_STOP
76evaluate_retval
77<userinput>EOF</userinput></screen></para>
78
79<para>Finally, we need to make these scripts executable:</para>
80
81<para><screen><userinput>chmod 755 ifup-eth0 &amp;&amp;
82chmod 755 ifdown-eth0</userinput></screen></para>
83
84</sect2>
85
86</sect1>
87
Note: See TracBrowser for help on using the repository browser.