• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

VirtualBox Bridging on Gentoo

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

I.M.O.G.

Glorious Leader
Joined
Nov 12, 2002
Location
Rootstown, OH
I'm able to use NAT with VirtualBox without issue, but I'd like to use a bridged interface so I can take advantage of the seamless windows virtualbox feature. When I try to create a network bridge, rc.log goes wonky. I am following this guide to a T, and it even covers baselayout2 which applies to me since I'm using openrc.

When I try the network bridging, I get no network connection at all on my host Gentoo system. This is what my /etc/conf.d/net looks like, but I don't know what's wrong:

Code:
# This blank configuration will automatically use DHCP for any net.*
# scripts in /etc/init.d.  To create a more complete configuration,
# please review /etc/conf.d/net.example and save your configuration
# in /etc/conf.d/net (this file :]!).

config_eth0="null"

tuntap_vbox0="tap"
tunctl_vbox0="-u mrb78s"
config_vbox0="null"
tuntap_vbox1="tap"
tunctl_vbox1="-u mrb78s"
config_vbox1="null

rc_need_br0="net.vbox0"
bridge_br0="vbox0 vbox1 eth0"

config_br0="dhcp"

brctl_br0="setfd 0
sethello 0
stp off"

With that config, this is what I get in rc.log and it complains about line 16 first, which is "bridge_br0="vbox0 vbox1 eth0"
" in the code above:

Code:
rc boot logging started at Thu Dec 18 09:21:50 2008

 * Setting system clock using the hardware clock [Local Time] ...
 [ ok ]
 * Loading module vboxdrv ...
 [ ok ]
 * Loading module vmmon ...
 [ ok ]
 * Loading module vmnet ...
 [ ok ]
 * Autoloaded 3 module(s)
 * Checking local filesystems  ...
/dev/sda4: clean, 370352/1892352 files, 3210804/7568623 blocks
/dev/sda2: clean, 35/10040 files, 9527/40160 blocks
/dev/sda1: clean, 2524/7822224 files, 20079488/31227904 blocks
 [ ok ]
 * Remounting root filesystem read/write ...
 [ ok ]
 * Updating /etc/mtab ...
 [ ok ]
 * Mounting local filesystems ...
 [ ok ]
 * Setting hostname to l3adf3h ...
 [ ok ]
 * Configuring kernel parameters ...
 [ ok ]
 * Creating user login records ...
 [ ok ]
 * Cleaning /var/run ...
 [ ok ]
 * Wiping /tmp directory ...
 [ ok ]
 * Setting terminal encoding [UTF-8] ...
 [ ok ]
 * Setting console font [default8x16] ...
 [ ok ]
 * Loading key mappings [dvorak] ...
 [ ok ]
 * Setting keyboard mode [UTF-8] ...
 [ ok ]
/etc/init.d/../conf.d//net: line 16: vbox1: command not found
/etc/init.d/../conf.d//net: line 21: sethello: command not found
/etc/init.d/../conf.d//net: line 22: unexpected EOF while looking for matching `"'
/etc/init.d/../conf.d//net: line 23: syntax error: unexpected end of file
 * Bringing up interface lo
 *   127.0.0.1/8 ...
 [ ok ]
 *   Adding routes
 *     127.0.0.0/8 via 127.0.0.1 ...
 [ ok ]
/etc/init.d/../conf.d//net: line 16: vbox1: command not found
/etc/init.d/../conf.d//net: line 21: sethello: command not found
/etc/init.d/../conf.d//net: line 22: unexpected EOF while looking for matching `"'
/etc/init.d/../conf.d//net: line 23: syntax error: unexpected end of file
 * Bringing up interface eth0
 *   null ...
 [ ok ]
/etc/init.d/../conf.d//net: line 16: vbox1: command not found
/etc/init.d/../conf.d//net: line 21: sethello: command not found
/etc/init.d/../conf.d//net: line 22: unexpected EOF while looking for matching `"'
/etc/init.d/../conf.d//net: line 23: syntax error: unexpected end of file
 * Bringing up interface wlan0
 *   Starting wpa_supplicant on wlan0 ...
 [ ok ]
 *   Starting wpa_cli on wlan0 ...
 [ ok ]
 *   Backgrounding ... ...
 * WARNING: net.wlan0 has started, but is inactive
 * Mounting USB device filesystem [usbfs] ...
 [ ok ]
 * Mounting misc binary format filesystem ...
 [ ok ]
 * Mounting security filesystem ...
 [ ok ]
 * Mounting debug filesystem ...
 [ ok ]
 * Activating swap devices ...
 [ ok ]
 * udev postmount cleanup
 * Initializing random number generator ...
 [ ok ]

rc boot logging stopped at Thu Dec 18 14:21:55 2008

I can remove the init scripts for net.br0, net.vbox0, and net.vbox1, and set my /etc/conf.d/net as follows:

