# FreeBSD as Host System for Sun VirtualBox



## quakerdoomer (Oct 1, 2009)

I've installed virtualbox using pkg_add
I have problems accessing the FreeBSD Host using VirtualBox from a Guest System (XP)
My detailed query is available at 
http://forums.virtualbox.org/viewtopic.php?f=1&t=22906

So far nobody on VirtualBox Forums have replied. Has anybody here tried VirtualBox on FreeBSD before ?


----------



## osx-addict (Oct 1, 2009)

I'm watching to see how this turns out.. It seems like virtualbox is perhaps not horribly mature on Freebsd from what I've read.  However, it seems like something I might be interested in down the line..


----------



## aragon (Oct 2, 2009)

What you're trying to do requires your virtualbox network to operate in bridge mode.  It sounds like it is in NAT mode.


----------



## quakerdoomer (Oct 2, 2009)

In one of the screenshots of "FreeBSD 8.0-RC1 Custom XFCE DVD" posted by manolis@
http://forums.freebsd.org/showthread.php?t=7216

I saw VirtualBox running in one of the screenshots posted.I don't know whether he was successful in bridging his XP Guest Box with FreeBSD Host.

"manolis@ this is quakerdoomer. If you are reading this you are the Resistance."


----------



## hedwards (Oct 4, 2009)

osx-addict said:
			
		

> I'm watching to see how this turns out.. It seems like virtualbox is perhaps not horribly mature on Freebsd from what I've read.  However, it seems like something I might be interested in down the line..



That's true, but I've had it running and it does a pretty good job. The support isn't complete, such as there isn't any support with the extra tools, but it does run reasonably well, definitely better than other options I've tried.


----------



## yks (Oct 9, 2009)

Just installed VirtualBox 3.0.51.r22902_2 on FreeBSD 7.2.
Having read docs at http://wiki.freebsd.org/VirtualBox, I tried to create a bridged network the way I did with QEMU, but it didn't function (tap device wasn't accessed by VirtualBox at all). After some googling I found a small note that _it is not necessary to configure any bridge interface on the host, it's only required (and enough) to load the vboxnetflt.ko kernel module_ - and voila, here it is! Everything works, and VBox is really much faster than QEMU, at least with a WinXP guest (my respect to QEMU author anyway).
I hope this might help someone, and it would also be nice of the Wiki authors to highlight this matter, because it's slightly confusing to write about QEMU network settings in the first place and not to mention the default, easier working settings with just the kernel module.


----------



## yks (Oct 9, 2009)

By the way, I'm using the following easy shell script to start VirtualBox:

```
#!/bin/sh
# mount procfs if not mounted already
if [ "" = "`mount|grep 'proc'`" ]; then
  sudo mount -t procfs proc /proc
fi
# might also write a check, but multiple kldloads do no harm
# just print warnings to stderr
sudo kldload vboxdrv
sudo kldload vboxnetflt
# start vbox in background
VirtualBox &
# wait while it loads completely
# the delay might be increased for slow PCs
sleep 5
# check whether there are more than 1 processes of vbox
# ps ax|grep VirtualBox|grep -v grep|sort
# the following leaves only one vbox process, with the smallest PID
while [ `pgrep VirtualBox|wc -l` -gt 1 ]; do
  kill `pgrep VirtualBox|sort|tail -1`
# a delay is required so that the process being killed has time 
# to get killed
  sleep 5
done
```
This script runs vbox in background, so it may be evoked just as
`#  ./vbox-start.sh`
without ampersand.
The script ain't perfect, of course. But again, just sharing in hope it helps anyone.


----------



## aragon (Oct 10, 2009)

yks said:
			
		

> Just installed VirtualBox 3.0.51.r22902_2 on FreeBSD 7.2.
> Having read docs at http://wiki.freebsd.org/VirtualBox, I tried to create a bridged network the way I did with QEMU, but it didn't function (tap device wasn't accessed by VirtualBox at all). After some googling I found a small note that _it is not necessary to configure any bridge interface on the host, it's only required (and enough) to load the vboxnetflt.ko kernel module_ - and voila, here it is!



For some reason when I enable bridging on my vbox nic and start the VM, it runs briefly and then just exits suddenly with no error message or anything.  Stuck with NAT mode...


----------



## DutchDaemon (Oct 19, 2009)

Recent bridge development:
http://forums.freebsd.org/showpost.php?p=45664&postcount=5


----------

