Thursday, 8 January 2015

Quick Start: Setup CentOS 7 as a DHCP Server

Quick Start: Setup CentOS 7 as a DHCP Server


In our EARLIER POST, we saw how to configure a DNS server on a CentOS 7 system. In this post, we will look at few simple steps that will help you create and configure a functional DHCP Server on your CentOS 7 system.


System Details:
Base OS:        CentOS 7 64 Bit (Minimal ISO)
HOSTNAME:  master.cloud.com
IPADDRESS: 192.168.0.15

Steps:

First of all, make sure your system has a static IP address assigned to it and a fully qualified domain name.

Next, install the DHCP packages

# yum install dhcp




Edit the dhcpd.conf file and paste the contents as shown below:

# vi /etc/dhcp/dhcpd.conf




# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.example
# see dhcpd.conf(5) man page
#
# option definitions common to all supported networks...

# specify domain name
option domain-name "cloud.com";
# specify name server's hostname or IP address
option domain-name-servers master.cloud.com;
# default lease time
default-lease-time 600;
# max lease time
max-lease-time 7200;
# this DHCP server to be declared valid
authoritative;
# specify network address and subnet mask
subnet 192.168.0.0 netmask 255.255.255.0 {

# specify the range of lease IP address
range dynamic-bootp 192.168.0.101 192.168.0.150;

# specify broadcast address
option broadcast-address 192.168.0.255;

# specify default gateway
option routers 192.168.0.1;
}
Edit the values highlighted in RED and replace them with your own values. Save and exit the editor once done.




Start and enable the DHCP Service

# systemctl start dhcpd

# systemctl enable dhcpd




You can test your DHCP Server by spinning up another system on the same network. By default, the Network Interface is always set to DHCP so if your settings are right, you should automatically see the IP address for your new system as shown below.




There you have it! A simple DHCP server based on CentOS 7.. Hope this tutorial helps you out.. stay tuned for lots more coming your ways soon!!

Cheers..

No comments :

Post a Comment