From owner-freebsd-net@FreeBSD.ORG Tue Apr 16 11:54:31 2013 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 5C510B66 for ; Tue, 16 Apr 2013 11:54:31 +0000 (UTC) (envelope-from stb@lassitu.de) Received: from gilb.zs64.net (gilb.zs64.net [212.12.50.234]) by mx1.freebsd.org (Postfix) with ESMTP id 22243641 for ; Tue, 16 Apr 2013 11:54:30 +0000 (UTC) Received: by gilb.zs64.net (Postfix, from stb@lassitu.de) id 2EB52193011; Tue, 16 Apr 2013 11:54:29 +0000 (UTC) Subject: Re: VirtualBox, if_bridge and bridged networking Mime-Version: 1.0 (Apple Message framework v1283) Content-Type: text/plain; charset=iso-8859-1 From: Stefan Bethke In-Reply-To: <516D2451.80105@inbox.im> Date: Tue, 16 Apr 2013 13:54:28 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <113A294E-FF67-4355-8547-B2453B85A26D@lassitu.de> References: <0BD2971C-918F-423C-8D59-A2A3E3B02F04@lassitu.de> <516D2451.80105@inbox.im> To: Nicolas de Bari Embriz Garcia Rojas X-Mailer: Apple Mail (2.1283) Cc: FreeBSD Net X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 11:54:31 -0000 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 Fon +49 151 14070811