How to configure DHCP server in Linux

Dynamic Host Configuration protocol (DHCP)This server is very useful if you are running a company with multiple clients where it becomes hard to manually assign the IP address manually so you redirect the client to take the IP from the server which is done using a DHCP server.


Make sure the required packge is installed in the machine.
# rpm -qa | grep dhcp
If the packages are not installed then follow these command for installation and configuration of the same
# yum -y install dhcp
Once the package is installed
# cd /etc/dhcp/

# vi dhcpd.conf
option domain-name "";
option domain-name-servers;
default-lease-time 600;
max-lease-time 7200;

subnet netmask {
range dynamic-bootp;
option broadcast-address;
option routers;

(Use these lines if you want to assign a fix IP to a particular client, mention client's IP with his/her MAC Address)

host ns {
hardware ethernet 08:00:07:26:c0:a5;
Just save and restart your dhcp server services
# service dhcpd restart
Go to the client machine and make the following changes in ifcfg-eth0 file
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
Restart your network services
# service network restart
and check the new IP of the your client machine

# ifconfig
 eth0      Link encap:Ethernet  HWaddr 00:0C:29:6D:55:DD
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::20c:29ff:fe6d:55dd/64 Scope:Link
          RX packets:19730475 errors:81 dropped:12 overruns:0 frame:0
          TX packets:6731135 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2544186474 (2.3 GiB)  TX bytes:2956734996 (2.7 GiB)
          Interrupt:18 Base address:0x2000

As you can see the new IP assigned to this machine as assigned by my DHCP server

If you face any issues in doing the same kindly leave back your comments with the error.

Follow the below links for more tutorials:

Configure Red Hat Cluster using VMware, Quorum Disk, GFS2, Openfiler
Tutorial for Monitoring Tools SAR and KSAR with examples in Linux
How to configure Samba 4 Secondary Domain Controller
How to secure Apache web server in Linux using password (.htaccess)
How to register Red Hat Linux with RHN (Red Hat Network )
Red hat Enterprise Linux 5.5 Installation Guide (Screenshots)
15 tips to enhance security of your Linux machine
Why is Linux more secure than windows and any other OS
What is the difference between "su" and "su -" in Linux?
What is kernel-PAE in Linux?
What is swappiness and how do we change its value?
How to log iptables messages in different log file
What are the s and k scripts in the etc rcx.d directories
How to check all the currently running services in Linux
How to auto start service after reboot in Linux
What is virtual memory, paging and swap space?