# VirtualBox 3.0.12 and openrc bridged howto

## Nerevar

Here's how I got VirtualBox 3.0.12 working with openrc in manual bridged mode.

As noted below by cwr, there is also an "automatic" bridging method.

Linux Kernel:

```
Networking support --->

  Networking options --->

    <*> 802.1d Ethernet Bridging

Device Drivers --->

  [*] Network device support --->

    <*> Universal TUN/TAP device driver support
```

Add to /etc/make.conf:

```
ACCEPT_LICENSE="PUEL"
```

Emerge Virtualbox:

```
emerge -av virtualbox-bin
```

Add user to vboxusers group

```
useradd -G vboxusers <username>
```

Add to /etc/conf.d/modules:

```
modules="vboxdrv vboxnetadp vboxnetflt"
```

Restart modules:

```
/etc/init.d/modules restart
```

Emerge bridge-utils (for brctl) and usermode-utilities (for tunctl):

```
emerge -av bridge-utils usermode-utilities
```

Stop network:

```
/etc/init.d/network stop
```

Edit /etc/conf.d/network:

```
# Create bridge interface.

ifconfig_br0="<host ip address> netmask <host netmask>"

defaultroute="<host default route>"

ifup_br0="brctl addbr \$int; brctl setfd \$int 0; brctl addif \$int eth0; brctl addif \$int vboxnet0"

ifdown_br0="ifconfig \$int down; brctl delbr \$int"

# Add the tap to the bridge.

interfaces="tap0 br0"

ifup_tap0="tunctl -g vboxusers -t \$int"

ifdown_tap0="tunctl -d \$int"

# Setup host and client interfaces.

ifup_eth0="ifconfig \$int up"

ifdown_eth0="ifconfig \$int down"

ifup_vboxnet0="ifconfig \$int up"

ifdown_vboxnet0="ifconfig \$int down"
```

Start network (reboot may be needed to clear current network interfaces):

```
/etc/init.d/network start
```

Virtualbox Settings:

```
Machine -> Settings -> Network

Attached to: <Bridged Adapter>

Name: <br0>
```

Virtualbox client network configured for static IP address on same subnet as host.Last edited by Nerevar on Tue Dec 01, 2009 12:07 am; edited 1 time in total

----------

## ursusca

Thanks for sharing   :Exclamation:   :Exclamation:   :Exclamation:   :Very Happy:  I am going to create my own network lab of Oracle 11gR2 RAC using VirtualBox on my Gentoo box.

----------

## cwr

Why do you need bridging?  It used to be needed in VirtualBox < 2.1 (??),

but since then vboxnetflt seems to handle everything.

Will

----------

## Nerevar

 *cwr wrote:*   

> Why do you need bridging?  It used to be needed in VirtualBox < 2.1 (??),
> 
> but since then vboxnetflt seems to handle everything.
> 
> Will

 

I need bridging because I want the vbox client and host on the same network. The client will be running a server that is not available on linux.

As for the vboxnetflt module, I don't know anything about it other than google leads me to believe it's not included in a lot of distros.

If you have a link to how vboxnetflt works, please post it.

----------

## cwr

Well, I run VirtualBox clients and host on the same network without problems;

dhcpd dishes out either static or dynamic addresses depending on the setup.

vboxnetflt is part of VirtualBox and is installed with it.  I don't know exactly what

it does, but it came into use at the same time that VirtualBox no longer needed

explicit bridging.

Will

----------

## Nerevar

That very interesting.

I tried changing the client's default class A private address network to my class C private address network before implementing the bridge manually. So, there must be something that you have to do to get the netflt module to "automatically" bridge. Maybe it's just a vbox network setting?

Can you tell me what your network settings are for your client?

You have a choice of "Not Attached", "NAT" (I'm sure this doesn't work for me), "Bridged Adapter" (what I'm using), "Internal Network" and "Host-only Adapter". Also, what network interface are you using? Just your typical eth0?

----------

## agent_jdh

I switched to VirtualBox early in v3 and have never needed the additional bridging stuff e.g. kernel and userland tools - bridging 'just works' now with the vbox net module.

----------

## cwr

I can't recall the VirtualBox virtual card I'm using - it's the default, whatever

that is.  The VirtualBox connection is Bridged, and the net interface is eth0,

(which is the hardware connection on the host).  That setup lets me connect

to eg: SMB filesystems exported from the host, networked printers controlled

by CUPS, and other machines on the local network.  It all seems to be pretty

reliable.

Will

----------

## Nerevar

Thanks for the info cwr. I got it working that way as well. I don't have the time right now to do any benchmarking, but both ways "feel" the same speed wise.

----------

## shinyspoongod

 *Nerevar wrote:*   

> Thanks for the info cwr. I got it working that way as well. I don't have the time right now to do any benchmarking, but both ways "feel" the same speed wise.

 

i know this is a little old to post in but this is just a confirm that with the vboxnetctl vboxnetadp modules running bridging directly via the virtualbox configs in major version 3 is working via selecting eth0 as the interface. just want to help save anybody whatever amount of trouble i have wasted.

----------

