Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )

Advanced DNS Management
New ZoneEdit. New Managment.


Sign Up Now
Reply to this topicStart new topic
> Setup A Simple Dhcp Server, (on WBEL/CentOS/TaoLinux)
post Jun 29 2004, 08:13 PM
Post #1

Its GNU/

Group: Admin
Posts: 3,433
Joined: 25-July 03
From: Corpus Chrsiti, TX, USA
Member No.: 1,151

A simple DHCP server setup on RHEL Clones like WBEL, Centos, TaoLinux

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 DHCP
Help is available from the following man pages:

man dhcp-eval
man dhcpd.conf
man dhcpd.leases
man dhcpd
man 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 as our network (that is the network that starts with and ends with We will save IPs to for servers and static addresses. We will pick the addresses to 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 (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, 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 (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 smile.gif. Here is the first line:
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:
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:
subnet netmask {
       option routers        ; #Default Gateway
       option subnet-mask    ;
       option domain-name              "home.local";
       option domain-name-servers;
       option netbios-name-servers; #WINS Server        
    range dynamic-bootp;  #DHCP Range to assign
       default-lease-time 43200;
       max-lease-time 86400;

4. Put all that together and we have the /etc/dhcpd.conf file. Here is a text file containing our example information.

example dhcpd.conf

5. If you have more than one ethernet adapter, you must specify which one to listen on in the file /etc/sysconfig/dhcpd. To listen on eth0, you would use the line:

6. To start the dhcp server now for testing, issue the command:

/etc/init.d/dhcpd start

To make the dhcp server restart at boot time, issue the commands:

chkconfig --level 2345 dhcpd on
chkconfig --level 016 dhcpd off

Then check to make sure it is correct with the command:

chkconfig --list dhcpd

the output should be

dhcpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off

7. If you are using a software firewall like iptables, you will need to allow all tcp and udp traffic into ports 67 and 68 into this machine.

8. Here are some good references:

DHCP Server Setup (some paths are different, but still good info)

RHEL - Configuring a DHCP Server <--Excellent Reference!

Using DHCP on Linux/FreeBSD <--Info on Dynamic DNS and DHCP

TCP/IP Network Administration - DHCP

Johnny Hughes
Enterprise Alternatives: CentOS, WhiteBoxEL
Favorite Workstation Distros (in order): CentOS, Gentoo, Debian Sarge, Ubuntu, Mandrake, FedoraCore, Slackware, SUSE
Favorite Server Distros (in order): CentOS, WhiteBoxEL, Debian Sarge, Slackware, Mandrake, FedoraCore, Gentoo, SUSE
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:


RSS Lo-Fi Version Time is now: 23rd October 2017 - 08:44 AM