Hetzner - DokuWiki

Xen auf Debian/en

Inhaltsverzeichnis

Foreword

Each virtual machine (Dom U) requires an own IP.

Host Setup

Preparing the Host for XEN

Neu Installation

This installation example uses the default Hetzner Image 'Debian 6.0 Squeeze 64Bit minimal' for the Dom0. The image is installed with the aid of the Rescue System.

After a reboot, the operating system and corresponding password for the Rescue System are available.

Instructions for installing images can be found in the wiki at: Installimage

Adjustments in Grub

Grub2 is the default installation on Debian. However the kernels are booted first without the Xen module by default. This can be adjusted by changing the sequence of entries in Grub.

mv /etc/grub.d/10_linux /etc/grub.d/25_linux

Alternatively, Grub2 can be replaced with Grub1 (grub-legacy). Here the Xen menu entries are set up first.

In addition, it is necessary to add the kernel option "acpi=ht" on EQ server models and on the EX 5, as otherwise the system will not allow itself to be rebooted. It is necessary to adjust /etc/default/grub, so that the changes are not overwritten during the next kernel update:

GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 acpi=ht"

Using Additional IP Addresses in a Virtual Server

There are several options for configuring a virtual server. With a routed setup the IP of the host system needs to be used as gateway.

# Routing
IP address: 192.0.2.20
Gateway: 192.0.2.2 (IP address of the host system)
# Bridging (requires virtual MAC addresses)
IP address: 192.0.2.20
Gateway: 192.0.2.1 (same gateway as the host system)

Using Additional Subnet

An IP address from the subnet is now set up on the host system. This serves as gateway for the DomUs.
Add the following line to /etc/network/interfaces:

up ip addr add 192.0.2.129/29 dev eth0

The IP can be tested with

ip addr add 192.0.2.129/29 dev eth0

In the event that an error message is shown, please check to see if the "iproute" package is installed and whether eth0 is the network card. The IP should now be pingable from the outside.

In the virtual server itself, one of the remaining IP addresses from the subnet is configured and the IP address configured above in the host system is set as gateway. For example:

IP address: 192.0.2.130
Netmask: 255.255.255.248 (/29 Net)
Gateway: 192.0.2.129 (extra configured IP in the host system)

Enable ip_forward

The following value needs to be set in the file /etc/sysctl.conf:

net.ipv4.ip_forward=1

This value can be loaded and set using "sysctl -p".

Manual Installation of Required Packages

Next the Xen kernel, hypervisor and xentools are installed. The current version of the Xen kernel can be loaded using aptitude.

aptitude install xen-linux-system-2.6-xen-amd64 xen-tools

Grub is automatically updated here. A reboot needs to be performed at this point in order to enable the kernel.

Dom 0 Setup

The "network-script", as suggested in Additional Information on IP Subnets, is converted to network-route. Otherwise virtual MAC addresses need to be requested via the Hetzner Robot for additional single IP addresses.

# (network-script network-dummy)
# (vif-script vif-bridge)
(network-script network-route)
(vif-script vif-route)

in /etc/xen/xend-config.sxp

Xen is operational following a restart of the Xen backend.

/etc/init.d/xend restart

Dom U Setup and Start

The simplest way to set up Debian DomU is to use the xen-tools, xen-create-image program. The default settings are set in /etc/xen-tools/xen-tools.conf and greatly shorten the process.

mkdir /xen
xen-create-image --hostname=xen1.example.org \
--ip=192.0.2.130 --netmask=255.255.255.248 --gateway=192.0.2.129 \
--dir=/xen --passwd

DomU can now be started using

xm create xen1.cfg

From now on DomU can be reached externally per SSH and can be setup.



© 2018. Hetzner Online GmbH. Alle Rechte vorbehalten.