Friday, February 6, 2015

DHCP with MAC-Binding on CentOS 7




mount -o loop /dev/cdrom /media

cd /media/Packages

rpm -ivh dhcp.....rpm

nano /etc/dhcp/dhcpd.conf

rpm -ivh


#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.example
#   see dhcpd.conf(5) man page

# create new



option domain-name "sourav.com";

option domain-name-servers 192.168.28.150 ;

option subnet-mask 255.255.255.0;

option broadcast-address 192.168.28.255;

option routers 192.168.28.50;







default-lease-time 600;

max-lease-time 7200;




subnet 192.168.28.0



netmask 255.255.255.0
{

range dynamic-bootp 192.168.28.190 192.168.28.195;

}
host client{
option host-name "client.sourav.com";
hardware ethernet 00:0c:29:ff:5b:64;
fixed-address 192.168.28.192;
}
 
save and exit


systemctl start dhcpd

systemctl enable dhcpd

start the client

nano /etc/sysconfig/network-scripts/ifcfg-ens33

TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=ens33
UUID=84c05b0f-7a4f-477b-80ca-758fbddf39d9
ONBOOT=yes
HWADDR=00:0C:29:5D:DD:7D


save and exit

systemctl restart network 

go to dhcp server

you should see the leased ip on 

 nano /var/lib/dhcpd/dhcpd.leases
 

and if you type

systemctl status dhcpd

you should see if it is running including the lease information

No comments:

Post a Comment