CentOS / RHEL : How to configure an DHCP server

1. Install the dhcp package:

# yum install dhcp

2. Copy the sample file /usr/share/doc/dhcp*/dhcpd.conf.sample.

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

3. The Sample dhcp configuration file will look as follows.

# cat /etc/dhcp/dhcpd.conf

          Allow booting;
          Allow bootp;
          authoritative;
          subnet 192.168.0.0 netmask 255.255.255.0 {
          option routers 192.168.0.1;
          range 192.168.0.100 192.168.0.200;
          default-lease-time 21600;
          max-lease-time 43200;

You will need to change the IP addresses/ranges and subnet masks as per your requirements in the file above.

4. Restart the dhcp service once you are done with doing all the changes.

# /etc/init.d/dhcpd restart

For more about the dhcpd.conf, use the below command to check the man page:

# man dhcpd.conf
Related Post