Download location (HTTP): Download location (FTP): ftp://ftp.isc.org/isc/dhcp/dhcp-3.0pl2.tar.gz Version used: 3.0pl2 Package size: 852 KB Estimated Disk space required: 29.6 MB |
The dhcp package contains both the client and server programs for DHCP. dhclient (the client) is useful for connecting your computer to a network which uses DHCP to assign network addresses. dhcpd (the server) is useful for assigning network addresses on your private network.
dhcp needs nothing to compile but you must have Packet Socket support compiled in the kernel and Socket Filtering either compiled in or as a kernel module to use it. |
Install dhcp by running the following commands:
./configure && make && make LIBDIR=/usr/lib INCDIR=/usr/include install |
LIBDIR=/usr/lib INCDIR=/usr/include : This command installs the library and include files in /usr instead of /usr/local.
/etc/dhclient.conf
Information on configuring the dhcp client can be found in Chapter 14.
Note that you only want to start the dhcp server if you want to issue LAN addresses over your network. The dhcp client doesn't need this script to be used. Also note that this script is coded for the 'eth1' INTERFACE, which may need to be modified for your hardware configuration. With that in mind the dhcp init.d script can be created using the following commands.
cat > /etc/rc.d/init.d/dhcp << "EOF" #!/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 EOF chmod 755 /etc/rc.d/init.d/dhcp |
The lease file must exist on startup. The following command will satisfy that requirement:
touch /var/state/dhcp/dhcpd.leases |
The follow commands will create a base configuration file for a dhcp server. There are several options that you may want to add (information that is passed back to the dhcp client) and those are covered in the man pages for dhcp.conf.
cat > /etc/dhcpd.conf << "EOF" 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; } EOF |
All addresses should be changed to meet your circumstance.
The dhcp package contains dhclient, dhcpd and dhcrelay.
dhclient is the implementation of the DHCP client.
dhcpd implements Dynamic Host Configuration Protocol (DHCP) and Internet Bootstrap Protocol (BOOTP) requests for network addresses.
dhcrelay provides a means to accept DHCP and BOOTP requests on a subnet without a DHCP server and relay them to a DHCP server on another subnet.