Code:
config_eth0="dhcp"

And then rc.log looks fine, and networking/NAT works fine:

Code:
rc boot logging started at Thu Dec 18 09:27:49 2008

 * Setting system clock using the hardware clock [Local Time] ...
 [ ok ]
 * Loading module vboxdrv ...
 [ ok ]
 * Loading module vmmon ...
 [ ok ]
 * Loading module vmnet ...
 [ ok ]
 * Autoloaded 3 module(s)
 * Checking local filesystems  ...
/dev/sda4: clean, 370346/1892352 files, 3210831/7568623 blocks
/dev/sda2: clean, 35/10040 files, 9527/40160 blocks
/dev/sda1: clean, 2524/7822224 files, 20079488/31227904 blocks (check in 5 mounts)
 [ ok ]
 * Remounting root filesystem read/write ...
 [ ok ]
 * Updating /etc/mtab ...
 [ ok ]
 * Mounting local filesystems ...
 [ ok ]
 * Setting hostname to l3adf3h ...
 [ ok ]
 * Configuring kernel parameters ...
 [ ok ]
 * Creating user login records ...
 [ ok ]
 * Cleaning /var/run ...
 [ ok ]
 * Wiping /tmp directory ...
 [ ok ]
 * Setting terminal encoding [UTF-8] ...
 [ ok ]
 * Setting console font [default8x16] ...
 [ ok ]
 * Loading key mappings [dvorak] ...
 [ ok ]
 * Setting keyboard mode [UTF-8] ...
 [ ok ]
 * Bringing up interface lo
 *   127.0.0.1/8 ...
 [ ok ]
 *   Adding routes
 *     127.0.0.0/8 via 127.0.0.1 ...
 [ ok ]
 * Bringing up interface eth0
 *   dhcp ...
 *     Running dhcpcd ...
eth0: dhcpcd 4.0.7 starting
eth0: waiting for carrier
eth0: carrier acquired
eth0: broadcasting for a lease
eth0: offered 10.20.65.199 from 10.20.100.99
eth0: checking 10.20.65.199 is available on attached networks
eth0: ignoring offer of 10.20.65.199 from 10.20.100.99
eth0: ignoring offer of 10.20.65.111 from 10.20.103.99
eth0: ignoring offer of 10.20.65.111 from 10.20.103.99
eth0: acknowledged 10.20.65.199 from 10.20.100.99
eth0: leased 10.20.65.199 for 10800 seconds
 [ ok ]
 *     received address 10.20.65.199/24
 [ ok ]
 * Mounting USB device filesystem [usbfs] ...
 [ ok ]
 * Mounting misc binary format filesystem ...
 [ ok ]
 * Mounting security filesystem ...
 [ ok ]
 * Mounting debug filesystem ...
 [ ok ]
 * Activating swap devices ...
 [ ok ]
 * udev postmount cleanup
 * Initializing random number generator ...
 [ ok ]

rc boot logging stopped at Thu Dec 18 14:28:06 2008


rc default logging started at Thu Dec 18 14:28:06 2008

 * Starting D-BUS system messagebus ...
 [ ok ]
 * Starting syslog-ng ...
 [ ok ]
 * Starting Hardware Abstraction Layer daemon ...
 [ ok ]
 * Mounting network filesystems ...
 [ ok ]
 * Starting vixie-cron ...
 [ ok ]
 * Starting local ...
 [ ok ]

rc default logging stopped at Thu Dec 18 14:28:08 2008

I just don't understand what I'm doing well enough with bridging, maybe line 16 of /etc/conf.d/net should just be "bridge_br0="vbox0 vbox1 eth0"", but then I don't know what vbox0 and vbox1 are for exactly.
 
Last edited:
A bridge bridges 2 (two) interfaces, not 3 usually

There is vbox0 and vbox1 cause VBox can have more than one network interface.
 
A bridge bridges 2 (two) interfaces, not 3 usually

There is vbox0 and vbox1 cause VBox can have more than one network interface.

actually, imog has it correct. it should work fine with both interfaces as well.

but...

it looks like you are missing a quote on line 13:

Code:
config_vbox1="null
should be
Code:
config_vbox1="null"


so this should work:
Code:
# This blank configuration will automatically use DHCP for any net.*
# scripts in /etc/init.d.  To create a more complete configuration,
# please review /etc/conf.d/net.example and save your configuration
# in /etc/conf.d/net (this file :]!).

config_eth0="null"

tuntap_vbox0="tap"
tunctl_vbox0="-u mrb78s"
config_vbox0="null"
tuntap_vbox1="tap"
tunctl_vbox1="-u mrb78s"
config_vbox1="null"

rc_need_br0="net.vbox0"
bridge_br0="vbox0 vbox1 eth0"

config_br0="dhcp"

