VirtualBox:Windows7是主机,Ubuntu是来宾 – 当networking是'桥'时如何configuration主机到VirtualBox?

我在我的Windows 7主机上的VirtualBox上使用Ubuntu作为guest,作为我的PHP / Ruby项目的Web服务器。

我将VirtualBox设置中的networking设置为“桥接”,现在我可以像192.168.2.26那样访问我的VirtualBox服务器 – 它每次都是由DHCP生成的,因此它不是静态的。

是否有可能使其静态或获得在Windows中的VirtualBox IP,所以我可以在Windows中的主机设置'虚拟箱',并在浏览器中'虚拟箱'的地址,我可以去'本地主机'?

在你的Ubuntu客户端编辑/etc/network/interfaces你会看到类似的东西

 auto lo iface lo inet loopback auto eth0 iface eth0 inet dhcp 

改变它类似于这个

 iface eth0 inet static address 192.168.2.26 netmask 255.255.255.0 network 192.168.2.0 broadcast 192.168.2.255 gateway 192.168.2.254 

使用您的networking中有意义的参数。 重新启动networking

 /etc/init.d/networking restart 

在Ubuntu上,guest通过编辑文件/ etc / network / interfaces来设置静态IP地址

 auto eth0 iface eth0 inet static address 192.168.2.26 netmask 255.255.255.0 gateway windows-machine-ip-adress 

而且,将windows机器的IP地址放在resolv.conf中。

resolv.conf文件通常包含具有可用于主机的名称服务器的IP地址的指令。

 #vim /etc/resolv.conf 

nameserver windows-machine-ip-address

并重新启动networking服务。