文章 · · 230 阅读

虚拟机ping不通外网,虚拟机ping不通百度

smarty
虚拟机ping不通外网,虚拟机ping不通百度

现象:宿主机与虚拟机能互相ping通,宿主机能ping通外网,但虚拟机ping不通外网

原因:vmware的网关设置有误

1)查看linux网络配置信息

  1. [root@localhost ~]

cat /etc/sysconfig/network-scripts/ifcfg-eth0

  1. DEVICE=eth0
  2. TYPE=Ethernet
  3. UUID=4af77be9-c7c7-4245-acac-afc2b7f91e49
  4. ONBOOT=yes
  5. NM_CONTROLLED=yes
  6. BOOTPROTO=static
  7. HWADDR=00:50:56:26:15:DE
  8. DEFROUTE=yes
  9. PEERDNS=yes
  10. PEERROUTES=yes
  11. IPV4_FAILURE_FATAL=yes
  12. IPV6INIT=no
  13. NAME="System eth0"
  14. IPADDR=192.168.137.3
  15. NETMASK=255.255.255.0
  16. GATEWAY=192.168.137.254 #linux网关与vmware网关需一致才行
  17. DNS1=114.114.114.114
  18. DNS2=10.111.1.2

2)点击:虚拟网络编辑器

3)点击:更改设置 → VMnet8 → NAT设置

4)保持vmware网关是否与linux网关一致

5)重启网卡

  1. [root@localhost ~]

service network restart

  1. Shutting down interface eth0: [ OK ]
  2. Shutting down loopback interface: [ OK ]
  3. Bringing up loopback interface: [ OK ]
  4. Bringing up interface eth0: Determining if ip address 192.168.137.3 is already in use for device eth0... [ OK ]

6)ping通百度

  1. [root@localhost ~]

ping baidu.com

  1. PING baidu.com (110.242.68.66) 56(84) bytes of data.
  2. 64 bytes from 110.242.68.66: icmp_seq=1 ttl=128 time=60.3 ms
  3. 64 bytes from 110.242.68.66: icmp_seq=2 ttl=128 time=64.3 ms
0 评论

评论

还没有评论,来说两句吧