VirtualBox 的网络配置 (Windows)

作为一款开源软件,VirtualBox 完全继承了开源软件糟糕的用户体验,想正儿八经的用起网络来可真不简单。

默认情况下 GUEST 系统使用 VirtualBox 提供的 NAT 服务连接网络,这种方式的“神奇”之处是有的服务(HTTP)可以用,而有的(ICMP)无法使用,要真正正常地使用网络,需要在 VirtualBox 的网络设置 Host Interface 方式连接:

首先在网络设置界面中添加一个网络接口,这个接口会作为一个虚拟网卡出现在 Windows 控制面板的网络连接设置中,同时选中这个虚拟网卡和一个可用连接,点右键选择桥接,这个操作会造成 Windows 的网络设置丢失,需要你重新设置,另外虚拟网卡和可用连接会显示为连接断开,不用管它,网络通信是正常的。最后进 GUEST 系统,将网络地址为 HOST 系统的子网内地址:

ifconfig eth0 10.0.0.100.8
route add default gw 10.0.0.1
echo nameserver 10.0.0.1 > /etc/resolv.conf

测试一下,发现 HOST 和 GUEST 之间可以 Ping 通了。

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>