Running Backtrack in VirtualBoxApril 11, 2008 – 4:59 AM
Seeing as I’ve just spent the morning trying to get all this up and running I thought I’d create an entry about how to get Backtrack running in VirtualBox.
For those who haven’t heard of it, VirtualBox is an open source equivalent to vmware workstation. It does full snapshoting (unlike vmware server) and seems to have a very active support community.
The setup I wanted was for the virtual machine to have its own IP address and full network access. The default setup for VirtualBox is to have NAT based networking so I had to do a bit of work to get full “Host Interface” mode. Unlike vmware, VirtualBox doesn’t do all the networking itself you have to do the initial setup yourself. This is done by using tun/tap and bridging. The instructions here work on Arch but should be generic enough for any distro. The install guide has detailed instructions for debian/ubuntu, redhat and suse.
First you need to install uml_utilities and bridge-utils, in Arch:
pacman -S uml_utilities bridge-utils
You then create a bridge and add your main interface to it:
brctl addbr br0
ifconfig eth0 0.0.0.0
brctl addif br0 eth0
ifconfig br0 up
The IP address normally assigned to eth0 now needs to be assigned to br0, so either bring up your dhcp client or hardcode the IP using ifconfig. If you are using ifconfig remember to setup your default route. Also remember to kill any dhcp clients working for eth0.
Next is creating the tun/tap interface. First check if you have the tun module loaded:
and if not load it:
The virtual machine is going to get its own interface, this can be named whatever you want, I call mine vbox0. To create it:
tunctl -t vbox0 -u robin
this then needs adding to the bridge:
brctl addif br0 vbox0
and, the bit I missed for a while, brining up:
ifconfig vbox0 up
You also need to check that the device (/dev/net/tun) is accessible by the user who is going to use it. I did this by creating a new vboxusers group, adding myself to it then making sure that the group could read and write from the device:
usermod -a -G vboxuser robin
chgrp vboxusers /dev/net/tun
chmod g+rw /dev/net/tun
You should now have a working virtual interface.
VirtualBox has a fairly simple GUI for creating new machines so I won’t talk through that in detail. Basically, click the create a new machine button, set the memory size and if you want to have a drive for the machine, set that up here as well.
Once you’ve setup the machine it will appear in the left hand list of available machines. Right click on it and chose settings. Chose Network and change the “Attached to” option to “Host Interface”. In the “Interface Name” section at the bottom enter vbox0 (or whatever you called it above).
Next go to the “cd/dvd-rom” section and chose “mount cd/dvd drive” and specify where your backtrack CD id, either ISO or physical location. Click OK and you’re done.
Start the machine, it should boot as normal and once up and running should try to get an IP address through dhcp, if you haven’t got dhcp you will need to setup the IP manually.
All of this information is available in the VirtualBox manual but I found that some of the scripts it referred to didn’t exist or didn’t work quite as expected. I also prefer to set this kind of thing up by hand, at least the first few times so that I really know what is going on, once I’m happy then I’ll look at scripting it.
Source: PaulDotCom Community Blog