VirtualBox - 桥接连接 - 访客无法访问互联网

VirtualBox - 桥接连接 - 访客无法访问互联网

我已经安装了一个 CLIDebian 3.16.7作为客人在里面VirtualBox 5.0.24Ubuntu-Gnome 16.04主机。我在虚拟机首选项中将网络设置为bridged network命名,wlp4s0因为我希望稍后在多个虚拟机之间建立互连并连接到互联网。
此外,每个虚拟机都应有自己的静态 IP。因此更改/etc/网络/接口客人

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
#allow-hotplug eth0
auto eth0
iface eth0 inet static
   address 192.168.1.10
   netmask 255.255.255.0

通过网络 ping 和建立 ssh 连接成功(来宾->主机,主机->来宾,来宾->其他计算机)。但 ping 互联网失败。NAT在修改之前,使用虚拟机网络设置可以访问互联网/etc/网络/接口

这可能是什么原因呢?


关于@MarkoPolo 的编辑:

# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0

尝试访问网站:

~$ wget http://www.flugzeuginfo.net/acimages/dh104_kp.jpg
--2016-08-20 17:09:06--  http://www.flugzeuginfo.net/acimages/dh104_kp.jpg
Resolving www.flugzeuginfo.net (www.flugzeuginfo.net)... failed: Name or service not known.
wget: unable to resolve host address ‘www.flugzeuginfo.net’

ifconfig -a
[sudo] password for ros: 
eth0      Link encap:Ethernet  HWaddr xxxxx
          inet addr:192.168.1.10  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: xxxxxx/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:577 errors:0 dropped:0 overruns:0 frame:0
          TX packets:332 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:67163 (65.5 KiB)  TX bytes:39453 (38.5 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:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

答案1

这个问题的解决方案是确保/etc/network/interfaces正确填充。特别是,需要设置gateway和属性。最终结果是:dns-nameservers

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
#allow-hotplug eth0
auto eth0
iface eth0 inet static
   address 192.168.1.10
   netmask 255.255.255.0
   gateway 192.168.1.1
   dns-nameservers 8.8.8.8

相关内容