Setup DHCP Server On CentOS 6.5


To install DHCP server on CentOS 6.5, enter the following command:

yum install dhcp -y


DHCP server configuration is not that difficult. First, we have to assign which interface you want your DHCP server to run on. In my case, I have only one Interface on my system (eth0), so I assigned eth0.

To do that, edit file /etc/sysconfig/dhcpd,

vi /etc/sysconfig/dhcpd

Assign the network interface:

# Command line options here

Save and close the file. Then, copy the sample dhcp configuration file to /etc/dhcp/ directory.

cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf

Now, edit dhcpd.conf file,

vi /etc/dhcp/dhcpd.conf

Make the changes as shown below.

Set the domain name and domain-name servers:


# option definitions common to all supported networks...
 option domain-name "unixmen.local";
 option domain-name-servers server.unixmen.local;


If this DHCP server is the official DHCP server for the local network, you should uncomment the following line:


Define the sunbet, range of ip addresses, domain and domain name servers like below:

# A slightly different configuration for an internal subnet.
 subnet netmask {
 option domain-name-servers server.unixmen.local;
 option domain-name "unixmen.local";
 option routers;
 option broadcast-address;
 default-lease-time 600;
 max-lease-time 7200;

If you want to assign a fixed IP address to your client, you should enter it’s MAC id and the IP address in the following directive. For example, I want to assign a fixed IP address to my Ubuntu client, hence I modified the following directive as shown below.

host ubuntu-client {
 hardware ethernet 00:22:64:4f:e9:3a;

After making all the changes you want, save and close the file. Be mindful that if you have another unused entries on the dhcpd.conf file, comment them. Otherwise, you’ll have issues while starting dhcpd service.

Now, start the dhcpd service and make it to start automatically on every reboot.

service dhcpd start
chkconfig dhcpd on

Configure Clients

Now, go to the client configuration network settings and change the IP settings to Automatic (DHCP).

Here is my Lubuntu 14.04 settings:

Editing Wired connection 1_001

Restart the network or reboot the client system to get IP address automatically from the DHCp server.

Now, you should see the IP address has been automatically assigned to the clients from the DHCP server.

Run the following command from the client system Terminal:

sudo ifconfig

Sample output:

sk@sk: ~_002

As you see in the above picture, My ubuntu client system which has MAC id 00:22:64:4f:e9:3a gets a fixed IP address from the DHCP server.

That’s it. DHCP server is up and ready.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: