DHCP Server Setup Guide by Joey.
Created on December 3rd, 2003.
DHCP (Dynamic Host Configuration Protocol) is an Internet protocol for automating the configuration of computers that use TCP/IP. DHCP can be used to automatically assign IP addresses, to deliver TCP/IP stack configuration parameters such as the subnet mask and default router, and to provide other configuration information such as the addresses for printer, time and news servers.
This simple guide will cover the installation and configuration of ISC's DHCP Client for a local network. Their DHCP client can be downloaded at ftp://ftp.isc.org/isc/dhcp/
Once you've downloaded it, move the file to your favourite location
(/usr/local/src for this guide) and unpack it by running the
following command:
This will create a directory called dhcp-3.0pl2 (the version number
may vary). Enter into this directory and run the following command
as root:
If there are no errors you may run the following command (as root):
If there are no errors you may run the following command (as root):
If you come across any errors when running the above commands you are likely missing a library or file on your system. Your best bet is to visit http://www.google.com and perform a search on the error message. This should give you somewhat of an idea of what is missing and how to correct it. You might also want to have a look at the ISC DCHP Client Readme which can be found at http://www.isc.org/products/DHCP/dhcpv3-README.html.
Once DHCP has finished compiling you must copy the dhcpd.conf file to your /etc directory. You can find a sample dhcpd.conf file in the server/ directory of the DHCP package you downloaded. I've also included a sample dhcpd.conf file below.
# Sample dhcpd.conf
#
# Sample configuration file for ISC dhcpd
#
ddns-update-style ad-hoc;
# option definitions common to all supported networks...
option domain-name "linuxhelp.ca";
# Your name servers. You can normally find these in
# your /etc/resolv.conf file. These will be distributed to all DHCP
# clients.
option domain-name-servers 10.1.1.1, 65.39.196.215, 65.39.192.130;
default-lease-time 600;
max-lease-time 7200;
# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative;
# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;
# Configuration for an internal subnet.
subnet 10.1.1.0 netmask 255.255.255.0 {
range 10.1.1.2 10.1.1.25;
option domain-name-servers 10.1.1.1, 65.39.196.215, 65.39.192.130;
option domain-name "linuxhelp.ca";
option routers 10.1.1.1;
option broadcast-address 10.1.1.255;
default-lease-time 600;
max-lease-time 7200;
}
If you would like to assign a static IP to a peticular machine on
your network you'll need to know the MAC address of the ethernet
card on that peticular machine. To find the MAC address in Linux
type:
# Assign a static IP to atlantis.linuxhelp.ca
host atlantis {
hardware ethernet 00:45:40:10:FE:12;
fixed-address 10.1.1.20;
}
Once you've edited the config file to suit your network IP address
ranges etc, you'll want to create a file called dhcpd.leases in your
/var/state/dhcp/ directory. To do so, run the following command as
root:
# /usr/sbin/dhcpd eth1 Internet Software Consortium DHCP Server V3.0pl2 Copyright 1995-2003 Internet Software Consortium. All rights reserved. For info, please visit http://www.isc.org/products/DHCP Wrote 0 deleted host decls to leases file. Wrote 0 new dynamic host decls to leases file. Wrote 0 leases to leases file. Listening on LPF/eth1/00:40:44:16:2e:e8/10.1.1.0/24 Sending on LPF/eth1/00:40:44:16:2e:e8/10.1.1.0/24 Sending on Socket/fallback/fallback-net
ISC runs a few mailing lists with regards to their DHCP distribution. You should really consider signing up to the dhcp-announce list so you can be made aware of any software updates, security vulnerabilities etc that come up in the future. You can sign up at http://www.isc.org/services/public/lists/dhcp-lists.html
Having trouble? Got questions? Require further assistance? If so please feel free to visit our Help Forums and ask the experts!