Friday, 17 April 2015

CentOS 7: Install and configure DHCP Server


CentOS 7 is a Linux operating system and can be used for server infrastructure. Here I will share how to install and configure the DHCP server.
The first step that you do, you must have centos 7 operating system. without that, We couldn't do more. :D
the second is: DVD master of CentOS 7, this is very important and if you have connection internet is very good to do. 

From your machine do this command from terminal.

1. yum install dhcp
2. After the system finished, go to /etc/sysconfig/network-scripts/ifcfg-enp0s3

Here as sample, I have used IP Address 192.168.56.102 and netmask 255.255.255.0 and gateway 192.168.56.105

DEVICE=”eth0”
HWADDR=08:00:27:59:43:C8
NM_CONTROLLED=”yes”
BOOTPROTO=static
IPADD=192.168.56.102
NETMASK=255.255.255.0
Gateway=192.168.56.105


3. go to /etc/sysconfig/dhcpd and see "DHCPARGS" and set to DHCPDARGS=eth0
4. and then go to vi /etc/dhcp/dhcpd.conf
#specify domain name
option domain-name "amrilhakimsihotang.com";
#specify DNS server ip and additional DNS server ip
option domain-name-servers 192.168.56.103, 192.168.56.101
#specify default lease time
default-lease-time 600;
#specify Max lease time
max-lease-time 7200;
#specify log method
log-facility local7;
#Configuring subnet and iprange
subnet 192.168.56.100 netmask 255.255.255.0 {
range 192.168.1.106 192.168.56.254;
option broadcast-address 192.168.56.255;
#Default gateway ip
option routers 192.168.56.105;
}
#Fixed ip address based on MAC id
host Printer01 {
hardware ethernet 02:34:37:24:c0:a5;
fixed-address 192.168.56.104; -> for IP printer
}

5. save and restart DHCP

# service dhcpd start

For CentOS 7
# cd /bin
# systemctl restart dhcpd.servicecd


6. and for booting dhcp auto
# chkconfig --levels 235 dhcpd on 


 AHS

No comments:

Post a Comment