Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Apr 2013 13:54:28 +0200
From:      Stefan Bethke <stb@lassitu.de>
To:        Nicolas de Bari Embriz Garcia Rojas <nbari@inbox.im>
Cc:        FreeBSD Net <freebsd-net@freebsd.org>
Subject:   Re: VirtualBox, if_bridge and bridged networking
Message-ID:  <113A294E-FF67-4355-8547-B2453B85A26D@lassitu.de>
In-Reply-To: <516D2451.80105@inbox.im>
References:  <0BD2971C-918F-423C-8D59-A2A3E3B02F04@lassitu.de> <516D2451.80105@inbox.im>

next in thread | previous in thread | raw e-mail | index | archive | help

Am 16.04.2013 um 12:13 schrieb Nicolas de Bari Embriz Garcia Rojas:

> On 04/16/2013 09:31, Stefan Bethke wrote:
>> Hey,
>>=20
>> 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.
>>=20
>> 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.
>>=20
>> My LAN gets to the host via vlan1 (attached to re0); which in turn is =
bridged via bridge0.  IP configuration is on bridge0.
...
>=20
> Try creating a tap interface and later bridge your VM to that  tap.
>=20
> 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=3D"bridge0 tap0 vlan1 vlan2 vlan3 vlan4 gif0"
ifconfig_re0=3D"up"
ifconfig_vlan1=3D"vlandev re0 vlan 1"
ifconfig_bridge0=3D"ether 02:00:00:00:00:01 addm tap0 addm vlan1"
ifconfig_bridge0_alias0=3D"inet 192.0.2.1/26"
ifconfig_tap0=3D"up"

I've extended this config to include tap1, to be used for VirtualBox =
bridging:
cloned_interfaces=3D"bridge0 tap0 tap1 vlan1 vlan2 vlan3 vlan4 gif0"
ifconfig_bridge0=3D"ether 02:00:00:00:00:01 addm tap0 addm tap1 addm =
vlan1"
ifconfig_bridge0_alias0=3D"inet 192.0.2.1/26"
ifconfig_re0=3D"up"
ifconfig_vlan1=3D"vlandev re0 vlan 1"
ifconfig_tap0=3D"up"
ifconfig_tap1=3D"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=3D1

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

--=20
Stefan Bethke <stb@lassitu.de>   Fon +49 151 14070811




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?113A294E-FF67-4355-8547-B2453B85A26D>