I’m using libvirt to manage my kvm instances (it has a nice gui tool virt-manager which works across ssh connections and can manage your lvm volumes too).

Set the default to qemu/kvm for libvirt:

export VIRSH_DEFAULT_CONNECT_URI="qemu:///system"

Performance Tip

While the vnc feature is really nice to have, it costs too much cpu usage imho. I recommend to use the serial console instead:

getty login on console

(On your kvm node)

Edit your /etc/inittab and add:

s0:23:respawn:/sbin/getty 38400 ttyS0

Either wait for the next reboot or call telinit q to reload inittab.

accessing the serial console

(On your kvm master)

Use virsh console yourdomain
Press enter if you don’t see anything (to reshow the login).
Press “Ctrl-Alt-]” to close the console.

libvirt – remove unneeded devices

(On your kvm master)

Edit the config file for your domain and remove the mouse, display and video devices. (either with virsh edit yourdomain or in virt-manager “View → Details”)

Changes to kvm nodes require a shutdown and a start to apply (restart does NOT work).


(On your kvm node)

The grub2 docs are pretty bad, but it has the needed features.

In debian add the following in your /etc/default/grub file:

GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,38400"

GRUB_TERMINAL="serial console"
GRUB_SERIAL_COMMAND="serial --speed=38400 --unit=0 --word=8 --parity=no --stop=1"

Note: Don’t forget to run update-grub!

Now you can control grub from the serial console too and you’ll see the boot messages too.


I had “plain” partitions on my lvm volumes; in order to install a boot manager you should have a “disk” with a partition table; i just added a small volume (256 MB) and put a /boot partition on it; that way you can still snapshot the real volume on the master, mount it and get a backup from it.

libvirt will use the first listed hard disk in the config as boot disk; but you can list “vdb” before “vda”, if “vdb” is your new boot disk and “vda” the data partition.

In order to install a boot manager in the kvm node i started from a small grml:http://grml.org/download/ iso; mount the volume, bind /dev (mount --bind /dev /mnt/vda/dev) and mount /boot (if you want to use it; don’t forget to copy the real data from /boot on your new boot partition).
Then chroot into your volume (as you probably don’t have zsh specify a shell) and install grub:

chroot /mnt/vda /bin/bash

Now shutdown, remove the cd and start again.

Networking at Hetzner


Hetzner routes all traffic to your main ip; so the easiest setup is to use the main ip on your master, and use additional ips on your nodes. NAT + portforwarding works too ofc.

Don’t forget to enable ipv4 forwarding (/etc/sysctl.conf for permanent change):

sysctl net.ipv4.ip_forward=1


Hetzner assumes all your IPv6 addresses are directly available on the eth0 network. As you can’t setup a bridge over eth0 (Hetzner has a MAC filter), you will need to proxy the neighbour discovery:

# enable packet forwarding for IPv6
sysctl net.ipv6.conf.all.forwarding=1
# Proxy neighbour discovery on eth0
sysctl net.ipv6.conf.eth0.proxy_ndp=1

Now add the IPv6 addresses you use “behind” eth0 (i.e. on the virbr* networks) to the neighbour “proxy” list.
For permanent config add each line as “post-up” in the eth0 inet6 section of your /etc/network/interfaces files.

post-up ip -6 neigh add proxy HERE-THE-IPV6-ADDRESS dev eth0

(that is another undocumented feature of the ip tool…)

Generated using nanoc and bootstrap - Last content change: 2012-06-29 16:15