# Virtualbox Network settings problem [SOLVED]

## HeXiLeD

Recently i decided to try virtualbox as a replacement of vmware-* and i must say that i intend to replace vmware with this very nice VM.

However i am having some hard time setting up the network.

I have goggled, used virtualbox.org/wiki, checked Gentoo wiki ( 2 examples there ) and tried other distros methods and i still cant get it to work.

( yes i have the kernel support needed )

Can anyone post their working /etc/conf.d/net settings for virtualbox as an example ?

I almost had it working but right now i am a bit lost with so many options  that i have tried.

Thanks in advance.

----------

## jcat

What kind of networking do you require?  Bridged, NAT, etc...?

Cheers,

jcat

----------

## gimpel

Here is mine for bridged networking (replace "tom" with your username):

```
config_eth0=( "null" )

tuntap_vbox0="tap"

config_vbox0=( "null")

tunctl_vbox0="-u tom"

config_br0=( "192.168.1.2 netmask 255.255.255" )

routes_br0=( "default via 192.168.1.1" )

bridge_br0="eth0 vbox0"

depend_br0() 

{

   need net.eth0

   need net.vbox0

}

brctl_br0=( "setfd 0")
```

Also create the symlinks:

/etc/init.d/net.br0 -> net.lo

/etc/init.d/net.eth0 -> net.lo

/etc/init.d/net.vbox0 -> net.lo

Needed packages:

* net-misc/bridge-utils

* sys-apps/usermode-utilities

Kernel has to be configured with CONFIG_BRIDGE enabled.

In VBox select Hostinterface: vbox0

----------

## HeXiLeD

Thank you gimpel.

I was missing 2 settings on my latest attempt. Your example works  :Very Happy: 

This Topic is SOLVED for me.

However it would be good to have a few more examples poested here with other options; to help other people that might encounter some  difficulties setting up virtualbox network.

----------

## HeXiLeD

I just had some major changes on my box regarding network and i will be using 2 other eth cards which  i seem to have a problem with the whole network in general which i will be opening a new topic for that; but at the same time and in other way to help troubleshoot those problems and some current ones with vbox; would it be possible to have some more bridge examples here for vbox ?

one of the tests  i want to do and i seem  to have some trouble doing is with bridging vbox  to eth2 

* note: eth2 needs to keep its current static ip

* note  i have 2 other cards ( eth0 and eth1) which will be also be bridged to eth2 but not for vbox. ( eth1 network cam  and eth0 laptop )

----------

## HeXiLeD

http://en.gentoo-wiki.com/wiki/VirtualBox

From this how-to:

File: /etc/conf.d/net (baselayout-1)

```
#the interface is really replaced by br0 for outgoing, so if you had dhcp here, you'll use dhcp in br0

config_eth0=( "null" )

#this specifies that interface vbox0 will be a tap interface and use the tunctl command to generate itself

tuntap_vbox0="tap"

#ALL interfaces part of a bridge should be null, otherwise oddities may occur.

config_vbox0=( "null")

# you can specify an owner of the interface if you want to run virtual box as a non root user

# [COMMENT from a reader: VirtualBox should never be run as root]

tunctl_vbox0=("-u <user>")

tuntap_vbox1="tap"

tunctl_vbox1=( "-u <user>" )

config_vbox1=( "null" )

#If you'd prefer a dynamic ip address for the machine, use

#config_br0=( "dhcp" )

config_br0=( "192.168.1.2 netmask 255.255.255" )

routes_br0=( "default via 192.168.1.1" ) 

#this specifies the bridging information

bridge_br0="eth0 vbox0 vbox1"

#Make sure your baselayout is recent enough to support this

depend_br0() 

{

         need net.eth0

         need net.vbox0

         need net.vbox1

}

brctl_br0=( "setfd 0" 

"sethello 0"

"stp off" )

```

Now create interface symlinks:

```
ln -s net.lo /etc/init.d/net.vbox0

ln -s net.lo /etc/init.d/net.vbox1 

ln -s net.lo /etc/init.d/net.br0 

rc-update add net.br0 default

```

but i have some doubts about this:

first my eth0 is not used but it will be used for regular routing later. 

for gentoo  i use eth2. 

So from this how to  eth0 is replaced by eth2 in my case.

however in this example eth2 is set as "null" and in my system it needs to  use a static ip.

The best i was able to to do far is to brigde without errors but virtualbox OS is never able to ping anything.

Any ideas?

----------

