How to Install DHCP Server on Cent OS

dhcp-service-on-centos

In this tutorial, you will learn how to install DHCP service on your Cent OS server. DHCP is the Dynamic Host Configuration Protocol that is a service that can manage and deliver IP addresses for your network.

Installing DHCP Service

To install DHCP service, you need to type the following command:

# yum install dhcp

Configuring a Basic DHCP Configuration

basic-dhcp-configuration

Configuration Setting that will use through this document:

  • IP Range: 172.16.1.100 – 172.16.1.200 /16
  • DNS Server: 124.108.4.130, 124.108.4.131
  • Default Gateway: 172.16.1.254
  • Length of the lease:
    • 600s => PCs > IPs
    • 259200s (3 days) => IPs >PCs
    • 43200s (12h) => Recommendation
  • WINS Server: 172.16.1.253
  • Domain Name: titdara.internal

To archive above configuration, you need to create or update text file /etc/dhcpd.conf as below:

# vi /etc/dhcpd.conf
ddns-update-style interim; Top of the file
ignore client-updates;
subnet 172.16.0.0 netmask 255.255.0.0 {
option routers 172.16.1.254; Default Gateway
option subnet-mask 255.255.0.0;
option domain-name “titdara.internal”;
option domain-name-servers 124.108.4.130, 124.108.4.131;
option time-offset -18000;
option netbios-name-servers 172.16.1.253; WINS Server
range dynamic-bootp 172.16.1.100 172.16.1.200; Range to be assign
default-lease-time 43200;
max-lease-time 86400;
}

If we have more than one network interface we need to specify which interface work DHCP server:

# vi /etc/sysconfig/dhcpd
DHCPARGS=eth1

Checklists after everything done:
Network Interface must have IP Configuration (172.16.1.1/16)
Set DHCP as Startup service

# chkconfig –level 2345 dhcpd on
# chkconfig –level 016 dhcpd off

Make sure it work:

# chkconfig –list
dhcpd dhcpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off

Start dhcpd service

# /etc/init.d/dhcpd start

Related Articles

Comments ()

Linux

February 02, 2016

03:55 pm

4349 Views

By Tithdara

MCP, MCSA, MITE

Latest Articles