Xen: A First Look
Written by: Steve McMaster
From Eye of the Storm - September 2008
I recently began trying to find something to replace VMware on my home VM server. I was having issues with keeping time, and when I upgraded my kernel and the VMware modules stopped loading, I decided the time had come to take the plunge and try something new - Xen. Xen is a free virtual machine monitor, or “hypervisor”, that lets you run several virtual guests on a single physical machine. It uses what is called “paravirtualization”, where the guest OS is modified to pass hardware calls through to the hypervisor, to run guest operating systems at “near native” speeds - that is, as if they were running on the physical machine itself. It also supports fully virtualized guests, letting you run an unmodified guest operating system, by utilizing hardware extensions present in modern processors.
At first look, Xen is a terribly complicated beast. The Xen hypervisor takes over the OS running on the physical machine -- this becomes “domain 0”, or dom0. This domain has special permissions to access the hardware on the system. Any guest you create is referred to as an “unprivileged domain”, or domU. These guests run with limited access to the hardware, which is controlled by dom0.
Once you wrap your head around Xen, the way it does things makes a lot of sense. It can use logical volumes inside the Linux Logical Volume Manager (LVM). In your configuration file for your Xen guest (note: all Xen configuration is done inside that configuration file, unlike VMware products which have a GUI for configuration), you can configure the guest’s access to different types of hardware (eg. mice, disk drives, CD/DVD drives, etc), as well as network interface information.
Xen also makes changes to your network settings. In dom0, your physical network interfaces are added to network bridges, and Xen creates virtual interfaces for each of the guest domains. While this may seem very complicated (especially when compared to how VMware handles networking), it allows Xen to give you very complicated network configurations with less configuration on your part. The XenSource wiki has a page explaining several possible network configurations.
My OS of choice for my guests is Ubuntu Server (additional link). (It is also the OS of choice for my domain 0.) The Xen-tools package provides a script that will configure an Ubuntu guest for you, including network settings, hostname, etc. The script takes advantage of a program Ubuntu inherited from its Debian roots called “debootstrap”. This program creates a basic installation of Ubuntu (or Debian) in a filesystem. You can use chroot to “jail” yourself into a debootstrapped directory or in the case of Xen, you can use the filesystem to power a domU guest. This is a much faster process than doing an installation from a CD, as you must do with VMware.
Xen also allows you to run hardware supported guests. This allows you to run unmodified proprietary operating systems, such as Microsoft Windows, as a guest operating system. However, you must have a recent processor that supports the Intel VT-x or the AMD-V extensions.
Anyone who has used VMware has used VMware Server Console. Xen itself does not come with a console, though several third parties do provide a GUI for it, such as virt-manager by RedHat. In other cases, from a connection to dom0, you can connect to the console of each guest domain. You can also configure Xen to provide a VNC server, allowing you to connect to the guest via VNC and see its console. And of course, you can install SSH in your guest to allow remote access to it.
Setting up a Xen server is not for the faint of heart. Some of the concepts behind Xen are difficult to grasp at first, making configuration difficult. Some of the parts of Xen are not very well documented, and you may spend hours (or a whole weekend, if you’re me) researching how to do something. However, once you get Xen running, you’ll be rewarded with a powerful virtualization system with speedy guest creation, Windows guest support, VNC console support and advanced networking options.




