Here a quick quide on how to install KVM, libvirt and virtual machines. This has been tested with Hetzner, Softlayer and OVH and should work with all major dedicated server providers.

You will need extra IP addresses for the virtual machines, so make sure to order an extra subnet for your server.

1. Install the needed packages

apt-get install qemu-kvm libvirt-bin

2. Enable ip_forward by adding the following line to /etc/sysctl.conf


Activate the change by running

sysctl -p

3. Configure libvirt for your additional subnet

Enter virsh by typing virsh in the command line. To make changes to the default network with the net-edit command, you first have to destroy the network and then start it again, otherwise net-edit won’t save the changes.

virsh # net-destroy default Network default destroyed

virsh # net-edit default Network default XML configuration edited.

Change the configuration so that it looks similar to the one below. The value for ip address is the network address of your subnet. If for example you have been provided with an additional subnet the network address is

default 1088e3f8-3b59-11e0-bcfb-001372333e54

Start the network again.

virsh # net-start default

4. You can now install your virtual machines. The easiest way to install a virtual machine is from an iso image with the Virtual Machine Manager. The iso image should be placed into /var/lib/libvirt/images/.

cd /var/lib/libvirt/images/ wget

Then start virt-manager on your computer, connect to the server and install the virtual machines.

After installing the VM you will need to update its network configuration so it can connect to the internet. Make sure to set the gateway to your servers main ip address, to add a line pointopoint with the same ip address and to set the netmask to Here an example of /etc/network/interfaces:

The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet static address netmask network broadcast gateway pointopoint

If you have troubles with DNS also check if /etc/resolv.conf exists and if it contains a valid nameserver.