virtualbox怎么从主机访问虚拟机

VirtualBox安装后会在Windows 7分配一个网卡——虚拟网卡而已,在控制面板\网络和 Internet\网络连接中可以看到 VirtualBox Host-Only Network,这个网卡的IP一般是:

以太网适配器VirtualBox Host-Only Network:连接特定的DNS 后缀. . . . . . . :本地链接IPv6 地址. . . . . . . . : fe80::9849:c1ab:2f1b:f7f2IPv4 地址. . . . . . . . . . . . : 192.168.56.1子网掩码  . . . . . . . . . . . . : 255.255.255.0默认网关. . . . . . . . . . . . . :通常情况下,这个网卡没有启用。

 

以上 部分不必操作,  从这里 加网卡2是重要的:

右击 VirtualBox Host-Only Network ——>属性,在属性对话框中将 VirtualBox Bridged Networking Driver选择上。这是确认VirtualBox Host-Only Network网卡能工作。在虚拟机设置中,添加一个Adapter,连接方式选择Host-Only Adapter,界面名称选择VirtualBox Host-Only Ethernet Adapter。

运行ubuntu后,在终端里用ifconfig命令查看是不是多了块网卡

eth1 就是新增的网卡,我们再给它设置一个ip 192.168.56.101 netmask 255.255.255.0,设置好后从Windows 7中ping下 192.168.56.101,能拼通则可以从宿主机访问虚拟机VirtualBox了。

posted @ 2017-11-02 17:20  daviddu  阅读(614)  评论(0)    收藏  举报