1:vmware workstation 16 部署centos7
VMware-workstation-full-16.2.3-19376536 #搭建环境
CentOS-7-x86_64-DVD-2009 #镜像
2:配置虚拟机为静态地址
vi /etc/sysconfig/network-scripts/ifcfg-ens33
#变更
BOOTPROTO="static" #dhcp 换 static
#新增
IPADDR=192.168.35.120 静态地址
NETMASK=255.255.255.0
GATEWAY=192.168.35.2
DNS1=114.114.114.114 公共服务器
DNS2=8.8.8.8 公共服务器
3:systemctl restart network 保存并重启网卡配置
4:ping www.baidu.com
返回以下状态为可以链接互联网
64 bytes from 180.101.50.242 (180.101.50.242): icmp_seq=1 ttl=128 time=27.9 ms
64 bytes from 180.101.50.242 (180.101.50.242): icmp_seq=2 ttl=128 time=24.1 ms
64 bytes from 180.101.50.242 (180.101.50.242): icmp_seq=3 ttl=128 time=25.1 ms
64 bytes from 180.101.50.242 (180.101.50.242): icmp_seq=4 ttl=128 time=23.9 ms
64 bytes from 180.101.50.242 (180.101.50.242): icmp_seq=5 ttl=128 time=24.5 ms
^Z
[1]+ Stopped ping www.baidu.com