直接采用: yum install dhcp*
设置配置文件:vim /etc/dhcp/dhcpd.conf
配置文件:dhcpd.conf
# dhcpd.conf
#
# Sample configuration file for ISC dhcpd
#
# option definitions common to all supported networks...
option domain-name "jerry.com";
option domain-name-servers 114.114.114.114;
default-lease-time 43600;
max-lease-time 87200;
# Use this to enble / disable dynamic dns updates globally.
#ddns-update-style none;
# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
#authoritative;
# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;
# No service will be given on this subnet, but declaring it helps the
# DHCP server to understand the network topology.
subnet 192.168.0.0 netmask 255.255.0.0 {
range 192.168.26.100 192.168.26.110;
option routers 192.168.25.3;
}
启动DHCPD服务:/etc/init.d/dhcpd start #设置配置文件有误会报错,按错误提示修正再启动即可。
开一台虚拟机,设置成自动获取IP,测试效果如下: