1. 确认yum?源
2. 安装DHCP?服务
3. 配置DHCP?服务,导入配置模板文件
[root@localhost?~]#?yum?install?dhcp?-y
...
Complete!
[root@localhost?~]#
配置DHCP?服务
DHCP?配置文件路径。
[root@localhost?~]#?cat?/etc/dhcp/dhcpd.conf?
#
#?DHCP?Server?Configuration?file.
#???see?/usr/share/doc/dhcp*/dhcpd.conf.example
#???see?dhcpd.conf(5)?man?page
#
[root@localhost?~]#
精简配置文件内容。
[root@localhost?~]#?cat?/etc/dhcp/dhcpd.conf?
subnet?192.168.1.0?netmask?255.255.255.0?{??????????网段和子网掩码
??range?192.168.1.128?192.168.1.200;????????????????IP?地址范围
??option?domain-name-servers?192.168.1.254;?????????DNS?服务器
??option?routers?192.168.1.254;?????????????????????网关
??default-lease-time?600;???????????????????????????租期
??max-lease-time?7200;
}
[root@localhost?~]#
[root@localhost?~]#?systemctl?list-unit-files?|grep?"dhcpd.service"
dhcpd.service?????????????????????????????????disabled
[root@localhost?~]#?systemctl?start?dhcpd.service
[root@localhost?~]#?systemctl?enable?dhcpd.service?
Created?symlink?from?/etc/systemd/system/multi-user.target.wants/dhcpd.service?to?/usr/lib/systemd/system/dhcpd.service.
[root@localhost?~]#?netstat?-anptul?|?grep?"dhcp"??????????