1.安装dhcp
yum install dhcp.x86_64 -y
cd /etc/dhcp/
ls
vim dhcpd.conf
cp /usr/share/doc/dhcp*/dhcpd.conf.example /etc/dhcp/dhcpd.conf #复制模板文件到/etc/dhcp/dhcpd.conf中
vim dhcpd.conf #修改配置文件
7 option domain-name "example.com";
8 option domain-name-servers 114.114.114.114;
删除27 28行
30 subnet 172.25.254.0 netmask 255.255.255.0 {
31 range 172.25.254.200 172.25.254.210;
32 option routers 172.25.254.65;
删除35行及以后
systemctl start dhcpd #开启dhcpd服务
systemctl enable dhcpd #设置dhcpd服务开机启动
cat /var/lib/dhcpd/dhcpd.leases
设置成功后可获取dhcp动态ip