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