一.安装Dhcp rpm -ivh /mnt/Packages/dhcp-4.2.5-58.el7.centos.x86_64.rpm

rpm -qc dhcp 查找配置文件 /etc/dhcp/dhcpd.conf

二.修改配置文件 cat /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example 看例子

vi /etc/dhcp/dhcpd.conf

subnet 192.168.80.0 netmask 255.255.255.0 { range 192.168.80.100 192.168.80.200; option routers 192.168.80.1; option domain-name-servers 2.2.2.2, 3.3.3.3; default-lease-time 600; max-lease-time 7200;

}

#host boss {

hardware ethernet 00:0C:29:53:A1:B1;

fixed-address 192.168.80.188;

#}

三. 启动 [root@test ~]# service dhcpd start Redirecting to /bin/systemctl start dhcpd.service

cat /var/log/message 查日志找错误

[root@test ~]# netstat -anpu | grep dhcp 查看67端口 udp 0 0 0.0.0.0:67 0.0.0.0:* 1233/dhcpd udp 0 0 0.0.0.0:51515 0.0.0.0:* 1233/dhcpd udp6 0 0 :::25601 :::* 1233/dhcpd

[root@test ~]# service firewalld stop 停止防火墙 Redirecting to /bin/systemctl stop firewalld.service

[root@test ~]# cat /var/lib/dhcpd/dhcpd.leases 查看租约信息

The format of this file is documented in the dhcpd.leases(5) manual page.

This lease file was written by isc-dhcp-4.2.5

server-duid "\000\001\000\001!\336\363\010\000\014)E\357\257";