How to Configure Linux DHCP server step by step with Example

DHCP ( Dynamic Host Configuration Protocol)  allows an administrator to configure network settings for all clients on a central server.

The DHCP clients request an IP address and other network settings from the DHCP server on the network. The DHCP server in turn leases the client an IP address within a given range or leases the client an IP address based on the MAC address of the client’s network interface card (NIC). The information includes its IP address, along with the network’s name server, gateway, and proxy addresses,including the netmask.

Nothing has to be configured manually on the local system, except to specify the DHCP server it should get its network configuration from. If an IP address is assigned according to the MAC address of the client’s NIC, the same IP address can be leased to the client every time the client requests one. DHCP makes network administration easier and less prone to error.

How to Configure Linux DHCP server step by step as:

Example :  Configure the DHCP server by matching the following conditions:

* Subnet and netmask should be 192.168.0.0 255.255.255.0
* Gateway Should be 192.168.0.254
* DNS Sever Should be 192.168.0.254
* Domain Name should be example.com
* Range from 192.168.0.10-50

Step 1:   Check it,  if not found then  Download and Install the DHCP Package 

Step2 : Now check dhcpd service in system service it should be on.

#setup
Select System service from list
[*]dhcpd

Step 3 :   To assign IP to dhcp server

    DHCP server have a static a ip address. First configure the ip address 192.168.0.254 with netmask of 255.255.255.0 on server.

For this Run “setup”  command form root user

#setup

This will launch a new window-” select network configuration”

Now a new window will show you all available LAN card select your LAN card ( if you don’t see any LAN card here mean you don’t have install driver)

Assign IP in this box and click on ok, quit and again quit to come back on root prompt.

Restart the network service so new ip address can take place on LAN card

#service network restart

Step 4 : Main configuration file of dhcp server is dhcpd.conf.

This file located on /etc directory. If this file is not present there or you have corrupted this file, then copy new file first.

now open   /etc/dhcpd.conf

default entry in this file Displayed It Look like as:

In which make following change to configure dhcp server:

remove this line  # – – – default gateway

set option routers to
192.168.0.254
set option subnet-mask to
255.255.255.0
option nis domain to
example.com
option domain-name to
example.com
option domain-name-servers to
192.168.0.254
range dynamic-bootp to
192.168.0.10 192.168.0.50;

After change this file should look like this :

I Hope this is Helpful to all.

Note : Read next Post ” How to configuration  Linux Client and Window Client”.