dhcp server configuration in centos

Install DHCP Server

Normally it install as part of your OS, if not you can install via YUM

#  yum -y install dhcp

Copy the sample conf file to /etc folder

# cp -f /usr/share/doc/dhcp*/dhcpd.conf.sample /etc/dhcpd.conf

Open Conf file

# vim  /etc/dhcpd.conf

My conf file looks like this

root@ajay:~# cat /etc/dhcpd.conf
authoritative;
#
default-lease-time 21600;
max-lease-time 43200;
#
# Dynamic DNS Options
#
# At least for this version, we won’t be including dynamic DNS updates.
#
ddns-update-style interim;
#ignore client-updates;
#
#key DHCP_UPDATER {
# algorithm HMAC-MD5.SIG-ALG.REG.INT;
# secret QXJjaGl0ZWN0IHZzIE9yYWNsZQo=;
#};
##
#zone __CLIENT__.private. {
# primary 127.0.0.1;
# key DHCP_UPDATER;
#}
##
#zone 0.168.192.in-addr.arpa. {
# primary 127.0.0.1;
# key DHCP_UPDATER;
#}
#
# Subnets
#
# Main connection (internal network).
#
subnet 192.168.0.0 netmask 255.255.255.0 {
#
# We retain the range 192.168.0.1–19 for static addresses,
# such as printers, and 192.168.0.20–49 for PPTP clients.
#
range dynamic-bootp 192.168.0.10 192.168.0.60;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.0.255;
option routers 192.168.0.1;
option domain-name “Ajay.private”;
option domain-name-servers 192.168.0.1;
#host abc {
# hardware ethernet 12:34:56:78:AB:CD;
# fixed-address 192.168.0.2;
#}
}

After that enable dhcpd in all run levels

# chkconfig dhcpd on

# /etc/init.d/dhcpd start

whala! check your client machine to see if it gets dhcp address

It's only fair to share...Tweet about this on TwitterShare on Google+Share on FacebookShare on LinkedInEmail this to someone
Twitter Auto Publish Powered By : XYZScripts.com