Wednesday, July 7, 2010

DHCP installation and Configuration on RHEL5/CentOS

1. Install dhcp server
yum –y install dhcp
2. Copy the sample configuration file to /etc
cp -v /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf
3. Edit the dhcp configuration file /etc/dhcpd.conf as our network details. Also  do the following
#       range dynamic-bootp 192.168.0.128 192.168.0.254; (comment this line and add as below)
        range 192.168.1.150 192.168.1.200;
note: If we dont want specific ip assignments for the hosts (reservation), comment that lines.
4. Start dhcp server
service dhcpd start
chkconfig dhcpd on
5. If we want to configure reservations for a system do as following in the /etc/dhcpd.conf file
host xp1 {
         hardware ethernet 00:0C:29:0C:55:83;
         fixed-address 192.168.1.170;
}
note : Optional 'option-*' are supported between host { } block
6. Restart the service to make the changes to effect
service dhcpd restart
7. Done!!

Notes:
1. On client system /var/lib/dhclient/dhclient-eth0.leases file contains dhcp lease information. On server /var/lib/dhcpd/dhcpd.leases contains the lease information for all clients.
2. NTP details can be given outside the subnet options to make globally available. For more information use ‘man dhcpd.conf’ command.

No comments: