The Virtualization Mega-Thread
Welcome to the Virtualization Mega thread.
Contents
Post 1 Overview of (major) options.
Post 2 How to's on the Ubuntu Forums.
- If anyone wishes to maintain some of these, please PM me :)
Post 3 Tips - Networking.
Post 4 Tips - USB Devices.
Post 5 Tips - File Sharing between hosts and guests.
Post 6 Tips - Boot Physical Partitions.
Post 7 Tips - Remote management / Web Interface.
Post 8 Tips - Guest Enhancements.
Post 9 Tips - Manage Guests from the Command Line.
Overview
It is difficult to find a good (unbiased) review of virtualization options and I will do my best to give my impressions of each option.
I do not mean to come across as a big fan of Wikipedia, but in trying to provide an introduction and attempt to provide a more neutral overview it seems a good place to start.
Non-wikipedia: Here is a nice overview
And of course Wikipedia :
http://en.wikipedia.org/wiki/Compari...rtual_machines
Reminder: The Ubuntu wiki is community maintained. If you see a page that needs clarification or updating please consider contributing to the wiki.
Open source options
- QEMU / KVM.
- OpenVZ.
- VirtualBox (OSE).
- Xen.
Closed source options
- Citrix XenServer.
- Parallels (comercial version of OpenVZ).
- VirtualBox (PUEL).
- VMWare (Player and Server).
Performance : Fastest to slowest
This is my personal subjective list and I offer it as, without any benchmarks or pretense of non-bias :twisted: (I have no personal experience with Xen):
OpenVZ > KVM > VirtualBox = VMware Server 1.0.x > VMWare Server 2.0 > Qemu + Kqemu > Qemu
QEMU
Wikipedia : http://en.wikipedia.org/wiki/QEMU
Ubuntu wiki: https://help.ubuntu.com/community/Wi...UnderQemuHowTo
Home page : http://bellard.org/qemu/about.html
Forums : http://qemu-forum.ipi.fi/index.php
Gui front ends : Yes.
KVM
Wikipedia : http://en.wikipedia.org/wiki/Kernel-...irtual_Machine
Ubuntu wiki: https://help.ubuntu.com/community/KVM
Home Page : http://kvm.qumranet.com/kvmwiki
Forums : http://kvm.qumranet.com/kvmwiki/KvmForum
Gui front end: Yes.
OpenVZ (Parallels)
Wikipedia : http://en.wikipedia.org/wiki/OpenVZ
Ubuntu wiki : https://help.ubuntu.com/community/OpenVZ
Home page : http://wiki.openvz.org/Main_Page
User Guide : http://download.openvz.org/doc/OpenVZ-Users-Guide.pdf
Parallels : http://www.parallels.com/
Forums : http://forum.openvz.org/
Gui front ends : No
Comments: OpenVZ is supported in Ubuntu 8.04 (Gutsy) but is not yet in the Intrepid repos.
Xen
Wikipedia : http://en.wikipedia.org/wiki/Xen
Ubuntu wiki : https://help.ubuntu.com/community/Xen
Home page : http://www.xen.org/
Citrix : http://citrix.com/lang/English/home.asp
Forums : http://www.nabble.com/Xen-f935.html
Gui front ends : Yes.
Comments: It appears Xen will no longer be maintained server side (Dom0 / Host) in Ubuntu. Client side (DomU / Guest) is supported. See the "how-to" post for a link to how-to-forge (which by report works on 8.10).
VirtualBox
Wikipedia : http://en.wikipedia.org/wiki/VirtualBox
Ubuntu wiki : https://help.ubuntu.com/community/VirtualBox
Home page : http://www.virtualbox.org/
Forums : http://forums.virtualbox.org/
Gui front ends : Yes.
Comments: OSE has some limitations. See VirtualBox Editions
VMWare
Wikipedia : http://en.wikipedia.org/wiki/VMware
Ubuntu wiki : https://help.ubuntu.com/community/VMware
Home page : http://www.vmware.com/
Forums : http://www.vmwareforum.org/YaBB.pl
Gui front ends : Yes.
Comments : I know it is closed source, but IMO VMWare server offers some nice features (64 bit guests, bridging to wireless cards, easier networking).
http://img381.imageshack.us/img381/4...o2small0lj.png bodhi.zazen
Re: The Virtualization Mega-Thread
Re: The Virtualization Mega-Thread
Networking
Networking raises a number of questions and I can not cover all the networking issues here.
First let me say that IMO this is an area where VMWare really shines. VMWare will take care of a number of networking issues automatically including a bridge, host-only networking, and bridging to your wireless cards.
If you are using VirtualBox or KVM chances are you will want to know how to bridge your network card :twisted:
The basic options are NAT, Bridged, and Host-only.
For most users, keep in mind NAT works "out of the box" and unless you are wanting to give public access to your virtual machine (running a public server) NAT is sufficient.
NAT - Basically with NAT your host acts as a router for your guests. NAT has an advantage in that it will work "out of the box" (in that it will give your guests internet access) with minimal additional configuration. NAT can be used with wireless cards.Bridged - When you use bridged networking your guests will act as if they are on your LAN, if you use dhcp guests will get an IP address from your router for example. The disadvantage is that, with the exception of VMWare, you must manually configure your bridge and connections. You may or may not be able to bridge your wireless card.
Once you have configured a bridge you then add interfaces, starting with eth0. You then add what are called "TAP" or virtual interfaces for your guests. You can either make a tap "on demand" with wrapper scripts when starting a guest or make them persistent.
You may or may not be able to bridge a wireless card (usually not without some serious tweaking).Host-only - Self explanatory. The guest may only communicate with the host. You can "protect" your guests in this way, keeping them isolated from the internet. An example might include running a test Apache server.
VMWare
With VMWare networking is configured during the installation. Potential advantages of VMWare are:
- VMWare will automatically set up NAT, Bridged, and Host-only networking for you.
- VMWare will bridge WIRELESS cards. Do not use the any-any updates as they will likely break your wireless bridge.
VirtualBox
Note: As of VirtualBox 2.1.0 there have been significant changes in Networking. Both NAT and bridging have improved, although I have not fully explored the details. It is no longer necessary to manually create a bridge or TAP and you can directly connect to the host eth0 (or other network card). Wireless is not yet fully supported. Please see the Virtualbox manual for full details.
VirtualBox User manual (PDF)
Again, NAT will work "out of the box".
With Virtualbox you must manually configure your bridge (See below).
- To add a persistent tap interface, (I will call it "vbox0" but you may change the name if you wish).
Code:
sudo VBoxAddIF vbox0 <user> br0
* "<user>" = your log in name.
- To remove a persistent tap
Code:
sudo VBoxDeleteIF vbox0
- To add a tap "on demand" or automagically when you boot your guest (and delete it when you power down), see the VirtualBox Documentation.
KVM / QEMU
KVM and QEMU are similar to VirtualBox. NAT will work out of the box.
If you wish to use Bridged Networking, you will need to manually add the bridge.
- To add a persistent tap interface, (I will call it "tap0" this time), you will need to manually add a TAP (see below).
- To add a tap "on demand" or "automagically" when you boot your guest (and delete it when you power down), you will again need to use a "wrapper". I posted the script I use (which I modified for use with KVM) on the KVM wiki page and the KVM how to I posted on these forums (see the links above).
How to bridge your network card
==== Tips ====
I have added a tap (tap0) to the configuration. This will configure a persistent tap (tap0) which can be used with VirtualBox of KVM/QEMU. You may add additional devices (tap1, tap2, etc) if you wish.
If you are going to use VBoxAddIF or wrapper scripts, you do not need to add a tap (just add the bridge without the tap).
Some things that you will find helpful:
First, if you wish to run a firewall on the Host you are about to become familiar with iptables. iptables is beyond this post, but in my experience the gui configuration tools hate all these virtual networking options. Google is your friend here ...
You *may* need to make a few "basic" edits. Do not make these changes if you do not need (networking is working without them) or do not understand what they do.
- Edit /etc/sysctl.conf and change net.ipv4.ip_forward = 0 to :
Code:
net.ipv4.ip_forward = 1
- If you are trying to configure a firewall on the host ~ Quick and dirty iptables rule :
Code:
-A FORWARD -i br0 -j ACCEPT
How to use that should be fairly easy to figure out.
==== End Tips ====
- Install dependencies.
Code:
sudo apt-get install uml-utilities
- Add any user you wish to use the tap to the "uml-net" group.
You may use the gui tools or the command line :
Code:
sudo usermod -G uml-net -a <user>
- "<user>" = log in name of user.
- Log out and back in for changes to take effect.
- Bring down your network (if you do not bring down your network first you will have problems).
Code:
sudo /etc/init.d/networking stop
The above command did not work for me on Kubuntu. Instead Left click the network manager icon (knetworkmanager) and go to "Deactivate connection ..." -> switch to off line mode. You can the proceed with the rest of these steps. - Make a bridge and add a "tap" to user with your virtual machines (works with Virtualbox, KVM, and QEMU).
Using any editor (gksu gedit) edit /etc/network/interfaces to add a bridge. You may use either static or dhcp :
Note: You may need to put your ether net card into promiscuous mode. If this does not work, uncomment the promiscuous line ;).
Static:
Code:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet manual
# Add a tap
auto tap0
iface tap0 inet manual
tunctl_user <user>
uml_proxy_arpa 192.168.0.10
# Add a second tap
auto tap1
iface tap1 inet manual
tunctl_user <user>
uml_proxy_arpa 192.168.0.10
# Add a bridge
auto br0
iface br0 inet static
address 192.168.0.10
network 192.168.0.0
netmask 255.255.255.0
broadcast 192.168.0.255
gateway 192.168.0.1
bridge_ports eth0 tap0 tap1
bridge_fd 9
bridge_hello 2
bridge_maxage 12
bridge_stp off
# Uncomment the following line if you need to put your
# network card into promiscuous mode.
# pre-up ip link set eth0 promisc on
DHCP:
Code:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet manual
# Add a tap
auto tap0
iface tap0 inet manual
tunctl_user <user>
# Add a second tap
auto tap1
iface tap1 inet manual
tunctl_user <user>
auto br0
iface br0 inet dhcp
bridge_ports eth0 tap0 tap1
bridge_fd 9
bridge_hello 2
bridge_maxage 12
bridge_stp off
# Uncomment the following line if you need to put your
# network card into promiscuous mode.
# pre-up ip link set eth0 promisc on
Note:
- Change "user" to the user you wish to have access to the tap.
- change "eth0" to your network card.
- If you are using a static IP, make sure you use the correct settings (netmask, gateway, etc).
- This will not work with wireless.
- If you are using a firewall on the host, you may have problems. I find Firestarter (which is a GUI front end) will often break with complex networking.
- Now bring your network back up:
Code:
sudo /etc/init.d/networking start
Kubuntu: Left click the network manager icon (knetworkmanager) and go to "Deactivate connection ..." -> switch to on line mode.
Congratulations, your network should now be back up and you should have a working bridge. Next you use a "tap" for your virtual machines. This varies between VirtualBox / KVM , but in general, on the host :
Now use the tap for your guest For example in VirtualBox use "Host Interface" and user "Tap0" for the name of the device. See the KVM wiki page (or my KVM thread) and/or the Virtualbox documentation for scripts to automate this process .
See : http://bimma.me.uk/2007/09/30/ubuntu...or-virtualbox/
Back to top ~ Or hit Ctrl-Home :rolleyes:
Re: The Virtualization Mega-Thread
USB devices
KVM / Qemu
USB disks work fine in KVM and QEMU. Again, make your user part of the disk group and use the flag
Code:
kvm -hdb /dev/sdb1 ...
where "/dev/sdb1" is the usb disk you wish to use.
For other usb devices, use the -usb flag.
VirtualBox
Thanks to HotShotDJ :
With the latest PEUL version of virtualBox [2.1.4 PUEL], USB devices should work "Out of the box". All you need to do is add your user to the vboxusers group, then log off and back on, and USB devices should be working without any further configuration.
You will need the Personal Use End License (PUEL) version of VirtualBox. The Open Source Edition (OSE) version that is included in the Ubuntu Universe repository does NOT support USB.
Go to System → Administration → Users & Groups. Unlock "Users Settings" then click on “Manage Groups”
Select the “vboxusers” group then click on the “Properties” button. Write down the Group ID number.
Open a terminal and type "gksudo gedit /etc/fstab" (without the quotes). Add the following lines to the end of the file:
Code:
# For USB access with Virtualbox
none /proc/bus/usb usbfs devgid=1001,devmode=664 0 0
IMPORTANT: Replace 1001 with the Group ID number that you wrote down earlier. Save the edited file and exit gedit.
Reboot your system.
Now you can enable the USB controller in VirtualBox. Open VirtualBox and click on your Virtual Machine then click “Settings” -- In the left panel, click on USB. Check off “Enable USB Controller” and “Enable USB 2.0 (EHCI) Controller". Do this for each VM in which you wish to have USB access.
Click HERE for more detailed instructions and additional options.
VMWare
Using any editor, add this line to /etc/fstab (gksu gedit /etc/fstab)
Code:
usbfs /proc/bus/usb usbfs auto,devmode=666 0 0
Back to top ~ Or hit Ctrl-Home :rolleyes:
Re: The Virtualization Mega-Thread
File Sharing
This is also a FAQ. My best advice is that you learn a networking protocol as it will work with any guest / host.
My advice is :
- Samba - Although there are a lot of threads, samba basically works out of the box on multiple platforms.
- NFS - NFS is great for Linux. You can mount NFS shares on Windows, but it takes some work. IMO NFS is less secure then Samba (/me hides).
- ssh - If you install a ssh server you can transfer files with scp, mount network shares with sshfs, and WinSCP is a great little Windows.
- rsync - rsync allows you to sync files or directories between machines.
- HTTP - If you install an apache server you can transfer files one way.
- FTP - FTP will allow bidirectional sharing. Take care in that FTP needs to be secured (vsftp, proftp).
- Shared folders (Virtualbox) - This is also a nice option.
- Shared USB devices. The only issue with this choice is that often a usb device can be used on either the host or guest, but not both at the same time.
Back to top ~ Or hit Ctrl-Home :rolleyes:
Re: The Virtualization Mega-Thread
Boot a physical partition
This is also a FAQ. Everyone wants to boot their windows partition :twisted:
Booting a physical partition is easy with KVM, VirtualBox, and VMWare 1.0.7.
Take great care not to boot your host partition as your guest
I have booted Linux partitions without any problem, window will complain as the "hardware' has changed.
Qemu / KVM
First add your user to the disk group.
To use your entire hard drive, use the flag "-hda /dev/sda"
To use a single partition, use "-hda /dev/sda1"
VirtualBox
Ubuntu Forums ~ Boot an existing XP (Physical HD) install with VirtualBox
VirtualBox (virtualbox): How to boot from an existing Win XP partition under Ubuntu
Boot an existing Vista (Physical HD) install with VirtualBox
And for general information / Linux partitions (which are easier then Windows)
How-to run virtualbox using a physical partition
VMWare
First, add you user to the disk group.
<link needed>
Back to top ~ Or hit Ctrl-Home :rolleyes:
Re: The Virtualization Mega-Thread
Web Interface
It is possible to manage your guests remotely with access to web interface. Take care that you understand the implications of these features.
Note It is possible to ssh into the host and manage your guests from the command line.
VMWare - http://www.zdnetasia.com/techguide/o...9366802,00.htm
VirtualBox - http://www.howtoforge.com/vboxheadle...tu-8.04-server
Qemu / KVM
Proxomox is a Debian based distribution with OpenVZ and KVM. They provide a web interface for OpenVZ and KVM.
Proxmox wiki page
VirtualBox
VMWare
Back to top ~ Or hit Ctrl-Home :rolleyes:
Re: The Virtualization Mega-Thread
Guest Enhancement
Both VirtualBox and VMWare have additional enhancements that are to be installed on the GUESTS (do not install these on the Host) to enhance performance.
KVM
My only tip is for mouse integration. Use usbdevice tablet :
Code:
kvm -hda ubuntu.qcow -usb -usbdevice tablet
http://blog.bodhizazen.net/linux/kvm-mouse-integration/
VirtualBox
Quote:
This package provides the guest utilities of the Open Source Edition of VirtualBox. These utilities are meant to be run inside the virtual machine. They provide closer integration (e.g. mouse pointer, time synchronization), improve the interactive performance (e.g. better video support), and allow to share data through shared folders between the host system and the virtual machine.
On the Virtual Box Menu, at the top of the guest, go to Devices -> Install Guest Additions
This will make the iso with the additions available. If it does not auto mount the iso, enter:
Code:
sudo mount /media/cdrom
Then simply:
Code:
sudo /media/cdrom/VBoxLinuxAdditions-x86.run
*Change that to "VBoxLinuxAdditions-amd64.run" for 64 bit guests or the appropriate *.exe for window guests.
And reboot the guest.
Additional Tips:
How to optimize a VirtualBox Linux guest
~ Thanks tkoco
VMWare
Features (from the Ubuntu wiki):
Quote:
Advantages of having VMware Tools installed on your Ubuntu/Kubuntu/Xubuntu guest
* VMware Network acceleration
* VMware Video acceleration
* Host to Guest time synchronization
* Seamless mouse movement between host and guest
* Cut & Paste - Guest to Host and Guest to Guest (with VMware Toolbox) (possibly only on gnome)
* Disk Shrink (with VMware Toolbox running at root)
* Startup/Shutdown Scripts (with VMware Toolbox running at root)
* HeartBeat (VMware/Esx only ?)
See wiki for installation instructions : /community/VMware/Tools
Back to top ~ Or hit Ctrl-Home :rolleyes:
Re: The Virtualization Mega-Thread
Manage Guests from the Command Line
Just a start ...
KVM
KVM uses the same commands as qemu. To be honest, man qemu is the best reference I know.
You may also use virsh
https://help.ubuntu.com/community/KVM
VirtualBox
Use VBoxManage
The command line allows you to resize and back up virtual disks.
http://www.linux.com/feature/151029
VMWare
Use vmware-cmd
Syntax : vmware-cmd [config] [option] ...
http://www.vmware.com/support/esx2/doc/vmware-cmd.html
Convert your vitrual HD VMWare (hd.vmdk) <-> VirtualBox (hd.vdi)
http://www.xgrr.de/wordpress/2008/02...to-vmware-vmdk
http://thedarkmaster.wordpress.com/2...ersion-how-to/
Back to top ~ Or hit Ctrl-Home :rolleyes: