Setup DHCP Server CentOS 6


-Install DHCP server
# yum -y install dhcp

-Backup dhcpd.conf
# mv /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.asli

-File sampel default konfigurasi dhcp ada di /usr/share/doc/dhcp-versidhcp/dhcpd.conf.sample
Copy file tersebut ke /etc/dhcpd.conf untuk diedit.
# cp /usr/share/doc/dhcp-*/dhcpd.conf.sample /etc/dhcp/dhcpd.conf

-Edit /etc/dhcp/dhcpd.conf:
# vi /etc/dhcp/dhcpd.conf

ddns-update-style interim;
ignore client-updates;
authoritative;

#Opt auto detect proxy:
#option wpad-url code 252 = text;

subnet 192.168.10.0 netmask 255.255.255.0 {
range dynamic-bootp 192.168.10.100 192.168.10.200;
option domain-name-servers 192.168.10.5,192.168.10.6;
option netbios-name-servers 192.168.10.6;
option domain-name "tahubachem.net";
option routers 192.168.10.1;
option broadcast-address 192.168.10.255;

#Opt auto detect proxy:
#option wpad-url "http://192.168.10.6/wpad.dat\n";

#Leased time in second, 1day=24h=86400s
default-lease-time 86400;
max-lease-time 604800;

# Fixed IP addresses can outside range ip dhcp 
host pcku-win7 {
 hardware ethernet 00:30:67:CB:52:64;
 fixed-address 192.168.10.99;
}

host vm1-xpsp3 {
 hardware ethernet 00:0c:29:15:48:44;
 fixed-address 192.168.10.51;
}

host vm2-xpsp3 {
 hardware ethernet 00:0c:29:91:6d:a4;
 fixed-address 192.168.10.52;
}
}

 
-Edit /etc/sysconfig/dhcpd disetting untuk listen pada eth1 (DHCP listen):
# vi /etc/sysconfig/dhcpd

DHCPDARGS=eth1

 
-To make the dhcp server start at boot time, issue the commands:
# chkconfig dhcpd on

-Restart service DHCP
# service dhcpd restart


Leave a Reply

Your email address will not be published. Required fields are marked *