Tuesday, September 18, 2007

Virtual Box 1.5 networking in Ubuntu Feisty

As I published in my previous post, I installed Virtual Box 1.5.
Now that I am using it, I found a couple of problems. First, I wanted to copy the virtual disks (VDI), and to my surprise, to copy the files just won't do the trick. We must use the disks cloning tool, as in the following example:

VBoxManage clonevdi source.vdi destination.vdi

The next problem I had is that the network didn't work in 'Host Interface'. After looking at the help, and a few rounds with google, ubuntuforums and etcetera, I found a way to make it work. Here's a mini howto.
First we install necessary packages:
sudo apt-get install bridge-utils
sudo apt-get install uml-utilities

Then we must define network interfaces. We edit the interfaces file:
sudo gedit /etc/network/interfaces

We add the necessary interfaces (replacing 'user' for the user that will use the virtual machines, and obviously a correct IP):
auto br0
iface br0 inet dhcp
bridge_ports eth0 br0

auto tap0
iface tap0 inet manual
up ifconfig $IFACE up
down ifconfig $IFACE down
tunctl_user user

We restart the network:
sudo /etc/init.d/networking restart

We add the user to the uml-net group:
sudo gpasswd -a user uml-net

According to the help, this shoud work, but no. I found that for this to work we must execute:
sudo chmod 0666 /dev/net/tun
sudo chmod 0666 /dev/vboxdrv

After this, we may set 'Host Interface', and in the interface name we enter 'tap0'.

And that's it.

Versión en español

No comments: