[f45b1953] | 1 | <sect2>
|
---|
[40330fcd] | 2 | <title>Configuring <application><acronym>DHCP</acronym></application></title>
|
---|
[f45b1953] | 3 |
|
---|
| 4 | <sect3><title>Config files</title>
|
---|
[e80cc95] | 5 | <para><filename>/etc/dhclient.conf</filename></para>
|
---|
[f45b1953] | 6 | </sect3>
|
---|
| 7 |
|
---|
| 8 | <sect3><title>Configuration Information</title>
|
---|
| 9 |
|
---|
[40330fcd] | 10 | <para>Information on configuring the <acronym>DHCP</acronym> client can be
|
---|
| 11 | found in Chapter 14.</para>
|
---|
[f45b1953] | 12 |
|
---|
[40330fcd] | 13 | <para>Note that you only want to start the <acronym>DHCP</acronym> server if
|
---|
| 14 | you want to issue <acronym>LAN</acronym> addresses over your network. The
|
---|
| 15 | <acronym>DHCP</acronym> client doesn't need this script to be used. Also note
|
---|
| 16 | that this script is coded for the <emphasis role="strong">eth1</emphasis>
|
---|
| 17 | interface, which may need to be modified for your hardware configuration.
|
---|
[ca89a835] | 18 | With that in mind the <application><acronym>DHCP</acronym></application> init.d script can be created
|
---|
[f45b1953] | 19 | using the following commands.</para>
|
---|
| 20 |
|
---|
[40330fcd] | 21 | <screen><userinput><command>cat > /etc/rc.d/init.d/dhcp << "EOF"</command>
|
---|
[f45b1953] | 22 | #!/bin/sh
|
---|
| 23 | # Begin $rc_base/init.d/dhcp
|
---|
| 24 |
|
---|
| 25 | # Based on sysklogd script from LFS-3.1 and earlier.
|
---|
| 26 | # Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org
|
---|
| 27 |
|
---|
[369af35a] | 28 | . /etc/sysconfig/rc
|
---|
| 29 | . $rc_functions
|
---|
[f45b1953] | 30 |
|
---|
| 31 | case "$1" in
|
---|
| 32 | start)
|
---|
| 33 | echo "Starting DHCP Server..."
|
---|
| 34 | loadproc dhcpd -q eth1
|
---|
| 35 | ;;
|
---|
| 36 |
|
---|
| 37 | stop)
|
---|
| 38 | echo "Stopping DHCP Server..."
|
---|
| 39 | killproc dhcpd
|
---|
| 40 | ;;
|
---|
| 41 |
|
---|
| 42 | reload)
|
---|
| 43 | echo "Reloading DHCP Server..."
|
---|
| 44 | reloadproc dhcpd
|
---|
| 45 | ;;
|
---|
| 46 |
|
---|
| 47 | restart)
|
---|
| 48 | $0 stop
|
---|
| 49 | sleep 1
|
---|
| 50 | $0 start
|
---|
| 51 | ;;
|
---|
| 52 |
|
---|
| 53 | status)
|
---|
| 54 | statusproc dhcpd
|
---|
| 55 | ;;
|
---|
| 56 |
|
---|
| 57 | *)
|
---|
| 58 | echo "Usage: $0 {start|stop|reload|restart|status}"
|
---|
| 59 | exit 1
|
---|
| 60 | ;;
|
---|
| 61 | esac
|
---|
| 62 |
|
---|
| 63 | # End $rc_base/init.d/dhcp
|
---|
[40330fcd] | 64 | <command>EOF
|
---|
| 65 | chmod 755 /etc/rc.d/init.d/dhcp</command></userinput></screen>
|
---|
[f45b1953] | 66 |
|
---|
[c51584b] | 67 | <para>The lease file must exist on startup. The following command will
|
---|
| 68 | satisfy that requirement:</para>
|
---|
| 69 |
|
---|
[40330fcd] | 70 | <screen><userinput><command>touch /var/state/dhcp/dhcpd.leases</command></userinput></screen>
|
---|
[c51584b] | 71 |
|
---|
[f45b1953] | 72 | <para>The follow commands will create a base configuration file for a
|
---|
[40330fcd] | 73 | <acronym>DHCP</acronym> server. There are several options that you may want to
|
---|
| 74 | add (information that is passed back to the <acronym>DHCP</acronym> client) and
|
---|
| 75 | those are covered in the man pages for <filename>dhcp.conf</filename>.</para>
|
---|
[f45b1953] | 76 |
|
---|
[40330fcd] | 77 | <screen><userinput><command>cat > /etc/dhcpd.conf << "EOF"</command>
|
---|
[f45b1953] | 78 | default-lease-time 72000;
|
---|
| 79 | max-lease-time 144000;
|
---|
[47a3d8ff] | 80 | ddns-update-style ad-hoc;
|
---|
[f45b1953] | 81 |
|
---|
| 82 | subnet 192.168.5.0 netmask 255.255.255.0 {
|
---|
| 83 | range 192.168.5.10 192.168.5.240;
|
---|
| 84 | option broadcast-address 195.168.5.255;
|
---|
| 85 | option routers 192.168.5.1;
|
---|
| 86 | }
|
---|
[40330fcd] | 87 | <command>EOF</command></userinput></screen>
|
---|
[f45b1953] | 88 |
|
---|
| 89 | <para>All addresses should be changed to meet your circumstance.</para>
|
---|
| 90 |
|
---|
| 91 | </sect3>
|
---|
| 92 |
|
---|
| 93 | </sect2>
|
---|
| 94 |
|
---|