Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using oracle/sun virtual box3.2 on ubuntu 10.04 desktop. The ip is not assigned to the guest virtual system and the mode of network is bridged. I even tried 'dhclient' but it could not fetch.

Output of 'ifconfig':

alt text

Edit:1 Actually I want to have both, the guest should have access to internet and as well as the host to guest networking

share|improve this question
up vote 2 down vote accepted

If all you want is to browse the Web change to NAT otherwise :

Network Address Translation (NAT) If all you want is to browse the Web, download files and view e-mail inside the guest, then this default mode should be sufficient for you, and you can safely skip the rest of this section. Please note that there are certain limitations when using Windows file sharing (see chapter 6.3.3, NAT limitations, page 102 for details).

Bridged networking This is for more advanced networking needs such as network simulations and running servers in a guest. When enabled, VirtualBox connects to one of your installed network cards and exchanges network packets directly, circumventing your host operating system’s network stack.

see virtual box manual

you can use a TAP interface too :

First we have to install the follow :

sudo apt-get install uml-utilities bridge-utils

and after that add to kernel :

sudo modprobe tun

now, here there is a script that permit have and internet acces in host and guest at the same time :

copy and save as vb add execute permision :

sudo chmod +x vb

after that sudo ./vb start and when finish sudo ./vb stop

create the virtual machine as bridge and interface vth0

Here the SCRIPT :

#Check root

USER=$(id -u)

if [ "$USER" -ne "0" ]; then
echo “Must be root”
exit 1

USER= (**OJO – change with your userid ** )

function doStart {
#it seem not necesary because the userid
#below to virtualbox group
#chmod 0666 /dev/vboxdrv
#chmod 0666 /dev/net/tun

#Create the bridge
brctl addbr $BR
ifconfig $ETH promisc
brctl addif $BR $ETH
dhclient $BR

tunctl -t $TAP -u $USER
brctl addif $BR $TAP
ifconfig $TAP up

echo “$TAP ready”

function doStop {
ifconfig $BR down
ifconfig $TAP down
tunctl -d $TAP
brctl delbr $BR
dhclient $ETH

echo “Cleaned”

case $1 in


echo “Usage: $0 [start|stop]“

exit 0

more information here

share|improve this answer
Should I do these on host machine? – user3215 Oct 24 '10 at 2:05
user3215, exactly – hhlp Oct 24 '10 at 9:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.