Xen-based virtualisation with opensuse 11.2

I recently upgraded my laptop’s opensuse 11.1 installation to 11.2, mainly because it has updated xen to version 3.4 which makes it one of the most modern distributions with xen support available. I did some research first about which linux distribution would best suit my needs. When I came across a post which said that Fedora 12 had no (official) kernel support for use as dom0 the decision was made. I know I could have used a debian clone (ubuntu 9.10 seemed quite attractive), but for personal reasons I preferred a RPM based system. I was very pleasently surprised that the Intel GMA 4500MHD graphics chipset finally found hardware acceleration, making it so much more enjoyable to browse the web.

Anyway, after the installation of opensuse 11.2 x86-64 I opened yast, the setup tool and opted to install hypervisor and tools-yes, that’s all what’s needed. This will install the xen kernel and update the grub menu.lst in /boot/grub/. After a reboot into the xen kernel I started X11 and continued working as normal. After the next system update I had the following relevant RPMs on my system

linux-nc0d:~ # rpm -qa | egrep "(virt|xen)" | sort

I initially started xen based virtualisation with Oracle VM, which is based on RHEL 5.x. The main (command line) tool for the creation of guests was virt-install. OpenSuSE comes with a different set of tools:

  • vm-install which I’ll cover in more detail later is a GUI/command line tool hybrid for installing virtual machines.
  • virt-manager is very similar (maybe identical) to Fedora’s GUI for managing virtual machines

Bridged networking-a different approach

Coming from a VMWare background the networking concept in xen was (is?) mind boggling at first but luckily opensuse removes almost all of the complexity from you by allowing the bridge configuration through yast. As I am primarily interested in running RAC, I needed two network interfaces in my virtual machines: the public as well as an interconnect. I also wanted my virtual machines to connect to the internet just in case I quickly need to download a package through wget. This is really simple (I remember it wasn’t with xen 3.1.4). The concepts used are bridges, very similar to the real thing. When you install the hypervisor, opensuse automatically creates n bridges for you, one for each network card. It also ties that interface to the bridge. Assuming you have 2 NICs in your machine, you’ll end up with br0 and br1 – br0 enslaves eth0 whereas br1 does the same with br1. This implies that your VMs can “see” all the hosts that the physical interfaces in your dom0 can see. Can be handy! In my case though I wanted the equivalent of a “host only” network, something private to myself. Also very easy! Again the magic happens in yast’s network settings. Click on the “add button” after the configuration was loaded, then select device type “bridge”. In the address tab, chose “statically assigned ip address” and enter the details. I didn’t enter a hostname and clicked on “finish”, prompting yast to write the configuration. Check ifconfig to see the new settings for br0 and br1. Adding the VM to the network bridge is achieved by changing the vif= directive in the xen configuration file, I entered the following for my example, bear in mind that the MAC addresses for xen are in the 00:16:3e range!

vif = [ 'mac=00:16:3e:42:62:33, bridge=br0', 'mac=00:16:3e:43:62:33, bridge=br1' ]

Setting the mac address is recommended, guest operating systems get confused about the hardware otherwise: a different MAC address usually implies a changed hardware component which will then be configured automatically by the OS, and you lose all your settings.

Creating virtual machines

This proved a bit tricky at first-the tools (especially vm-install) seem to be a bit buggy still so I had to abandon my usual approach of creating VMs via NFS. Instead I used apache, I am installing Oracle Enterprise Linux 5.4 x86-64 as a guest in the following example.

First of all I needed to install apache2 as that was still missing from my system.

# zypper install apache2 yast2-http-server

The latter allows me-a layman when it comes to the administration of apache2 – to perform a basic configuration. Start Yast2, the select http-server to initialise the settings. I could have created a virtual host to provide the install media but decided against it (I wanted fast results!). The easy was is to create a subdirectory rhel in your server root (/srv/www/htdocs) and mount the Enterprise-R5-U4-Server-x86_64-dvd.iso as a loopback device. Don’t worry about file permissions, it all automagically worked!

Start the webserver if it isn’t running (rcapache2 start) and then try vm-install. The gui is rather self explanatory, the following is a walkthrough of vm-install:

  • on the welcome page click Forward
  • select “I need to install an operating system”
  • in my case I went for Red Hat – Red Hat Enterprise 5

set the domU’s characteristics on the next page

  • name of the virtual machine
  • processors and available memory
  • Change the disk (you can even change to use lvm here-protocol phy!)
  • network (ensure that your bridge has an IP address that can talk to the domU!)
  • you definitely need to change the operating system installation, I entered the network URL http://<ip for my bridge device>/rhel which worked beautifully.

Once you click “apply” the installation will begin and you get a vnc display to work with. In the VM, enter an IPv4 address on the same network as your bridged device and continue with the installation. From there on the installation is identical to the installation on a physical box.

Enjoy! I still use nfs mounts from my dom0 to domU to install any missing packages which is a great help.


1 thought on “Xen-based virtualisation with opensuse 11.2

Comments are closed.