![]() |
DHCP Server Configuration |
Question : how to configure dhcp server in linux ?
Question : step by step setting Dynamic Host Configuration Protocol in centos ?
DHCP :- Dynamic Host Configuration Protocol
IP - 10.20.2.33
Hostname - khandwa.lokesh.com
OS - CentOS 6
PORT - 68
DHCP (Dynamic Host Configuration Protocol) is a network protocol used for assigning IP address to network clients dynamically from predefined IP pool. It is useful for LAN network, but not generally used for production servers.
Step -1
Install dhcp Package
# yum install dhcp* -y

step -2
Configure dhcp server
DHCP creates an empty configuration file /etc/dhcp/dhcpd.conf. Also it provides a sample configuration file at /usr/share/doc/dhcp*/dhcpd.conf.sample, which is very useful for configuring the DHCP server.
# vi /etc/dhcp/dhcpd.conf

step - 3
Copy Dhcp configuration in /etc dir.
# cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf
Now open for configuration
option domain-name "lokesh.com";
option domain-name-servers khandwa.lokesh.com;
default-lease-time 600;
max-lease-time 7200;
authoritative;
log-facility local7;
![]() |
DHCP Configuration file |
We are configuring DHCP for 10.20.2.0/24 LAN network
# A slightly different configuration for an internal subnet.
subnet 10.20.2.0 netmask 255.255.255.0 {
range 10.20.2.40 10.20.2.50;
option domain-name-servers 10.20.2.33; # dns Server name
option domain-name "lokesh.com";
option routers 10.20.2.1; # default gateway
# option broadcast-address 10.5.5.31;
default-lease-time 600;
max-lease-time 7200;
set IP address to host
host client1 {
option host-name "client1.lokesh.com";
hardware ethernet 08:00:07:26:c0:a5;
fixed-address 10.20.2.50;
}
Restart Service
service dhcpd restart
To monitor dhcp leases just type in terminal
![]() |
DHCP Lease |
vi /var/lib/dhcpd/dhcpd.leases
Thanks
End of this this topic, we need your support so i request you to please comment if something missed by me, share and like this post.
www.linuxtopic.com