
COVER STORY Virtualizing with Xen joexx, photocase.com joexx, XENSATIONALGetting started with Xen virtualization The powerful and popular Xen virtualization system offers an easy solution for running Windows on Linux. BY MARTIN LOSCHWITZ AND MARKUS FEILNER he popular Xen virtualization ple configuration procedure takes just a The hypervisor binds the individual system lets you install different few steps. Debian has recognized these virtual machines to the network and Toperating systems on the same benefits, and Etch now has full support supports communications with the out- hardware to leverage computational for Xen. side world. In the world of Xen, the host power efficiently. Although Debian 4.0 includes Xen, system with the hypervisor is referred In this article, we describe how to get version 3.0.3 is not exactly state of the to as Dom 0 (or Domain 0), and a guest started with Xen in Debian Etch, and art. The tips and advice in this article system is known as Dom U (Domain U). you will learn about starting the guest can’t be applied one-to-one to later ver- The only task that Dom 0 has is to and host systems and even how to set up sions of Xen in many cases because the contain each active Dom U. When you a Windows guest on a Linux host. Some configuration file layout, and other are planning a Debian Xen system, a of the details might differ for other dis- things, have changed. fresh Debian install is a perfect starting tros, but the steps are similar. point. Although theoretically, there is Monitored by a Hypervisor nothing to stop you from using Dom 0 Etch with Xen 3.0.3 Xen introduces a hypervisor upstream of for normal purposes, such as hosting a In the community, one software solution the kernel running directly on the hard- web server, the potential damage that has practically become the virtualization ware (see Figure 1); the hypervisor uses an attacker could cause by hijacking standard. Xen [1], by the University of the Xen Virtual Machine Monitor to ac- Dom 0 is a very good reason to avoid Cambridge, has a number of points in its cess the hardware. The Xen hypervisor putting Dom 0 into production. favor. Because it emulates a complete allocates resources to the individual vir- Any user with full access to Dom 0 computer in a style similar to VMware, tual machines. A guest operating system also has complete control over every ac- users have an almost unrestricted choice only communicates with the hypervisor tive Dom U. For this reason, it is impor- of guest operating systems. Many man- and is completely independent of the tant to outsource any services to a sepa- agement tools are available and the sim- other guests. rate Dom U when using Xen and to start 30 ISSUE 90 MAY 2008 030-033_xen.indd 30 12.03.2008 14:17:00 Uhr Virtualizing with Xen COVER STORY host machine in access. It is also possible to assign a our example. First, static (arbitrary) MAC address; other- you need to create wise, Xen will assign a randomly gener- a configuration ated MAC address to the network file for Xen, then adapter each time you start the virtual you need to install machine. In turn, this will cause Etch’s the guest operat- hotplug system to keep changing the ing system on network device number, and the auto- your disk. matic configuration in /etc/network/ interfaces will then fail. Files for Dom U Guest Filesystems In Xen 3.0, the Two basic options exist for guest filesys- configuration files tems: Either you can assign one or multi- Figure 1: The Xen Virtual Machine Monitor handles all hardware have their own ple partitions to Xen or the Dom U can access, using the hypervisor to pass requests to the host (Dom 0). special format. work with image files. Both solutions The hypervisor uses back-end drivers to allocate resources to Dom U The files are have advantages and disadvantages: virtual machines. stored in /etc/xen Physical partitions typically improve per- and have a file ex- formance, but files allow the administra- off with a fresh host system that does tension of .cfg. The Xen configuration tor to create backups by simply copying not run any services (with the exception file schema is fairly simple (Listing 1). from Dom 0. of SSH). name refers to a name that Xen uses to This decision is a matter of taste and Just a couple of steps are needed to reference the Dom U; hostname refers to will depend to a great extent on what make a Debian installation Xen-capable. the virtual machine’s hostname. kernel you will be using the system for. The Working as root, start by installing Xen and ramdisk contain the full paths to the example in the listing assumes that one and the bridge control programs that Xen boot kernel and its ramdisk; root tells the Dom U uses /dev/hda3 as a drive for its needs to set up the network configura- kernel which of its partitions contains root filesystem. On top of this, Xen can tion. The package names are bridge-utils, the root directory. assign multiple virtual disks as hard-disk xen-linux-system-2.6.18-3-xen-686, The memory setting defines how much partitions to the virtual machine. xen-tools, and libc6-xen. Xen replaces the RAM the Xen hypervisor should reserve legacy C library with a specially modi- for this Dom U, and the disk entry speci- Virtual Debian fied version. fies which disk or image files the Xen The guest domain is installed completely After completing this step, disable the guest will detect. Because the guest ma- from within Dom 0. Theoretically, you C library’s TLS functionality; the easiest chine also expects paths to the virtual could boot the Debian installer with Xen way of doing this is to move the library filesystem, the administrator has to de- and then use it to install the new system, by typing mv /lib/tls /lib/tls.disabled. cide at this stage where the filesystems but in reality, this approach will fail be- Because the following steps require In- that will be created in the next step cause of the lack of Xen support in the ternet access, a network card must be should be stored. set up in /etc/network/interfaces. As you can see in Listing 1, a Dom U Listing 1: Xen Configu- After installing a specially prepared can also access a physical CD drive, ration for a Debian Dom U Xen kernel, type lsmod and check the specified as cdrom. The vcpus value 01 name="debian1" /etc/modules file to see whether the sys- specifies the number of processors that tem provides a netloop module. To make the Dom U is allowed to access. For ex- 02 hostname="debian1" sure that everything will work after you ample, if Dom 0 has a dual-core proces- 03 kernel = "/boot/ reboot, you should see an entry for net- sor, you can use vcpus to specify vmlinuz-2.6.18-3-xen-686" loop nloopbacks=255. Reboot the ma- whether the guest will be able to access 04 ramdisk = "/boot/initrd. chine and, at the boot prompt, select the one core or two. img-2.6.18-3-xen-686" Debian Xen kernel before logging on in 05 memory = 512 the normal way. Some dmesg output Kernel, Ramdisk, Root 06 vcpus = 1 with various hypervisor messages con- The values kernel and ramdisk in the cerning available processors or memory configuration relate to the filesystem for 07 vif = [ capacity should appear. Dom 0. If you want to replace the Dom 'mac=aa:00:00:12:23:34, This takes care of the prerequisites for U kernel at a later stage, you can copy bridge=bridge0' ] running a Dom U. Working as root, type the new kernel to the right place in Dom 08 disk = [ 'phy:/dev/ xm list to see whether the hypervisor is 0 and then just modify the configuration hda3,hda1,w', 'phy:/dev/ working. file for the virtual machine. hda5,hda2,w' ] The next step is to configure a guest The vif entry specifies which network 09 cdrom = "/dev/cdrom" machine, the first Dom U, which will be interface Dom U is allowed to access and 10 root = "/dev/hda1" running Debian GNU/ Linux Etch like the which bridge Xen will use to handle this MAY 2008 ISSUE 90 31 030-033_xen.indd 31 12.03.2008 14:17:09 Uhr COVER STORY Virtualizing with Xen setup, you can now start the virtual sys- tem. To do so, change directory to /etc/ xen and give the following command: xm create -c name of configuration file. The -c parameter redirects the output from the Dom U’s virtual screen to the current console. If everything worked out, the login prompt should be dis- played after the Linux kernel boot mes- sages. From now on, the init scripts in- Figure 2: Four virtual machines, each a Dom U, running on a Debian Xen server. The xm top cluded with the Xen package will auto- tool provides a continually updated status report for the server and the guests. matically launch the new Dom U when- ever you boot the system. Debian installer kernel. Instead, the Now, the root user has to install the Debian Debootstrap [2] installation tool locales and console-data packages manu- … and Stopping It is used. Working as root, type apt-get ally and add the following line to the The xm list command gives an overview install debootstrap to install the tool in /etc/hosts file: of the virtual domains running on your Dom 0.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages4 Page
-
File Size-