Configuring DHCP Server On CentOS 7 With VLAN

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Configuring DHCP Server on RHEL/CentOS 7

1. Overview

It is very useful to use DHCP server to dynamically distributing network


configuration parameters, such as IP addresses, domain name, and DNS IP address
for the client computers in the network, so we do not need not to do these tasks
manually to each computer within the network.
In this article you will see how to install and configure DHCP server in CentOS 7. It is
also applicable for RHEL 7.

2. Prerequisites

In this tutorial, it is supposed that:


a. You have already install RHEL/CentOS 7 Linux server up and running. In case that
you don’t, you would probably like to read this link. Minimal RHEL/CentOS 7
Installation With Logical Volume Manager (LVM).
b. You have already done the initial server setup. Please refer to this link Minimal
RHEL/CentOS 7 Initial Server Setup.
3. System Architecture Diagram
There are three VLANs on L3 Switch. DHCP server locates in VLAN 10. DHCP server
have to dynamically distributing network configuration parameters to clients
computers locate in another separated VLANs rather than its own VLAN which are
VLAN20 and VLAN30. The common network configuration parameters are domain
techspacekh.com and primary DNS server 10.0.10.2 and secondary DNS server
10.0.10.3.
4.

Install DHCP Server Package


To install DHCP server on CentOS 7 server, execute the following command.
# yum -y install dhcp

5. Configure DHCP Server


After installing the DHCP packet, it will create an empty configuration file
/etc/dhcp/dhcpd.conf. There is a sample configuration file in
/usr/share/doc/dhcp*/dhcpd.conf.sample which it can be very useful for configuring
the DHCP server.
For now let edit file /etc/dhcp/dhcpd.conf as the following.
# nano /etc/dhcp/dhcpd.conf
#
option domain-name "techspacekh.com";
option domain-name-servers 10.0.10.2, 10.0.10.3;
default-lease-time 600;
max-lease-time 7200;
authoritative;
log-facility local7;
##
subnet 10.0.10.0 netmask 255.255.255.0 {
}
## VLAN 20 Pool
subnet 10.0.20.0 netmask 255.255.255.0 {
range 10.0.20.50 10.0.20.254;
option domain-name-servers 10.0.10.2, 10.0.10.3;
option domain-name "techspacekh.com";
option routers 10.0.20.1;
option broadcast-address 10.0.20.255;
default-lease-time 600;
max-lease-time 7200;
}
## VLAN 30 Pool
subnet 10.0.30.0 netmask 255.255.255.0 {
range 10.0.30.50 10.0.30.254;
option domain-name-servers 10.0.10.2, 10.0.10.3;
option domain-name "techspacekh.com";
option routers 10.0.30.1;
option broadcast-address 10.0.30.255;
default-lease-time 600;
max-lease-time 7200;
}
#
Note: We need to declaring the subnet where our DHCP server located, because
DHCP server need to understand the network topology. We don’t need to add any
service into this subnet. In our case, the DHCP server is in VLAN 10, 10.0.10.0/24.
subnet 10.0.10.0 netmask 255.255.255.0 {
}
After edit file /etc/dhcp/dhcpd.conf, we need to enable and restart DHCP service
using following commands.
# systemctl enable dhcpd
# systemctl restart dhcpd
6. Conclusion
Now you just have done the installation and configuration of DHCP server in CentOS
7. I hope that you can find this instruction informative. If you have any questions or
suggestions you can always leave your comments below. I will try all of my best to
review and reply them.

Fonte: http://www.techspacekh.com/configuring-dhcp-server-on-rhelcentos-7/

You might also like