Equipment: centos7
Purpose: Build a DHCP server
1. Check DHCP
[root@localhost ~]# rpm -qa | grep '^dhcp'
dhcp-libs-4.2.5-79.el7.centos.x86_64
dhcp-4.2.5-79.el7.centos.x86_64
dhcp-common-4.2.5-79.el7.centos.x86_64
若没有安装则输入下面安装代码
[root@localhost ~]# yum -y install dhcp
two. Configuration file
[root@localhost ~]# vim /etc/dhcp/dhcpd.conf
subnet 192.168.x.x natwork 255.255.255.0(作用域)
range 192.168.x.x 192.168.x.x(地址池可分配IP)
option routers 192.168.x.x(网关)
option domain-name-servers(dns服务)
fefault-lease-time 100(租约时间)max-lease-time 7200(最大租约)
host fantasia {
地址绑定
hardware ethernet MAC地址(绑定物理地址客户端)
fixed-address 192.168.X.X(绑定网络地址指定客户端分配到得ip地址)}
three. Restart the network card
[root@localhost ~]# service dhcpd restart
[root@localhost ~]# systemctl restart dhcpd.service