准备两台虚拟机 一台为客服机 一台为服务机
更改配置
点击编辑更改 网络编辑
服务端
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens33
[root@localhost ~]# systemctl restart network
[root@localhost ~]# ifconfig
重启网卡
[root@localhost ~]#systemctl restart network
[root@localhost ~]#ifconfig ens33
安装dhcp 修改配置文件
[root@localhost ~]# yum -y install dhcp
[root@localhost ~]# cp /usr/share/doc/dhcp*/dhcpd.conf.example /etc/dhcp/dhcpd.conf
[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 ens33
成功