准备两台虚拟机,一位服务端,一为客户端
服务端:
更改VMware的配置

点击编辑中的虚拟网络编辑器,

服务端
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens33
[root@localhost ~]# systemctl restart network
[root@localhost ~]# ifconfig


安装dhcp并修改配置文件
[root@localhost ~]# yum -y install dhcp
[root@localhost ~]# cp /usr/share/doc/dhcp*/dhcpd.conf.example /etc/dhcp/dhcpd.conf
cp: overwrite ‘/etc/dhcp/dhcpd.conf’? y
[root@localhost ~]# vim /etc/dhcp/dhcpd.conf

开服务,关闭防火墙,降低沙盒等级
[root@localhost ~]# systemctl restart dhcpd
[root@localhost ~]# setenforce 0
[root@localhost ~]# systemctl stop firewalld
服务器验证
网卡配置
[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens33
[root@localhost ~]# systemctl restart network

重新分配IP
[root@localhost ~]# dhclient -r ens33
[root@localhost ~]# dhclient
[root@localhost ~]# ifconfig

本文详细介绍如何在虚拟机上搭建DHCP服务端,包括VMware配置调整、网络脚本编辑、DHCP软件安装及配置文件修改等步骤,确保客户端能自动获取IP地址。
354

被折叠的 条评论
为什么被折叠?



