VirtualBox, if_bridge and bridged networking
Stefan Bethke
stb at lassitu.de
Tue Apr 16 11:54:31 UTC 2013
Am 16.04.2013 um 12:13 schrieb Nicolas de Bari Embriz Garcia Rojas:
> On 04/16/2013 09:31, Stefan Bethke wrote:
>> Hey,
>>
>> I'm a bit stumped getting a (FreeBSD guest) VM to use bridged networking to work. The same VM works fine on a Mac OS X and an Ubuntu host, so I'm certain it's not the VMs setting.
>>
>> I'm running
>> # pkg info -g virtualbox*
>> virtualbox-ose-4.2.6 A general-purpose full virtualizer for x86 hardware
>> virtualbox-ose-kmod-4.2.6_4 VirtualBox kernel module for FreeBSD
>> on FreeBSD 9.1-STABLE r249476 amd64.
>>
>> My LAN gets to the host via vlan1 (attached to re0); which in turn is bridged via bridge0. IP configuration is on bridge0.
...
>
> Try creating a tap interface and later bridge your VM to that tap.
>
> in your host create a bridge containing re0 and tap0.
Thanks, that worked!
Since I couldn't find documentation online, here's my working setup for the archives:
My primary LAN comes into the host physically via re0; it's on vlan1. It is bridged via bridge0 to tap0, where it gets connected to a remote site via OpenVPN. Relevant bits from rc.conf (addresses changed):
cloned_interfaces="bridge0 tap0 vlan1 vlan2 vlan3 vlan4 gif0"
ifconfig_re0="up"
ifconfig_vlan1="vlandev re0 vlan 1"
ifconfig_bridge0="ether 02:00:00:00:00:01 addm tap0 addm vlan1"
ifconfig_bridge0_alias0="inet 192.0.2.1/26"
ifconfig_tap0="up"
I've extended this config to include tap1, to be used for VirtualBox bridging:
cloned_interfaces="bridge0 tap0 tap1 vlan1 vlan2 vlan3 vlan4 gif0"
ifconfig_bridge0="ether 02:00:00:00:00:01 addm tap0 addm tap1 addm vlan1"
ifconfig_bridge0_alias0="inet 192.0.2.1/26"
ifconfig_re0="up"
ifconfig_vlan1="vlandev re0 vlan 1"
ifconfig_tap0="up"
ifconfig_tap1="up"
Additionally, VirtualBox needs to be able to open the tap interface. Two settings are necessary: in /etc/sysctl.conf, add:
net.link.tap.user_open=1
In /etc/defvs.rules, under the rule section for your host, add:
add path tap* group wheel mode 660
Then configure the VM to use tap1 for bridging:
VBoxManage modifyvm FreeBSD-9-mini --bridgeadapter1 tap1
That should be it!
Stefan
--
Stefan Bethke <stb at lassitu.de> Fon +49 151 14070811
More information about the freebsd-net
mailing list