无法访问互联网 Virtualbox

无法访问互联网 Virtualbox

我无法从 Ubuntu 中的 VirtualBox 连接到互联网 -

以下是我运行的 nslookup 命令 -

[cloudera@quickstart ~]$ nslookup
> server 8.8.8.8
Default server: 8.8.8.8
Address: 8.8.8.8#53
> www.google.com
;; connection timed out; trying next origin
;; connection timed out; trying next origin
;; connection timed out; no servers could be reached
> 

/etc/resolv.conf 文件配置 -

[cloudera@quickstart ~]$ cat /etc/resolv.conf 
# Generated by NetworkManager
domain informatica.com
search informatica.com cloudera
nameserver 10.65.32.40
nameserver 10.65.32.21
nameserver 10.65.32.113

路由表信息

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.0.2.0        *               255.255.255.0   U     1      0        0 eth0
192.168.56.0    *               255.255.255.0   U     1      0        0 eth1

如果配置详细信息

[cloudera@quickstart ~]$ ifconfig
eth0      Link encap:Ethernet  HWaddr 08:00:27:F2:E7:D4  
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:49 errors:0 dropped:0 overruns:0 frame:0
          TX packets:756 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:4418 (4.3 KiB)  TX bytes:66630 (65.0 KiB)

eth1      Link encap:Ethernet  HWaddr 08:00:27:38:B8:48  
          inet addr:192.168.56.101  Bcast:192.168.56.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:34 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:4836 (4.7 KiB)  TX bytes:1086 (1.0 KiB)

eth2      Link encap:Ethernet  HWaddr 08:00:27:64:6B:6B  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:74423 errors:0 dropped:0 overruns:0 frame:0
          TX packets:32 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:7074003 (6.7 MiB)  TX bytes:10944 (10.6 KiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:56596 errors:0 dropped:0 overruns:0 frame:0
          TX packets:56596 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:66442787 (63.3 MiB)  TX bytes:66442787 (63.3 MiB)

请告诉我如何解决这个问题

ip rs 的输出

10.0.2.0/24 dev eth0  proto kernel  scope link  src 10.0.2.15  metric 1 
192.168.56.0/24 dev eth1  proto kernel  scope link  src 192.168.56.0 
169.254.0.0/16 dev eth1  scope link  metric 1003 
default via 10.0.2.2 dev eth0  proto static 

答案1

我看到的是,您没有任何默认网关。

添加一个与你的虚拟机相关的:

sudo ip route add default via 10.0.2.2

然后尝试ping,,,等:dignslookup

$ ping -c 4 8.8.8.8

$ nslookup askubuntu.com

还要确保您的 VirtualBox 配置正确。

答案2

您所要做的就是重置配置文件。这可以在一行命令中完成

sudo ifdown eth0; sudo ifup eth0

相关内容