You are here
VirtualBox on DICE
DICE desktops can run virtual machines. This is done with VirtualBox. (See also virtualisation.)
Where can you run VirtualBox?
DICE desktops can run VirtualBox. This includes the computers in the labs in Appleton Tower, and personal DICE computers which staff and postgraduate students may have.
The DICE remote desktop service can not run VirtualBox. It is not installed there. This is because these machines are shared, and could not cope with the load.
VirtualBox in the Computing Labs
VirtualBox is available on the DICE desktops in the computing labs in Appleton Tower. It is used for coursework for certain courses. If you are taking one of those courses, you will be told how to use it and where to store your VirtualBox data.
Other than that, we do not recommend that you use VirtualBox on DICE in the computing labs. This is because there is no local disk space available to store the VirtualBox files in. You would have to store VirtualBox files in your AFS home directory instead. This would make your VM very slow, and it would also fill your disk quota.
A plea to teaching staff
Before using VirtualBox (or similar) in teaching, please contact computing support — they need to know in advance so that they can accommodate large VM images, and they can often suggest an efficient way of distributing your course materials.
VirtualBox on personal DICE desktops
To make and install a VM, login to your DICE machine as normal, start up a terminal and run the VirtualBox command. Using the GUI wizard, create a new virtual host and virtual disk image. (The disk image should be in your computer's /disk/scratch rather than your home directory for performance reasons.) You can then install any Guest OS from an ISO image or physical CD (e.g. Fedora or Windows). Note that you have to first mount the image file or CD to make it available to your virtual machine - use the CD menu in VirtualBox to do this.
Get install images for some popular Linux distros from:
- www.debian.org/CD/live/
- www.ubuntu.com/download/desktop
- www.scientificlinux.org/downloads/
- getfedora.org/
- linuxmint.com/download.php
USB Devices
DICE machines are not typically configured to permit virtual guests to access locally-connected USB devices, but this can be arranged on request.
Network configuration
The virtual machines use NAT networking by default. This should be fine for most purposes. The exception is if you want to run services on the Guest OS which are accessible from machines other than your desktop. In this case you can configure Port Forwarding on the guest. Bridge-mode is not normally supported on DICE machines; see below.
Port forwarding
After setting up a service on the Guest OS, you can set up the host to proxy incoming connections to that service using the command line tool VBoxManage. You will need to know which ports on the Guest OS the service uses, and decide which ports to use on the physical host. Often (but not always) you will want to use the same ports on the Guest OS and on the host. You can use any ports on the host greater than 1024 which are not already in use by a service. For example, to set up an incoming NAT connection to an http server on the Guest OS:
$ VBoxManage modifyvm "myFedorahost" --natpf1 "guesthttp,tcp,,8080,,80"
Here "myFedorahost" is the name of the virtual machine as displayed in the VirtualBox interface. The number one in the argument --natfp1 refers to the first (and default) network card. The name guesthttp is an arbitrary tag chosen to identify this particular port forwarding configuration; this can be anything you like. The Protocol can be either tcp or udp (these are case insensitive). With the configuration in place, all TCP connections to port 8080 on the physical host will now be forwarded to port 80 on the Guest OS. You might also have to check that your Guest OS does not apply any network filtering by default that would prevent services being run in this way. To remove a port forwarding configuration, use the following:
$ VBoxManage modifyvm "myFedorahost" --natpf1 delete "guesthttp"
and to check the current configuration use the VBoxManage showvminfo
command.
Note that it is not possible to configure port forwarding while the Guest OS is running. First, completely shut down the Guest OS and quit VirtualBox.
For more information on port forwarding please see theVirtualBox Manual page on the topic.
If you need the service to be visible outside of inf.ed.ac.uk then the Informatics firewall will need to allow traffic to the host port (8080 in the example above) on the physical host. Using the network from outwith the School describes how to ask for the firewall to be configured for your needs.
Bridged adapter
Port forwarding should work in most cases. However to install a DICE Guest OS with PXE/DHCP, and to use ports below 1024, you need to enable the Bridged networking option. This can be done in the VirtualBox GUI by selecting the "Network" configuration option for the virtual machine and choosing "Bridged Adapter" in place of "NAT". Bridging will not normally be permitted on DICE hosts, and won't work without the involvement of computing support; we don't recommend it.
Snapshots
Snapshots are unlikely to work - or give desirable performance or reliability - if stored in your home directory. To make sure they are created on local disk only, alter their default location. In each Virtual Machine's "settings" dialog, you are offered a choice of location:
- Right-click on the guest you wish to configure and choose "settings"
- In the "general" section click on the "advanced" tab.
- Snapshot location can be changed to
/disk/scratch/
(for example).
Useful commands
Start a 'headless' VM:
VBoxHeadless -s machinename -p port
If you've set up a remote console, you should be able to reach this via RDP, if you know the port:
rdesktop localhost:
You can safely shut down the VM (equivalent to touching the soft power button on the PC) with:
VBoxManage controlvm machinename acpipowerbutton