VirtualBox bridged adapter (vboxnetflt)
Robert Watson
rwatson at FreeBSD.org
Tue Aug 25 16:39:00 UTC 2009
On Fri, 21 Aug 2009, Fredrik Lindberg wrote:
> I've started working on the missing bits of the FreeBSD network
> implementation in VirtualBox.
>
> I now have a working vboxnetflt.ko driver that allows automatic bridged
> networking in VirtualBox (probably what most people want). This allows
> guests to automatically bridge with your existing network adapter providing
> seamless network access.
>
> Work on host-only adapter mode is in progress (this should not be confused
> with host-interface in previous vbox 2.x releases).
Hi Fredrik:
The technical approach you've taken here is a bit unusual and potentially
quite fragile -- replacing the method pointers on struct ifnet's maintained by
other drivers and "borrowing" spare fields is likely going to prove
problematic in the future (and, in fact, already).
It looks like a lot of what the driver is trying to accomplish can already be
done entirely from userspace using bpf(4): taking a tee of incoming frames
arriving at the NIC, perhaps selecting down to ones to specific ethernet
addresses, taking the card into and out of promiscuous mode, and injecting
frames into the output path, are exactly what BPF is designed to support. I
was wondering if you'd looked at this approach as an alternative to a custom
kernel driver?
Robert
>
> The patch can be found at
> http://www.shapeshifter.se/pub/patches/vbox-freebsd-network.patch
>
> Additional patch for emulators/virtualbox/Makefile
> http://www.shapeshifter.se/pub/patches/virtualbox-Makefile.patch
>
>
> You'll have to rebuild VirtualBox to make it work, the following lines
> should do the trick.
>
> cd /usr/ports/emulators/virtualbox
> make clean patch
> mkdir work/virtualbox-3.0.51r22226/src/VBox/HostDrivers/VBoxNetFlt/freebsd
>
> patch -d work/virtualbox-3.0.51r22226 < vbox-freebsd-network.patch
> patch < virtualbox-Makefile.patch
> make install
>
> In addition to vboxdrv.ko you'll need to load vboxnetflt.ko too.
>
> kldload /boot/modules/vboxnetflt.ko
>
> In VirtualBox network settings, under "Bridged Adapter" you should now
> see your available network interfaces. Select the one connected to your
> network and boot your virtual machine. It should now be connected to
> your local network as any other machine.
>
>
> Please note that this is just the first iteration of the patch and it
> should by no means be considered complete. It has only been tested
> on FreeBSD 8/i386. Slippery when wet :)
>
>
> The kld is also a bit hackish at the moment regarding to how it
> interfaces with the network stack to avoid kernel code modifications.
>
> Fredrik
> _______________________________________________
> freebsd-emulation at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-emulation
> To unsubscribe, send any mail to "freebsd-emulation-unsubscribe at freebsd.org"
>
More information about the freebsd-emulation
mailing list