虚拟盒与移动宽带联网

虚拟盒与移动宽带联网

我使用 vmbox 4.1 在虚拟机中安装 ubuntu 11.10 64。我的主机也有 ubuntu 11.10 64。我使用移动宽带。这是我的网络详细信息。

eth0      Link encap:Ethernet  HWaddr d0:27:88:7c:2c:0d 
          UP BROADCAST MULTICAST  MTU:1500  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:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:43 Base address:0xc000 

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:630 errors:0 dropped:0 overruns:0 frame:0
          TX packets:630 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:370028 (370.0 KB)  TX bytes:370028 (370.0 KB)

ppp0      Link encap:Point-to-Point Protocol  
          inet addr:10.113.52.123  P-t-P:10.64.64.64  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:96536 errors:196 dropped:0 overruns:0 frame:0
          TX packets:69735 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3 
          RX bytes:116819812 (116.8 MB)  TX bytes:6462243 (6.4 MB)


Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.64.64.64     0.0.0.0         UG    0      0        0 ppp0
10.64.64.64     0.0.0.0         255.255.255.255 UH    0      0        0 ppp0
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 ppp0

我尝试使用 NAT 将网络与我的虚拟机连接起来。这是我的虚拟机网络详细信息。

eth0      Link encap:Ethernet  HWaddr 08:00:27:59:7e:f8  
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe59:7ef8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:12 errors:0 dropped:0 overruns:0 frame:0
          TX packets:59 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:2352 (2.3 KB)  TX bytes:10364 (10.3 KB)

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: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)

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.0.2.2        0.0.0.0         UG    0      0        0 eth0
10.0.2.0        0.0.0.0         255.255.255.0   U     1      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 eth0

现在我可以连接外部服务器。例如:我可以 ping 到 10.113.52.123

但我无法在主机上连接虚拟机。例如:我无法 ping 到 10.0.2.15

我尝试使用桥接。但当时所有网络都无法正常工作。这是我使用桥接时的网络详细信息。

eth0      Link encap:Ethernet  HWaddr 08:00:27:59:7e:f8  
          inet6 addr: fe80::a00:27ff:fe59:7ef8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:22 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:5176 (5.1 KB)

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: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

您可以继续使用 NAT 选项,并为您的虚拟机添加第二个网络接口,该接口桥接到lo主机的接口。然后,您的虚拟机通过 eth0 接口连接到互联网,并通过 eth1 接口连接到主机。

相关内容