无法从centos vm ping google

时间:2015-10-06 17:37:51

标签: centos virtual-machine

最近在我的Windows 7主机中安装了centos虚拟机(vm播放器)。

  • 我可以毫无问题地从内部网络ping我的虚拟机。
  • 我也可以毫无问题地从我的虚拟设备到达内部网络。
  • 但是我的虚拟机无法访问互联网,我无法ping谷歌或任何其他外部网络。

我尝试了几种解决方案,花了一个多星期的时间试图弄清楚问题是什么。

配置:

  • 我的虚拟机已桥接并在DHCP模式下工作:

[root @ localhost~]# ifconfig

eth0      Link encap:Ethernet  HWaddr 00:0C:29:2F:D7:52  
          inet addr:**172.31.44.128**  Bcast:172.31.47.255  Mask:255.255.248.0
          inet6 addr: fe80::20c:29ff:fe2f:d752/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:15535 errors:0 dropped:0 overruns:0 frame:0
          TX packets:503 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1099726 (1.0 MiB)  TX bytes:38953 (38.0 KiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:36 errors:0 dropped:0 overruns:0 frame:0
          TX packets:36 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:4098 (4.0 KiB)  TX bytes:4098 (4.0 KiB)

[root @ localhost~]# more / etc / sysconfig / network

NETWORKING=yes

NETWORKING_IPV6=yes

HOSTNAME=localhost.localdomain

[root @ localhost~]#**

more /etc/sysconfig/network-scripts/ifcfg-eth0**
# Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)

DEVICE=eth0

BOOTPROTO=dhcp

DHCPCLASS=

HWADDR=00:0C:29:2F:D7:52

ONBOOT=yes

[root @ localhost~]#**

more /etc/resolv.conf**
; generated by /sbin/dhclient-script

search dhcp.city.country.company
nameserver 172.31.41.2
nameserver 172.17.25.22
nameserver 172.16.25.10

[root @ localhost~]#

**netstat -rn**

Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
172.31.40.0     0.0.0.0         255.255.248.0   U         0 0          0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 eth0
0.0.0.0         172.31.40.1     0.0.0.0         UG        0 0          0 eth0

我可以ping我的网关,也可以ping我的DNS和代理:

[root @ localhost~]#

ping 172.31.40.1

PING 172.31.40.1 (172.31.40.1) 56(84) bytes of data.
64 bytes from 172.31.40.1: icmp_seq=1 ttl=255 time=11.9 ms
64 bytes from 172.31.40.1: icmp_seq=2 ttl=255 time=1.18 ms

[root@localhost ~]# ping 172.31.41.2

PING 172.31.41.2 (172.31.41.2) 56(84) bytes of data.
64 bytes from 172.31.41.2: icmp_seq=1 ttl=128 time=1.75 ms
64 bytes from 172.31.41.2: icmp_seq=2 ttl=128 time=0.520 ms
64 bytes from 172.31.41.2: icmp_seq=3 ttl=128 time=0.580 ms

[root@localhost ~]# ping ptx.proxy.corp.company

PING lmarcproxy100.ptx.fr.company (10.7.80.40) 56(84) bytes of data.
64 bytes from lmarcproxy100.ptx.fr.company (10.7.80.40): icmp_seq=1 ttl=246 time=40.2 ms
64 bytes from lmarcproxy100.ptx.fr.company (10.7.80.40): icmp_seq=2 ttl=246 time=40.1 ms
64 bytes from lmarcproxy100.ptx.fr.company (10.7.80.40): icmp_seq=3 ttl=246 time=40.2 ms
64 bytes from lmarcproxy100.ptx.fr.company (10.7.80.40): icmp_seq=4 ttl=246 time=40.2 ms

网络界面已启动&运行:

[root@localhost ~]# service network status
Configured devices:
lo eth0
Currently active devices:
lo eth0

防火墙已停止:

[root@localhost ~]# service iptables status
Firewall is stopped.
[root@localhost ~]# service ip6tables status
Firewall is stopped.

还有什么?我也可以![/ p>

但我无法连接互联网!

提前感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

尝试ping您的名称服务器IP地址并尝试ping您的网关地址。禁用resolv.conf中的search ...行