mirror of
https://github.com/Zeckmathederg/glfs.git
synced 2025-02-10 04:54:44 +08:00
git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@1181 af4574ff-66df-0310-9fd7-8a98e5e911e0
95 lines
2.8 KiB
XML
95 lines
2.8 KiB
XML
<sect2>
|
|
<title>Configuring <application><acronym>DHCP</acronym></application></title>
|
|
|
|
<sect3><title>Config files</title>
|
|
<para><filename>/etc/dhclient.conf</filename></para>
|
|
</sect3>
|
|
|
|
<sect3><title>Configuration Information</title>
|
|
|
|
<para>Information on configuring the <acronym>DHCP</acronym> client can be
|
|
found in Chapter 14.</para>
|
|
|
|
<para>Note that you only want to start the <acronym>DHCP</acronym> server if
|
|
you want to issue <acronym>LAN</acronym> addresses over your network. The
|
|
<acronym>DHCP</acronym> client doesn't need this script to be used. Also note
|
|
that this script is coded for the <emphasis role="strong">eth1</emphasis>
|
|
interface, which may need to be modified for your hardware configuration.
|
|
With that in mind the <command>dhcp</command> init.d script can be created
|
|
using the following commands.</para>
|
|
|
|
<screen><userinput><command>cat > /etc/rc.d/init.d/dhcp << "EOF"</command>
|
|
#!/bin/sh
|
|
# Begin $rc_base/init.d/dhcp
|
|
|
|
# Based on sysklogd script from LFS-3.1 and earlier.
|
|
# Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org
|
|
|
|
source /etc/sysconfig/rc
|
|
source $rc_functions
|
|
|
|
case "$1" in
|
|
start)
|
|
echo "Starting DHCP Server..."
|
|
loadproc dhcpd -q eth1
|
|
;;
|
|
|
|
stop)
|
|
echo "Stopping DHCP Server..."
|
|
killproc dhcpd
|
|
;;
|
|
|
|
reload)
|
|
echo "Reloading DHCP Server..."
|
|
reloadproc dhcpd
|
|
;;
|
|
|
|
restart)
|
|
$0 stop
|
|
sleep 1
|
|
$0 start
|
|
;;
|
|
|
|
status)
|
|
statusproc dhcpd
|
|
;;
|
|
|
|
*)
|
|
echo "Usage: $0 {start|stop|reload|restart|status}"
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
# End $rc_base/init.d/dhcp
|
|
<command>EOF
|
|
chmod 755 /etc/rc.d/init.d/dhcp</command></userinput></screen>
|
|
|
|
<para>The lease file must exist on startup. The following command will
|
|
satisfy that requirement:</para>
|
|
|
|
<screen><userinput><command>touch /var/state/dhcp/dhcpd.leases</command></userinput></screen>
|
|
|
|
<para>The follow commands will create a base configuration file for a
|
|
<acronym>DHCP</acronym> server. There are several options that you may want to
|
|
add (information that is passed back to the <acronym>DHCP</acronym> client) and
|
|
those are covered in the man pages for <filename>dhcp.conf</filename>.</para>
|
|
|
|
<screen><userinput><command>cat > /etc/dhcpd.conf << "EOF"</command>
|
|
default-lease-time 72000;
|
|
max-lease-time 144000;
|
|
ddns-update-style ad-hoc;
|
|
|
|
subnet 192.168.5.0 netmask 255.255.255.0 {
|
|
range 192.168.5.10 192.168.5.240;
|
|
option broadcast-address 195.168.5.255;
|
|
option routers 192.168.5.1;
|
|
}
|
|
<command>EOF</command></userinput></screen>
|
|
|
|
<para>All addresses should be changed to meet your circumstance.</para>
|
|
|
|
</sect3>
|
|
|
|
</sect2>
|
|
|