终于解决了gentoo里的virtualbox不能桥接的问题

gentoo中安装了virtualbox-bin,始终无法设置桥接方式,一启动虚拟机就出错。试了几次直接emerge virtualbox,但总是在编译到最后时出错,无法安装。

今天又搜索了一下,找到了gentoo的wiki,终于解决了这一问题。原来,直接emerge virtualbox是安装OSE版的virtualbox,不能用usb的,还就得安装virtualbox-bin。而virtualbox-bin要使用桥接,还必须得启动vboxnetflt模块。wiki中有如下提示:

Bridged

If you need your guest OS to have a different IP address in the same subnet on the same Ethernet interface, then you should use bridging.

Note: The following steps are not necessary for setting up Host Interface on VirtualBox >= 2.1.

VirtualBox Version >= 2.1

You no longer need the TUN/TAP and bridging support, as VirtualBox has built the bridging functionality directly into the software. However, for those of you have it already configured and recently upgraded from VirtualBox 2.0 to 2.1+, you may find that you get an error when you try to start your VM. The error, ERR_HOSTIF_INIT_FAILED, will prevent you from starting the VM.

In order to fix it, you will need to modprobe the new vboxnetflt kernel module. You can find it in: /lib/modules/<kernel>/misc/vboxnetflt.ko. Simply change into that directory and run modprobe on the module, then restart your VM.

其中的解决办法是:

modprobe vboxnetflt

以上命令只是开机后用命令启动模块,重启后还得运行一次,如果想要开机时自动启动这个模块,需要:

echo 'modules="${modules} vboxnetflt"' >> /etc/conf.d/modules

发表评论

电子邮件地址不会被公开。

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据