Install DHCP on CentOS (Dom0)
15 JAN 2012 – INSTALL DHCP SERVER (and configure for Cisco Phone options)
NOTE: The tftp server address at this point was my laptop. This address was subsequently altered to shimla’s Dom0 interface (eth0) ip address. For information on installing the TFTP server see here: http://darenmatthews.com/blog/?page_id=1404
install dhcp server:
yum install dhcp
(then edit dhcpd.conf as in example which also use options for Cisco phone to locate tftp server):
[root@shimla ~]# ls /etc/dhc*
/etc/dhclient-eth0.conf /etc/dhcp6c.conf /etc/dhcpd.conf
This is the newly edited dhcpd.conf:
[root@shimla ~]# cat /etc/dhcpd.conf
ddns-update-style interim;
ignore client-updates;
option voip-tftp-servers code 150 = ip-address;
option voip-tftp-servers 10.10.0.100;
subnet 10.10.0.0 netmask 255.255.0.0 {
option routers 10.10.0.254;
option subnet-mask 255.255.0.0;
option nis-domain “”;
option domain-name “”;
option domain-name-servers 10.10.0.254;
option ntp-servers 192.168.0.130;
option tftp-server-name “10.10.0.100”;
range dynamic-bootp 10.10.0.150 10.10.0.175;
default-lease-time 3600;
max-lease-time 7200;
}
[root@shimla ~]#
start dhcp server:
[root@shimla ~]# /etc/init.d/dhcpd start
check status:
[root@shimla ~]# /etc/init.d/dhcpd status
dhcpd (pid 4982) is running…
[root@shimla ~]#
View DHCP leases:
cat /var/lib/dhcpd/dhcpd.leases
example:
[root@shimla ~]# !ca
cat /etc/dhcpd.conf
ddns-update-style interim;
ignore client-updates;
option voip-tftp-servers code 150 = ip-address;
option voip-tftp-servers 10.10.0.100;
subnet 10.10.0.0 netmask 255.255.0.0 {
option routers 10.10.0.254;
option subnet-mask 255.255.0.0;
option nis-domain “”;
option domain-name “”;
option domain-name-servers 10.10.0.254;
option ntp-servers 192.168.0.130;
option tftp-server-name “10.10.0.100”;
range dynamic-bootp 10.10.0.150 10.10.0.175;
default-lease-time 3600;
max-lease-time 7200;
}
[root@shimla ~]#
now edit /etc/sysconfig/dhcpd to make dhcp listen on eth0 (insert this):
[root@shimla init.d]# cat /etc/sysconfig/dhcpd
# Command line options here
DHCPDARGS=eth0
[root@shimla init.d]#
Now make dhcp server start each time CentOS booted into runlevel 5:
[root@shimla ~]# chkconfig dhcpd on
[root@shimla ~]# chkconfig –list | grep dhcpd
dhcpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@shimla ~]#
(this starts dhcpd in run level 5)