Virtual box 原理:用软件模拟硬件设备,和共享硬件设备
一般而言,安装完 VirtualBox 设定网路时选择默认的 NAT 模式, Guest 就可顺利联网了,而在主机产生一个地址为 192.168.56.1 host-only vbox 的网卡,但是这时候虚拟机是不能与主机通信的。 <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

通过把在网络连接 1 NAT 模式改为 host-only 模式,就可以与主机通信了,但又出现问题,虚拟机不能上网。

这时候,可以在虚拟机里面增加一张网卡,网络连接 2. 改为 NAT ,然后让这张网卡自动获取一下 IP ,一般为<?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" /> 10.0.2 .2 网段,重启,就可以上网了。