Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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
add comment

1 Answer 1

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
fi

USER= (**OJO – change with your userid ** )
TAP=vth0
BR=br0
ETH=eth0

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 0.0.0.0 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
start)
doStart
;;

stop)
doStop
;;

*)
echo “Usage: $0 [start|stop]“
;;
esac

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
add comment

Your Answer

 
discard

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.