Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

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 can't ping my Ubuntu on VirtualBox (within another Ubuntu).

I had set my ip using:

# ifconfig eth0 netmask up

but the ping still fails. What's different when you're in the VirtualBox?

share|improve this question
up vote 3 down vote accepted
  • First you must install the following programs:

sudo apt-get install uml-utilities bridge-utils

  • then you have to add something to the kernel:

sudo modprobe tun

  • Now, Here is a script that allows a guest virtual machine to connect to the main host and also have internet on both machines, you have to make a small adjustment to changing the USER variable for your user and ready, I save the script as vb:

permission first :

sudo chmod +x vb

then to start :

sudo ./vb start

if we do not need it anymore

sudo ./vb stop

  • create the virtual machine and configure it in the choice of network adapter bridge and interface vth0 and you are ready.,

Here the Script :


if [ -z $1 ]; then
echo "Usage: $0 [start|stop]"
exit 1

#Check root

USER=$(id -u)

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

USER=your user

function doStart {
#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

Step :

  • Execute the script
  • create your virtual machine or modify, in the machine configuration select NETWORK

enter image description here

  • then select BRIDGE ADAPTER and interface VTH0

enter image description here

share|improve this answer

I know that in vmware you have the option of bridging the connection from the hardware ethernet to the virtualized ethernet device. Are the connections bridged in VirtualBox?

share|improve this answer
sorry, how can I check that? – Tom Brito Mar 4 '11 at 13:00

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.