1.配置yum
2.安装DHCP服务
3.修改配置文件
4.关闭防火墙SELinux(当然也可以设置)
5.重启DHCP服务
6.检验
1.# vi /etc/yum.repos.d/base.repo
[base]
name=base
baseurl=file:///mnt
enable=1
gpgcheck=0
2.挂载 # mount /dev/sr0 /mnt
# yum install dhcp -y
3. 配置文件/etc/dhcp/dhcpd.conf 默认是空的
#cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf
文件修改后如下:
ddns-update-style none;
subnet 172.16.30.0 netmask 255.255.255.0 {
range 172.16.30.1 172.16.30.30;
option domain-name-servers 114.114.114.114;
option domain-name "example.org";
option routers 172.16.30.1;
option broadcast-address 172.16.30.255;
default-lease-time 600;
max-lease-time 7200;
} 注意分号及第一个大括号的位置
桥接虚拟机到同一个环回
4.#systemctl stop firewalld.server
#setenforce 0
5.#systemctl restart dhcpd.server
6.将DHCP改为自动获取