VMware虚拟机中的centos7.2系统连接外网

1.修改虚拟机网络连接方式
VMware虚拟机中的centos7.2系统连接外网
文章图片


2.修改虚拟机里的IP信息
TYPE=Ethernet
BOOTPROTO=none
DNS=8.8.8.8
DEFROUTE=yes
NAME=eno16777736
UUID=d4f28298-0007-4d9b-837a-47db0b0a2eae
DEVICE=eno16777736
ONBOOT=yes
IPADDR=192.168.4.130
NETMASK=255.255.255.0

GATEWAY=192.168.4.254
本机物理机ip如下
VMware虚拟机中的centos7.2系统连接外网
文章图片




3.试验效果
[root@node01 ~]# service network restart
Restarting network (via systemctl):[OK]
[root@node01 ~]# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=36 time=63.2 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=36 time=63.0 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=36 time=62.9 ms
^C
--- 8.8.8.8 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 62.996/63.105/63.275/0.238 ms
[root@node01 ~]# ping www.baidu.com
PING www.a.shifen.com (119.75.213.61) 56(84) bytes of data.
64 bytes from 119.75.213.61: icmp_seq=1 ttl=50 time=14.1 ms
64 bytes from 119.75.213.61: icmp_seq=2 ttl=50 time=13.0 ms
64 bytes from 119.75.213.61: icmp_seq=3 ttl=50 time=13.1
【VMware虚拟机中的centos7.2系统连接外网】4遇见问题
虚拟机centos7.2网络,没设网关,致使网络不通
[root@node01 ~]# ping 8.8.8.8
connect: Network is unreachable

    推荐阅读