2006 / Xen 3.0 on Debian 4.0: The Basics

Xen 3.0 on Debian 4.0

I've been playing with Xen 3.0 on Debian Etch recently. It's very easy to set up with the instructions found on wiki.debian.org/Xen. I'm currently using the 2.6.18-3-xen-vserver-686 packages on a Mobile Pentium 4.

Creating a domU

With the help of xen-tools, creating a domU image should be as simple as calling xen-create-image with parameters to specify how to configure the domU virtual server. For example, you could use this:

sudo mkdir /home/xen/
sudo xen-create-image --hostname=devel --dhcp --dir=/home/xen/ --dist=etch --debootstrap

More information can be found in the manpage of xen-create-image(8) and on the examples page on the xen-tools homepage.

Networking

After having created the necessary files and configuration for the domU, I had to tweak Xen's configuration to enable bridging of network traffic. This is the most simple configuration in which a virtual bridge will be placed between the eth0 interface of the dom0 and domU(s) and the real, physical interface (eth0 for me when running the machine in non-Xen mode).

I had to uncomment the following line in /etc/xen/xend-config.sxp:

(network-script network-bridge)

After that, don't forget to re-start xend with a simple /etc/init.d/xend restart. This should enable the very basic network bridge setup.

In the configuration file of the domU (/etc/xen/devel.cfg for me), I had to set up the virtual network interface by changing the vif=[...] line to vif = [ 'mac=00:aa:bb:cc:dd:ee,bridge=xenbr0' ], where I had (of course) chosen a random MAC address instead of the one listed above. This enables me to associate a fixed IP address to my devel domU by making a static DHCP entry for the MAC address mentioned above.

Basic usage

This is described better elsewhere (see the XenSource Wiki for example), so here's just some hints that got me started:

# xm create devel.cfg -c     (start the "devel" domU and attach to its console)
# xm console devel.cfg       (when the "devel" domU runs, this attaches to the console)
# xm destroy devel.cfg       ("pull the plug" of the virtual machine [non-clean shutdown])
# xm list                    (list current domains that are running)
# xm top                     (top-like display of running domains and their resource usage

Keyboard commands:
Ctrl+] detaches from a attached domU console

Device 2049 (vbd) could not be connected.

If you get this error when trying to start a Xen domU, the problem might be that you haven't loaded the loop module. As suggested in some guide on the web, one should add the max_loop option to the module, so instead of only 8 loopback devices you will have 255. To accomplish this on Debian, simply create a /etc/modprobe.d/loop file with the contents listed below and add loop to the list of modules to load on bootup to your /etc/modules file (all this is done on the dom0, or host machine). You then just need to issue modprobe loop once after setting this up to load the module. Starting with the next reboot, everything should work fine and you can even move the config files of your domU(s) to /etc/xen/auto/ to have them automatically booted on system startup.

/etc/modprobe.d/loop

options loop max_loop=255

/etc/modules

[...]
loop

Links


Mon May 28 13:59:50 2007 +0000