brctl_br0="setfd 0
sethello 0
stp off"
 
That helps, I wasn't sure why they included vbox1 in the default instructions. I can try this again without including vbox1, and I'll see how it goes.

Thanks for the tip.
 
mbentley, I was on my blackberry earlier and didn't see your response - your exactly right! I looked that over quite a bit, another set of eyes sure helps.

That said, I went ahead and followed pharoer's thoughts earlier because I really only need one interface for my VM. My new working bridged network configuration is as follows:

Code:
# This blank configuration will automatically use DHCP for any net.*
# scripts in /etc/init.d.  To create a more complete configuration,
# please review /etc/conf.d/net.example and save your configuration
# in /etc/conf.d/net (this file :]!).

config_eth0="null"

tuntap_vbox0="tap"
tunctl_vbox0="-u mrb78s"
config_vbox0="null"

rc_need_br0="net.vbox0"
bridge_br0="vbox0 eth0"

config_br0="dhcp"

brctl_br0="setfd 0 sethello 0 stp off"

Seamless mode is working great also.
 
mbentley, I was on my blackberry earlier and didn't see your response - your exactly right! I looked that over quite a bit, another set of eyes sure helps.

That said, I went ahead and followed pharoer's thoughts earlier because I really only need one interface for my VM. My new working bridged network configuration is as follows:

Seamless mode is working great also.

sweet, glad i could help :) seamless mode is a great idea. i like how windows programs are just there on the screen and you can interact with them like they are native to the os. i am surprised vmware hasn't done something like that but i guess they are more focused on using their product for servers.
 
I've done bridging with vbox alot in ubuntu. While its easy, it breaks ALL the time. Just an FYI.

Thanks for the info, which version of vbox are you on? I'm on 2.0.6.

i am surprised vmware hasn't done something like that but i guess they are more focused on using their product for servers.

vmware has "unity" - which I believe was introduced with workstation 6.5 - I haven't tested it but I understand its equivalent functionality to seamless mode.

Seamless mode completely rocks - with the windows appearing native, Windows and Linux are at your fingertips immediately. Theres 3 or4 apps I need in Windows for my job... Before I had used tsclient, or dedicated vm windows to get my windows apps, but I'm loving seamless mode - so much quicker and theres like zero penalty. Works great so far.
 

Attachments

  • Screenshot-2.png
    Screenshot-2.png
    71.6 KB · Views: 1,510
Last edited:
It was with 2.0 to 2.0.6. Did you try the new one? 2.1? It has a new natting engine and bridging engine, might work better for ya.
 
Thanks for the info, which version of vbox are you on? I'm on 2.0.6.



vmware has "unity" - which I believe was introduced with workstation 6.5 - I haven't tested it but I understand its equivalent functionality to seamless mode.

Seamless mode completely rocks - with the windows appearing native, Windows and Linux are at your fingertips immediately. Theres 3 or4 apps I need in Windows for my job... Before I had used tsclient, or dedicated vm windows to get my windows apps, but I'm loving seamless mode - so much quicker and theres like zero penalty. Works great so far.

It was with 2.0 to 2.0.6. Did you try the new one? 2.1? It has a new natting engine and bridging engine, might work better for ya.

this has renewed my interest in trying virtualbox again :) i'm going to try 2.1 on my ubuntu install right now.
 
I thought 2.0.6 was the latest one I saw there... So far so good here tho. I'll be switching to 2.1 if I encounter issues.
 
It was with 2.0 to 2.0.6. Did you try the new one? 2.1? It has a new natting engine and bridging engine, might work better for ya.

Cheator, you are definitely right about the change in the way networking works with VirtualBox 2.1. you no longer have to set up a network bridge. you just have to set the network to "host interface" and it works without any fuss.
 
Cheator, you are definitely right about the change in the way networking works with VirtualBox 2.1. you no longer have to set up a network bridge. you just have to set the network to "host interface" and it works without any fuss.

sweet! Yeah I saw that last night... I love vbox :)
 
Cheator, you are definitely right about the change in the way networking works with VirtualBox 2.1. you no longer have to set up a network bridge. you just have to set the network to "host interface" and it works without any fuss.

Seconded, working great here on 2.1.
 
I never set anything at all up. Mine simply worked out of the box (wired). This is running 64 bit Gentoo multilib as host and Win2K as guest.

My ip shows up in Windows as 10.x.x.x which is not my normal private subnet. I have considered mapping the computers 2nd gigabit interface to windows 2k to use directly (there are 2 on the MSI k9n2 diamond), but have not gotten around to it, and there isn't too much reason to do it really. I keep all data on a file server anyways, which is accessed via samba or nfs depending on the os, and both the host and guest can see it without issues. My network is all restricted to only work with very specific ip's, but because of the NAT, the guest is seen as having the ip of the host.

EDIT: This is with VirtualBox 2.0.2.
 
Back