This guide is how to setup a simple DHCP server to run on a RHEL Clone like WBEL, Centos, TaoLinux. The guide is based on having at least a minimal installation of one of the supported OSes. See this guide to install a minimal version of a supported OS if required.

What is DHCP?

DHCP is an acronym that stands for "Dynamic Host Configuration Protocol". DHCP's purpose is to enable individual computers on an IP network to automatically obtain their network configurations from a server, instead of requiring each PC's network configuration to be completed manually. The overall purpose of this is to reduce the work necessary to administer a large IP network. DHCP runs over UDP, utilizing ports 67 and 68.

How do I setup DHCP on a RHEL clone like White Box Enterprise Linux (WBEL), CentOS, or TaoLinux?

1. Do the above mentioned minimal install, if required.

2. After updating your linux install, install the programs required for the DHCP server with this command:

yum install dhcp

Important Files:To configure a DHCP server we will modify the configuration file /etc/dhcpd.conf. DHCP also uses the file /var/lib/dhcp/dhcpd.leases to store the client lease database.

Help for DHCPHelp is available from the following man pages:

man dhcp-evalman dhcpd.confman dhcpd.leasesman dhcpdman dhcrelay

3. Next we need to configure the DHCP server. First we need to know some information that we are going to assign. We need to know:

a. The range of IP addresses we want to assign to our computers. I normally use the 192.168.x.x networks for my internal LANs. In our example, we will use 192.168.0.0/255.255.255.0 as our network (that is the network that starts with 192.168.0.1 and ends with 192.168.0.254). We will save IPs 192.168.0.1 to 192.168.0.50 for servers and static addresses. We will pick the addresses 192.168.0.51 to 192.168.0.100 to assign to computers via DHCP.

b. The IP address of the DNS server(s) we will use for name lookups for our clients that we assign with DHCP. In my case, I will use the DNS server that I have setup on IP address 192.168.0.2. (You can use your ISP's DNS server if you don't have one ... see the ISP's site for details. You can also build your own internal DNS server on this machine or another internal machine by following this guide.

c. The Default Gateway of the computers that we are going to serve. In our example, this will be the IP address 192.168.0.1, which has been setup as the default gateway for our internal network.

d. The length of the lease (default and maximum). This is very subjective. If you have more PCs than IP addresses to give out, you want this to be a short time (600 seconds). If you have more IPs to give out than PCs (most likely the case), you can use a larger number. Microsoft defaults to 3 days (259200 seconds) with their DHCP servers. RedHat recommends 12 hours (43200 seconds). I will go with the RedHat default of 43200 seconds for default length and 86400 seconds for maximum length.

e. If we have a WINS server setup on the network (microsoft or samba only), we would need to know it's IP address. I have one, it is 192.168.0.2 (on the same machine as my DNS server).

f. We need a domain name to give out as well. If you are using real IP addresses, you can use a real domain name as well ... in our case, we are using an internal network (192.168.0.x) behind a single IP address from an ISP, so we will use the fictitious domain name home.local. If you are using an internal IP network, don't use a real external domain name, or you may not be able to talk to real PCs on that external network.

The DHCP Server configuration file (/etc/dhcpd.conf)

1. Now we have our information, so let's configure the server by creating a text file named /etc/dhcpd.conf. The first line in the file must be the DNS update scheme. There are 2 choices, but only one that works reliably ... so we will use that one . Here is the first line:

CODE

ddns-update-style interim;

2. The second line is whether to allow the DHCP to update client info to a Dynamic DNS server. In our example, we are not going to try and update a Dynamic DNS via our DHCP server, so we will not allow client updates. Here is our line 2:

CODE

ignore client-updates;

3. The next section of our file will be the subnet section ... we will define the network, and input the info we gathered above (see section 3 {a-f} above). Here is the subnet section: