BYTEMARK HOSTING SITE MAP

Hosting services | Connectivity | Support | Company | Software | Order now

Introduction To Xen Tools

The xen-tools package consists of several small scripts which combined allow you to easily create, delete and list Xen guests.

This guide assumes that you have read the Bytemark xen setup guide and are ready to create your first guest machine.

Creating a machine

To create a new virtual machine you will need to login as root upon the Xen domain 0 (that’s the default root password and IP for your server).

A simple example to create a machine would be:

  xen-create-image \
    --hostname=example.example.com \ 
    --ip=10.0.0.10 \
    --dist=etch \
    --passwd \
    --boot

If everything goes to plan, this will create a new machine, prompt you for a root password, and boot it. Within a few seconds you should be able to ping and log into the new host.

To explain the parameters so that you can change them:

  • hostname controls the initial hostname of the guest – this is also used to name the control files and disc images;
  • ip is the IP address that you wish to allocate to the guest – Bytemark will give you a range when you order your machine, and addresses outside of this range won’t work;
  • dist refers to the Linux distribution you wish to run – see the list of available distributions here
  • passwd makes the script prompt you for a password
  • boot tells the script to boot the system as soon as it’s finished.

Configuration

The xen-tools package is configured by the use of the file /etc/xen-tools/xen-tools.conf. This file can be used to reduce the length of the command that you use to create new guests.

For example if you wished each of your Xen guests to be installed with Debian Etch you could add the following to the configuration file:

   dist = etch

In the future you would no longer need to specify the “—dist=” flag when creating new machines unless you wished to use a different distribution.

Similarly you could also specify:

    boot = 1
  passwd = 1

This would ensure that you were always prompted for a root password, and that each new guest would be booted automatically once it had been created.

Each of the settings in the configuration file matchs the parameters accepted as command line arguments, with the leading “” removed. For a full list of configuration options, take a look at the configuration file itself.

Automatic allocation of IP addresses

You can also set up your system to automatically allocate IP addresses, so that you don’t even need to specify that automatically.

You can instead reduce your creation step to simply specifying the hostname. The system itself will allocate the IP address, allowing you to forget about it.

To enable this you’d specify ip = 1.2.3 within the configuration file, and allow the last octet of the address to be automatically generated. The first guest would get .1, the second guest you created would get .2, etc.

The system stores the last octet used in the creation of an image in the file /etc/xen-tools/ips.txt – and automatically updates it when new machines are created.

Further Help

For further help you can read the manual page, and the examples it contains, by running:

  xen-create-image --manual

Some more information is also available upon the project’s homepage

Topics:

Tutorial Xen

© 2006 Bytemark Hosting. All rights reserved