1、打开VMware,查看ifconfig

2、进入网卡编辑

[root@localhost ~]# cd /etc/sysconfig/network-scripts/
[root@localhost network-scripts]# ls
ifcfg-ens192  ifdown-ippp  ifdown-routes    ifup          ifup-ipv6   ifup-ppp       ifup-tunnel
ifcfg-lo      ifdown-ipv6  ifdown-sit       ifup-aliases  ifup-isdn   ifup-routes    ifup-wireless
ifdown        ifdown-isdn  ifdown-Team      ifup-bnep     ifup-plip   ifup-sit       init.ipv6-global
ifdown-bnep   ifdown-post  ifdown-TeamPort  ifup-eth      ifup-plusb  ifup-Team      network-functions
ifdown-eth    ifdown-ppp   ifdown-tunnel    ifup-ippp     ifup-post   ifup-TeamPort  network-functions-ipv6
[root@localhost network-scripts]# vim ifcfg-ens192 
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="static"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="ens192"
UUID="edaa0818-a218-42ab-8d57-299151cb2ff0"
DEVICE="ens192"
ONBOOT="yes"
IPADDR="172.18.47.91"
PREFIX="25"
GATEWAY="172.18.47.1"
DNS1="202.106.0.20"
IPV6_PRIVACY="no"
~
~
~
~
~
~
:wq

3、重启网卡

[root@localhost network-scripts]# systemctl restart network

4、连接百度或别的网址检查是否有网

[root@localhost network-scripts]# ping www.baidu.com
PING www.a.shifen.com (61.135.169.121) 56(84) bytes of data.
64 bytes from 61.135.169.121 (61.135.169.121): icmp_seq=1 ttl=54 time=3.12 ms
64 bytes from 61.135.169.121 (61.135.169.121): icmp_seq=2 ttl=54 time=2.44 ms
64 bytes from 61.135.169.121 (61.135.169.121): icmp_seq=3 ttl=54 time=4.69 ms
64 bytes from 61.135.169.121 (61.135.169.121): icmp_se=4 ttl=54 time=5.34 ms
12-20 11:53